Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / emacs.scm
CommitLineData
468bdabb 1;;; GNU Guix --- Functional package management for GNU
4e941436 2;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
eeb883cb 3;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
4a3e602c 4;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>
5069baed 5;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org>
eeb883cb
RW
6;;; Copyright © 2014, 2015, 2016, 2017 Alex Kost <alezost@gmail.com>
7;;; Copyright © 2016, 2018 Arun Isaac <arunisaac@systemreboot.net>
8;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
9;;; Copyright © 2016 David Thompson <dthompson2@worcester.edu>
47956fa0 10;;; Copyright © 2016 ng0 <ng0@n0.is>
eeb883cb 11;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
215a45d9 12;;; Copyright © 2017, 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
eeb883cb
RW
13;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
14;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
7a0efa77 15;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
eeb883cb
RW
16;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
17;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
7ab5c4e0 18;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5ce153b1 19;;; Copyright © 2019 Jesse John Gildersleve <jessejohngildersleve@zohomail.eu>
468bdabb
LC
20;;;
21;;; This file is part of GNU Guix.
22;;;
23;;; GNU Guix is free software; you can redistribute it and/or modify it
24;;; under the terms of the GNU General Public License as published by
25;;; the Free Software Foundation; either version 3 of the License, or (at
26;;; your option) any later version.
27;;;
28;;; GNU Guix is distributed in the hope that it will be useful, but
29;;; WITHOUT ANY WARRANTY; without even the implied warranty of
30;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31;;; GNU General Public License for more details.
32;;;
33;;; You should have received a copy of the GNU General Public License
34;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35
1ffa7090 36(define-module (gnu packages emacs)
f61e0e79 37 #:use-module ((guix licenses) #:prefix license:)
468bdabb
LC
38 #:use-module (guix packages)
39 #:use-module (guix download)
f906d30c 40 #:use-module (guix git-download)
468bdabb 41 #:use-module (guix build-system gnu)
71f57158 42 #:use-module (guix build-system glib-or-gtk)
59a43334 43 #:use-module (gnu packages)
eeb883cb 44 #:use-module (gnu packages acl)
18d26210 45 #:use-module (gnu packages autotools)
be379ee7 46 #:use-module (gnu packages base)
f61e0e79 47 #:use-module (gnu packages compression)
eeb883cb 48 #:use-module (gnu packages fontutils)
a80b60f4
AI
49 #:use-module (gnu packages fribidi)
50 #:use-module (gnu packages gd)
eeb883cb
RW
51 #:use-module (gnu packages gettext)
52 #:use-module (gnu packages glib)
5ce153b1 53 #:use-module (gnu packages gnome) ; for librsvg
eeb883cb
RW
54 #:use-module (gnu packages gtk)
55 #:use-module (gnu packages guile)
56 #:use-module (gnu packages image)
57 #:use-module (gnu packages imagemagick)
5ce153b1 58 #:use-module (gnu packages linux) ; alsa-lib
59 #:use-module (gnu packages mail) ; for mailutils
eeb883cb
RW
60 #:use-module (gnu packages ncurses)
61 #:use-module (gnu packages pkg-config)
62 #:use-module (gnu packages texinfo)
63 #:use-module (gnu packages tls)
5bbb04f9 64 #:use-module (gnu packages webkit)
eeb883cb
RW
65 #:use-module (gnu packages xml)
66 #:use-module (gnu packages xorg)
4a3e602c 67 #:use-module (guix utils)
eeb883cb 68 #:use-module (srfi srfi-1))
468bdabb
LC
69
70(define-public emacs
71 (package
72 (name "emacs")
7ab5c4e0 73 (version "26.3")
468bdabb
LC
74 (source (origin
75 (method url-fetch)
76 (uri (string-append "mirror://gnu/emacs/emacs-"
3be9f724 77 version ".tar.xz"))
468bdabb
LC
78 (sha256
79 (base32
7ab5c4e0 80 "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"))
fc1adab1 81 (patches (search-patches "emacs-exec-path.patch"
4509ec72 82 "emacs-fix-scheme-indent-function.patch"
0cdb6ab4 83 "emacs-source-date-epoch.patch"))
486f36eb
AK
84 (modules '((guix build utils)))
85 (snippet
86 ;; Delete the bundled byte-compiled elisp files and
87 ;; generated autoloads.
88 '(with-directory-excursion "lisp"
89 (for-each delete-file
90 (append (find-files "." "\\.elc$")
91 (find-files "." "loaddefs\\.el$")
92 ;; This is the only "autoloads" file that
93 ;; does not have "*loaddefs.el" name.
dc701091
LC
94 '("eshell/esh-groups.el")))
95
96 ;; Make sure Tramp looks for binaries in the right places on
59e80445 97 ;; remote Guix System machines, where 'getconf PATH' returns
dc701091
LC
98 ;; something bogus.
99 (substitute* "net/tramp-sh.el"
100 ;; Patch the line after "(defcustom tramp-remote-path".
101 (("\\(tramp-default-remote-path")
102 (format #f "(tramp-default-remote-path ~s ~s ~s ~s "
103 "~/.guix-profile/bin" "~/.guix-profile/sbin"
104 "/run/current-system/profile/bin"
d1c11418
OP
105 "/run/current-system/profile/sbin")))
106
107 ;; Make sure Man looks for C header files in the right
108 ;; places.
109 (substitute* "man.el"
110 (("\"/usr/local/include\"" line)
111 (string-join
112 (list line
113 "\"~/.guix-profile/include\""
114 "\"/var/guix/profiles/system/profile/include\"")
6cbee49d
MW
115 " ")))
116 #t))))
71f57158 117 (build-system glib-or-gtk-build-system)
468bdabb 118 (arguments
7ab5c4e0 119 `(#:tests? #f ; no check target
494978c4 120 #:configure-flags (list "--with-modules"
121 "--disable-build-details")
2206c7ad 122 #:phases
13fe4891
FB
123 (modify-phases %standard-phases
124 (add-before 'configure 'fix-/bin/pwd
125 (lambda _
126 ;; Use `pwd', not `/bin/pwd'.
127 (substitute* (find-files "." "^Makefile\\.in$")
128 (("/bin/pwd")
e2d90ee4
MW
129 "pwd"))
130 #t))
13fe4891 131 (add-after 'install 'install-site-start
59d04f63
AK
132 ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages
133 ;; provided by Guix and installed in
13fe4891
FB
134 ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
135 ;; automatically found.
136 (lambda* (#:key inputs outputs #:allow-other-keys)
59d04f63
AK
137 (let* ((out (assoc-ref outputs "out"))
138 (lisp-dir (string-append out "/share/emacs/site-lisp")))
139 (copy-file (assoc-ref inputs "guix-emacs.el")
140 (string-append lisp-dir "/guix-emacs.el"))
13fe4891
FB
141 (with-output-to-file (string-append lisp-dir "/site-start.el")
142 (lambda ()
9bd94544
AK
143 (display
144 (string-append "(when (require 'guix-emacs nil t)\n"
145 " (guix-emacs-autoload-packages))\n"))))
13fe4891 146 #t))))))
468bdabb 147 (inputs
c4c4cc05 148 `(("gnutls" ,gnutls)
468bdabb
LC
149 ("ncurses" ,ncurses)
150
5ce153b1 151 ;; Avoid Emacs's limited movemail substitute that retrieves POP3 email
152 ;; only via insecure channels. This is not needed for (modern) IMAP.
153 ("mailutils" ,mailutils)
154
468bdabb 155 ;; TODO: Add the optional dependencies.
fa275717 156 ("libx11" ,libx11)
0a9e9a63 157 ("gtk+" ,gtk+)
fa275717 158 ("libxft" ,libxft)
50efa797 159 ("libtiff" ,libtiff)
504a83af 160 ("giflib" ,giflib)
71e304ed 161 ("libjpeg" ,libjpeg)
eb737a27 162 ("imagemagick" ,imagemagick)
388fd01b 163 ("acl" ,acl)
50efa797
LC
164
165 ;; When looking for libpng `configure' links with `-lpng -lz', so we
166 ;; must also provide zlib as an input.
167 ("libpng" ,libpng)
f61e0e79 168 ("zlib" ,zlib)
50efa797 169
8ba4dc63 170 ("librsvg" ,librsvg)
fa275717 171 ("libxpm" ,libxpm)
50efa797 172 ("libxml2" ,libxml2)
504a83af
MW
173 ("libice" ,libice)
174 ("libsm" ,libsm)
175 ("alsa-lib" ,alsa-lib)
13fe4891 176 ("dbus" ,dbus)
01c5c21a
AI
177
178 ;; multilingualization support
179 ("libotf" ,libotf)
180 ("m17n-lib" ,m17n-lib)))
c4c4cc05 181 (native-inputs
59d04f63
AK
182 `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
183 ("pkg-config" ,pkg-config)
c4c4cc05 184 ("texinfo" ,texinfo)))
64c98347
LC
185
186 (native-search-paths
187 (list (search-path-specification
215a45d9
MC
188 (variable "EMACSLOADPATH")
189 ;; The versioned entries are for the Emacs' builtin libraries.
190 (files (list (string-append "share/emacs/" version "/site-lisp")
191 (string-append "share/emacs/" version "/lisp")
192 "share/emacs/site-lisp"))
193 (file-pattern ".*")) ;recursively add any sub directory
194 (search-path-specification
64c98347
LC
195 (variable "INFOPATH")
196 (files '("share/info")))))
197
6fd52309 198 (home-page "https://www.gnu.org/software/emacs/")
f50d2669 199 (synopsis "The extensible, customizable, self-documenting text editor")
468bdabb 200 (description
79c311b8
LC
201 "GNU Emacs is an extensible and highly customizable text editor. It is
202based on an Emacs Lisp interpreter with extensions for text editing. Emacs
203has been extended in essentially all areas of computing, giving rise to a
204vast array of packages supporting, e.g., email, IRC and XMPP messaging,
205spreadsheets, remote server editing, and much more. Emacs includes extensive
206documentation on all aspects of the system, from basic editing to writing
207large Lisp programs. It has full Unicode support for nearly all human
208languages.")
f61e0e79 209 (license license:gpl3+)))
4f028c8f 210
b2eaf7ba 211(define-public emacs-minimal
4fd540b7
LC
212 ;; This is the version that you should use as an input to packages that just
213 ;; need to byte-compile .el files.
b2eaf7ba
AK
214 (package (inherit emacs)
215 (name "emacs-minimal")
216 (synopsis "The extensible text editor (used only for byte-compilation)")
217 (build-system gnu-build-system)
218 (arguments
4e941436
LC
219 (substitute-keyword-arguments (package-arguments emacs)
220 ((#:phases phases)
221 `(modify-phases ,phases
222 (delete 'install-site-start)))
223 ((#:configure-flags flags ''())
224 `(list "--with-gnutls=no" "--disable-build-details"))))
b2eaf7ba
AK
225 (inputs
226 `(("ncurses" ,ncurses)))
227 (native-inputs
228 `(("pkg-config" ,pkg-config)))))
229
5bbb04f9
AB
230(define-public emacs-xwidgets
231 (package
232 (inherit emacs)
233 (name "emacs-xwidgets")
234 (synopsis "The extensible, customizable, self-documenting text
235editor (with xwidgets support)")
236 (build-system gnu-build-system)
237 (arguments
4e941436
LC
238 (substitute-keyword-arguments (package-arguments emacs)
239 ((#:configure-flags flags ''())
240 `(cons "--with-xwidgets" ,flags))))
5bbb04f9
AB
241 (inputs
242 `(("webkitgtk" ,webkitgtk)
243 ("libxcomposite" ,libxcomposite)
244 ,@(package-inputs emacs)))))
245
b2eaf7ba 246(define-public emacs-no-x
4fd540b7 247 (package (inherit emacs)
4fd540b7
LC
248 (name "emacs-no-x")
249 (synopsis "The extensible, customizable, self-documenting text
250editor (console only)")
251 (build-system gnu-build-system)
252 (inputs (fold alist-delete
253 (package-inputs emacs)
254 '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
4adde2a9
MW
255 "imagemagick" "libpng" "librsvg" "libxpm" "libice"
256 "libsm"
4fd540b7 257
4adde2a9
MW
258 ;; These depend on libx11, so remove them as well.
259 "libotf" "m17n-lib" "dbus")))))
4fd540b7 260
4a3e602c
TUBK
261(define-public emacs-no-x-toolkit
262 (package (inherit emacs)
263 (name "emacs-no-x-toolkit")
264 (synopsis "The extensible, customizable, self-documenting text
265editor (without an X toolkit)" )
71f57158 266 (build-system gnu-build-system)
388fd01b
MW
267 (inputs (append `(("inotify-tools" ,inotify-tools))
268 (alist-delete "gtk+" (package-inputs emacs))))
f862697b
EF
269 (arguments
270 `(,@(substitute-keyword-arguments (package-arguments emacs)
271 ((#:configure-flags cf)
272 `(cons "--with-x-toolkit=no" ,cf)))))))
4a3e602c 273
f906d30c 274(define-public guile-emacs
ef5fa91c
LF
275 (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")
276 (revision "0"))
277 (package (inherit emacs)
278 (name "guile-emacs")
279 (version (git-version "0.0.0" revision commit))
280 (source (origin
281 (method git-fetch)
282 (uri (git-reference
283 (url "https://git.hcoop.net/git/bpt/emacs.git")
284 (commit commit)))
285 (file-name (git-file-name name version))
286 (patches (search-patches "guile-emacs-fix-configure.patch"))
287 (sha256
288 (base32
289 "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
290 (native-inputs
291 `(("autoconf" ,autoconf)
292 ("automake" ,automake)
293 ("guile" ,guile-for-guile-emacs)
294 ,@(package-native-inputs emacs)))
295 (arguments
296 (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
297 #:parallel-build? #f
298 ;; Tests aren't passing for now.
299 #:tests? #f
300 ,@(package-arguments emacs))
301 ((#:phases phases)
302 `(modify-phases ,phases
303 (add-after 'unpack 'autogen
304 (lambda _
305 (invoke "sh" "autogen.sh")))
306 ;; Build sometimes fails: deps/dispnew.d: No such file or directory
307 (add-before 'build 'make-deps-dir
308 (lambda _
309 (invoke "mkdir" "-p" "src/deps"))))))))))
f906d30c 310
eeb883cb 311(define-public m17n-db
9a4c9715 312 (package
eeb883cb
RW
313 (name "m17n-db")
314 (version "1.8.0")
315 (source
316 (origin
317 (method url-fetch)
318 (uri (string-append "mirror://savannah/m17n/m17n-db-"
319 version ".tar.gz"))
320 (sha256
321 (base32
322 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
9a4c9715 323 (build-system gnu-build-system)
08fc0d68 324 (inputs
eeb883cb 325 `(("gettext" ,gettext-minimal)))
77c9286d 326 (arguments
eeb883cb
RW
327 `(#:configure-flags
328 (list (string-append "--with-charmaps="
329 (assoc-ref %build-inputs "libc")
330 "/share/i18n/charmaps"))))
331 ;; With `guix lint' the home-page URI returns a small page saying
332 ;; that your browser does not handle frames. This triggers the "URI
333 ;; returns suspiciously small file" warning.
334 (home-page "https://www.nongnu.org/m17n/")
335 (synopsis "Multilingual text processing library (database)")
336 (description "The m17n library realizes multilingualization of
337many aspects of applications. The m17n library represents
338multilingual text as an object named M-text. M-text is a string with
339attributes called text properties, and designed to substitute for
340string in C. Text properties carry any information required to input,
341display and edit the text.
c7e553a3 342
eeb883cb
RW
343This package contains the library database.")
344 (license license:lgpl2.1+)))
1095bd1d 345
eeb883cb 346(define-public m17n-lib
2316078a 347 (package
eeb883cb
RW
348 (name "m17n-lib")
349 (version "1.8.0")
2316078a
RW
350 (source
351 (origin
352 (method url-fetch)
eeb883cb
RW
353 (uri (string-append "mirror://savannah/m17n/m17n-lib-"
354 version ".tar.gz"))
2316078a
RW
355 (sha256
356 (base32
eeb883cb 357 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))))
64e43c67 358 (build-system gnu-build-system)
64e43c67 359 (inputs
eeb883cb
RW
360 `(("fribidi" ,fribidi)
361 ("gd" ,gd)
362 ("libotf" ,libotf)
363 ("libxft" ,libxft)
364 ("libxml2" ,libxml2)
365 ("m17n-db" ,m17n-db)))
85777fe5 366 (arguments
eeb883cb
RW
367 `(#:parallel-build? #f))
368 ;; With `guix lint' the home-page URI returns a small page saying
369 ;; that your browser does not handle frames. This triggers the "URI
370 ;; returns suspiciously small file" warning.
371 (home-page "https://www.nongnu.org/m17n/")
372 (synopsis "Multilingual text processing library (runtime)")
373 (description "The m17n library realizes multilingualization of
374many aspects of applications. The m17n library represents
375multilingual text as an object named M-text. M-text is a string with
376attributes called text properties, and designed to substitute for
377string in C. Text properties carry any information required to input,
378display and edit the text.
cf9ce01f 379
eeb883cb
RW
380This package contains the library runtime.")
381 (license license:lgpl2.1+)))