gnu: deutex: Update to 5.2.1.
[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>
92d2205a
AB
20;;; Copyright © 2019 Valentin Ignatev <valentignatev@gmail.com>
21;;; Copyright © 2019 Leo Prikler <leo.prikler@student.tugraz.at>
22;;; Copyright © 2019 Amin Bandali <bandali@gnu.org>
468bdabb
LC
23;;;
24;;; This file is part of GNU Guix.
25;;;
26;;; GNU Guix is free software; you can redistribute it and/or modify it
27;;; under the terms of the GNU General Public License as published by
28;;; the Free Software Foundation; either version 3 of the License, or (at
29;;; your option) any later version.
30;;;
31;;; GNU Guix is distributed in the hope that it will be useful, but
32;;; WITHOUT ANY WARRANTY; without even the implied warranty of
33;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34;;; GNU General Public License for more details.
35;;;
36;;; You should have received a copy of the GNU General Public License
37;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38
1ffa7090 39(define-module (gnu packages emacs)
f61e0e79 40 #:use-module ((guix licenses) #:prefix license:)
468bdabb
LC
41 #:use-module (guix packages)
42 #:use-module (guix download)
f906d30c 43 #:use-module (guix git-download)
468bdabb 44 #:use-module (guix build-system gnu)
71f57158 45 #:use-module (guix build-system glib-or-gtk)
59a43334 46 #:use-module (gnu packages)
eeb883cb 47 #:use-module (gnu packages acl)
18d26210 48 #:use-module (gnu packages autotools)
be379ee7 49 #:use-module (gnu packages base)
f61e0e79 50 #:use-module (gnu packages compression)
eeb883cb 51 #:use-module (gnu packages fontutils)
a80b60f4
AI
52 #:use-module (gnu packages fribidi)
53 #:use-module (gnu packages gd)
eeb883cb
RW
54 #:use-module (gnu packages gettext)
55 #:use-module (gnu packages glib)
5ce153b1 56 #:use-module (gnu packages gnome) ; for librsvg
eeb883cb
RW
57 #:use-module (gnu packages gtk)
58 #:use-module (gnu packages guile)
59 #:use-module (gnu packages image)
60 #:use-module (gnu packages imagemagick)
5ce153b1 61 #:use-module (gnu packages linux) ; alsa-lib
62 #:use-module (gnu packages mail) ; for mailutils
eeb883cb
RW
63 #:use-module (gnu packages ncurses)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages texinfo)
66 #:use-module (gnu packages tls)
92d2205a 67 #:use-module (gnu packages web) ; for jansson
5bbb04f9 68 #:use-module (gnu packages webkit)
eeb883cb
RW
69 #:use-module (gnu packages xml)
70 #:use-module (gnu packages xorg)
4a3e602c 71 #:use-module (guix utils)
eeb883cb 72 #:use-module (srfi srfi-1))
468bdabb
LC
73
74(define-public emacs
75 (package
76 (name "emacs")
7ab5c4e0 77 (version "26.3")
468bdabb
LC
78 (source (origin
79 (method url-fetch)
80 (uri (string-append "mirror://gnu/emacs/emacs-"
3be9f724 81 version ".tar.xz"))
468bdabb
LC
82 (sha256
83 (base32
7ab5c4e0 84 "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"))
fc1adab1 85 (patches (search-patches "emacs-exec-path.patch"
4509ec72 86 "emacs-fix-scheme-indent-function.patch"
0cdb6ab4 87 "emacs-source-date-epoch.patch"))
486f36eb
AK
88 (modules '((guix build utils)))
89 (snippet
486f36eb 90 '(with-directory-excursion "lisp"
92d2205a
AB
91 ;; Delete the bundled byte-compiled elisp files and generated
92 ;; autoloads.
486f36eb
AK
93 (for-each delete-file
94 (append (find-files "." "\\.elc$")
95 (find-files "." "loaddefs\\.el$")
96 ;; This is the only "autoloads" file that
97 ;; does not have "*loaddefs.el" name.
92d2205a
AB
98 ;; TODO: Next time changing this package,
99 ;; replace the following with a call to
100 ;; `find-files', so that `delete-file'
101 ;; wouldn't error out when the file is
102 ;; missing, making the entire snippet field
103 ;; reusable as-is for `emacs-next' below.
dc701091
LC
104 '("eshell/esh-groups.el")))
105
106 ;; Make sure Tramp looks for binaries in the right places on
59e80445 107 ;; remote Guix System machines, where 'getconf PATH' returns
dc701091
LC
108 ;; something bogus.
109 (substitute* "net/tramp-sh.el"
110 ;; Patch the line after "(defcustom tramp-remote-path".
111 (("\\(tramp-default-remote-path")
112 (format #f "(tramp-default-remote-path ~s ~s ~s ~s "
113 "~/.guix-profile/bin" "~/.guix-profile/sbin"
114 "/run/current-system/profile/bin"
d1c11418
OP
115 "/run/current-system/profile/sbin")))
116
117 ;; Make sure Man looks for C header files in the right
118 ;; places.
119 (substitute* "man.el"
120 (("\"/usr/local/include\"" line)
121 (string-join
122 (list line
123 "\"~/.guix-profile/include\""
124 "\"/var/guix/profiles/system/profile/include\"")
6cbee49d
MW
125 " ")))
126 #t))))
71f57158 127 (build-system glib-or-gtk-build-system)
468bdabb 128 (arguments
7ab5c4e0 129 `(#:tests? #f ; no check target
494978c4 130 #:configure-flags (list "--with-modules"
131 "--disable-build-details")
2206c7ad 132 #:phases
13fe4891
FB
133 (modify-phases %standard-phases
134 (add-before 'configure 'fix-/bin/pwd
135 (lambda _
136 ;; Use `pwd', not `/bin/pwd'.
137 (substitute* (find-files "." "^Makefile\\.in$")
138 (("/bin/pwd")
e2d90ee4
MW
139 "pwd"))
140 #t))
13fe4891 141 (add-after 'install 'install-site-start
59d04f63
AK
142 ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages
143 ;; provided by Guix and installed in
13fe4891
FB
144 ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
145 ;; automatically found.
146 (lambda* (#:key inputs outputs #:allow-other-keys)
59d04f63
AK
147 (let* ((out (assoc-ref outputs "out"))
148 (lisp-dir (string-append out "/share/emacs/site-lisp")))
149 (copy-file (assoc-ref inputs "guix-emacs.el")
150 (string-append lisp-dir "/guix-emacs.el"))
13fe4891
FB
151 (with-output-to-file (string-append lisp-dir "/site-start.el")
152 (lambda ()
9bd94544
AK
153 (display
154 (string-append "(when (require 'guix-emacs nil t)\n"
155 " (guix-emacs-autoload-packages))\n"))))
a7a49289
MC
156 ;; Remove the extraneous subdirs.el file, as it causes Emacs to
157 ;; add recursively all the the sub-directories of a profile's
158 ;; share/emacs/site-lisp union when added to EMACSLOADPATH,
159 ;; which leads to conflicts.
160 (delete-file (string-append lisp-dir "/subdirs.el"))
13fe4891 161 #t))))))
468bdabb 162 (inputs
c4c4cc05 163 `(("gnutls" ,gnutls)
468bdabb
LC
164 ("ncurses" ,ncurses)
165
5ce153b1 166 ;; Avoid Emacs's limited movemail substitute that retrieves POP3 email
167 ;; only via insecure channels. This is not needed for (modern) IMAP.
168 ("mailutils" ,mailutils)
169
468bdabb 170 ;; TODO: Add the optional dependencies.
fa275717 171 ("libx11" ,libx11)
0a9e9a63 172 ("gtk+" ,gtk+)
fa275717 173 ("libxft" ,libxft)
50efa797 174 ("libtiff" ,libtiff)
504a83af 175 ("giflib" ,giflib)
71e304ed 176 ("libjpeg" ,libjpeg)
eb737a27 177 ("imagemagick" ,imagemagick)
388fd01b 178 ("acl" ,acl)
50efa797
LC
179
180 ;; When looking for libpng `configure' links with `-lpng -lz', so we
181 ;; must also provide zlib as an input.
182 ("libpng" ,libpng)
f61e0e79 183 ("zlib" ,zlib)
50efa797 184
8ba4dc63 185 ("librsvg" ,librsvg)
fa275717 186 ("libxpm" ,libxpm)
50efa797 187 ("libxml2" ,libxml2)
504a83af
MW
188 ("libice" ,libice)
189 ("libsm" ,libsm)
190 ("alsa-lib" ,alsa-lib)
13fe4891 191 ("dbus" ,dbus)
01c5c21a
AI
192
193 ;; multilingualization support
194 ("libotf" ,libotf)
195 ("m17n-lib" ,m17n-lib)))
c4c4cc05 196 (native-inputs
59d04f63
AK
197 `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
198 ("pkg-config" ,pkg-config)
c4c4cc05 199 ("texinfo" ,texinfo)))
64c98347
LC
200
201 (native-search-paths
202 (list (search-path-specification
215a45d9 203 (variable "EMACSLOADPATH")
9aca5cea 204 ;; The versioned entry is for the Emacs' builtin libraries.
3ffdd002
MC
205 (files (list "share/emacs/site-lisp"
206 (string-append "share/emacs/" version "/lisp"))))
215a45d9 207 (search-path-specification
64c98347
LC
208 (variable "INFOPATH")
209 (files '("share/info")))))
210
6fd52309 211 (home-page "https://www.gnu.org/software/emacs/")
f50d2669 212 (synopsis "The extensible, customizable, self-documenting text editor")
468bdabb 213 (description
79c311b8
LC
214 "GNU Emacs is an extensible and highly customizable text editor. It is
215based on an Emacs Lisp interpreter with extensions for text editing. Emacs
216has been extended in essentially all areas of computing, giving rise to a
217vast array of packages supporting, e.g., email, IRC and XMPP messaging,
218spreadsheets, remote server editing, and much more. Emacs includes extensive
219documentation on all aspects of the system, from basic editing to writing
220large Lisp programs. It has full Unicode support for nearly all human
221languages.")
f61e0e79 222 (license license:gpl3+)))
4f028c8f 223
92d2205a
AB
224(define-public emacs-next
225 (let ((commit "36abf6864604b3061c2e070f8997491fa2bce44c")
226 (revision "0")
227 (emacs-version "27.0.50"))
228 (package
229 (inherit emacs)
230 (name "emacs-next")
231 (version (git-version emacs-version revision commit))
232 (source
233 (origin
234 (method git-fetch)
235 (uri (git-reference
236 (url "https://git.savannah.gnu.org/git/emacs.git")
237 (commit commit)))
238 (sha256
239 (base32 "1ckn607p0clz0dhhlizvv7l03p4nminy48h53xrpz55w4rcrcm2l"))
240 (file-name (git-file-name name version))
241 (patches (search-patches "emacs27-exec-path.patch"
242 "emacs-fix-scheme-indent-function.patch"
243 "emacs-source-date-epoch.patch"))
244 (modules (origin-modules (package-source emacs)))
245 ;; TODO: once the snippet for `emacs' is changed to not fail when
246 ;; eshell/esh-groups.el does not exist, replace this snippet with
247 ;; (snippet (origin-snippet (package-source emacs))))).
248 (snippet
249 '(with-directory-excursion "lisp"
250 ;; Make sure Tramp looks for binaries in the right places on
251 ;; remote Guix System machines, where 'getconf PATH' returns
252 ;; something bogus.
253 (substitute* "net/tramp-sh.el"
254 ;; Patch the line after "(defcustom tramp-remote-path".
255 (("\\(tramp-default-remote-path")
256 (format #f "(tramp-default-remote-path ~s ~s ~s ~s "
257 "~/.guix-profile/bin" "~/.guix-profile/sbin"
258 "/run/current-system/profile/bin"
259 "/run/current-system/profile/sbin")))
260
261 ;; Make sure Man looks for C header files in the right
262 ;; places.
263 (substitute* "man.el"
264 (("\"/usr/local/include\"" line)
265 (string-join
266 (list line
267 "\"~/.guix-profile/include\""
268 "\"/var/guix/profiles/system/profile/include\"")
269 " ")))
270 #t))))
271 (arguments
272 (substitute-keyword-arguments (package-arguments emacs)
273 ((#:phases phases)
274 `(modify-phases ,phases
275 ;; The 'reset-gzip-timestamps phase will throw a
276 ;; permission error if gzip files aren't writable then
277 (add-before
278 'reset-gzip-timestamps
279 'make-compressed-files-writable
280 (lambda _
281 (for-each make-file-writable
282 (find-files %output ".*\\.t?gz$"))
283 #t))
284 ;; restore the dump file that Emacs installs somewhere in
285 ;; libexec/ to its original state
286 (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp
287 (lambda* (#:key outputs target #:allow-other-keys)
288 (let* ((libexec (string-append (assoc-ref outputs "out")
289 "/libexec"))
290 ;; each of these find-files should return one file
291 (pdmp (find-files libexec "^emacs\\.pdmp$"))
292 (pdmp-real (find-files libexec
293 "^\\.emacs\\.pdmp-real$")))
294 (for-each (lambda (wrapper real)
295 (delete-file wrapper)
296 (rename-file real wrapper))
297 pdmp pdmp-real)
298 #t)))))))
299 (inputs
300 `(("jansson" ,jansson)
301 ,@(package-inputs emacs)))
302 (native-inputs
303 `(("autoconf" ,autoconf) ; needed when building from trunk
304 ,@(package-native-inputs emacs)))
305
306 ;; TODO: consider changing `emacs' to use a more robust way of
307 ;; specifying version for "EMACSLOADPATH", so as to avoid having to
308 ;; duplicate native-search-paths here.
309 (native-search-paths
310 (list (search-path-specification
311 (variable "EMACSLOADPATH")
312 ;; The versioned entry is for the Emacs' builtin libraries.
313 (files
314 (list "share/emacs/site-lisp"
315 (string-append "share/emacs/" emacs-version "/lisp"))))
316 (search-path-specification
317 (variable "INFOPATH")
318 (files '("share/info"))))))))
319
b2eaf7ba 320(define-public emacs-minimal
4fd540b7
LC
321 ;; This is the version that you should use as an input to packages that just
322 ;; need to byte-compile .el files.
b2eaf7ba
AK
323 (package (inherit emacs)
324 (name "emacs-minimal")
325 (synopsis "The extensible text editor (used only for byte-compilation)")
326 (build-system gnu-build-system)
327 (arguments
4e941436
LC
328 (substitute-keyword-arguments (package-arguments emacs)
329 ((#:phases phases)
330 `(modify-phases ,phases
331 (delete 'install-site-start)))
332 ((#:configure-flags flags ''())
333 `(list "--with-gnutls=no" "--disable-build-details"))))
b2eaf7ba
AK
334 (inputs
335 `(("ncurses" ,ncurses)))
336 (native-inputs
337 `(("pkg-config" ,pkg-config)))))
338
5bbb04f9
AB
339(define-public emacs-xwidgets
340 (package
341 (inherit emacs)
342 (name "emacs-xwidgets")
343 (synopsis "The extensible, customizable, self-documenting text
344editor (with xwidgets support)")
345 (build-system gnu-build-system)
346 (arguments
4e941436
LC
347 (substitute-keyword-arguments (package-arguments emacs)
348 ((#:configure-flags flags ''())
349 `(cons "--with-xwidgets" ,flags))))
5bbb04f9
AB
350 (inputs
351 `(("webkitgtk" ,webkitgtk)
352 ("libxcomposite" ,libxcomposite)
353 ,@(package-inputs emacs)))))
354
b2eaf7ba 355(define-public emacs-no-x
4fd540b7 356 (package (inherit emacs)
4fd540b7
LC
357 (name "emacs-no-x")
358 (synopsis "The extensible, customizable, self-documenting text
359editor (console only)")
360 (build-system gnu-build-system)
361 (inputs (fold alist-delete
362 (package-inputs emacs)
363 '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
4adde2a9
MW
364 "imagemagick" "libpng" "librsvg" "libxpm" "libice"
365 "libsm"
4fd540b7 366
4adde2a9
MW
367 ;; These depend on libx11, so remove them as well.
368 "libotf" "m17n-lib" "dbus")))))
4fd540b7 369
4a3e602c
TUBK
370(define-public emacs-no-x-toolkit
371 (package (inherit emacs)
372 (name "emacs-no-x-toolkit")
373 (synopsis "The extensible, customizable, self-documenting text
374editor (without an X toolkit)" )
71f57158 375 (build-system gnu-build-system)
388fd01b
MW
376 (inputs (append `(("inotify-tools" ,inotify-tools))
377 (alist-delete "gtk+" (package-inputs emacs))))
f862697b
EF
378 (arguments
379 `(,@(substitute-keyword-arguments (package-arguments emacs)
380 ((#:configure-flags cf)
381 `(cons "--with-x-toolkit=no" ,cf)))))))
4a3e602c 382
f906d30c 383(define-public guile-emacs
ef5fa91c
LF
384 (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")
385 (revision "0"))
386 (package (inherit emacs)
387 (name "guile-emacs")
388 (version (git-version "0.0.0" revision commit))
389 (source (origin
390 (method git-fetch)
391 (uri (git-reference
392 (url "https://git.hcoop.net/git/bpt/emacs.git")
393 (commit commit)))
394 (file-name (git-file-name name version))
395 (patches (search-patches "guile-emacs-fix-configure.patch"))
396 (sha256
397 (base32
398 "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
399 (native-inputs
400 `(("autoconf" ,autoconf)
401 ("automake" ,automake)
402 ("guile" ,guile-for-guile-emacs)
403 ,@(package-native-inputs emacs)))
404 (arguments
405 (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
406 #:parallel-build? #f
407 ;; Tests aren't passing for now.
408 #:tests? #f
409 ,@(package-arguments emacs))
410 ((#:phases phases)
411 `(modify-phases ,phases
412 (add-after 'unpack 'autogen
413 (lambda _
414 (invoke "sh" "autogen.sh")))
415 ;; Build sometimes fails: deps/dispnew.d: No such file or directory
416 (add-before 'build 'make-deps-dir
417 (lambda _
418 (invoke "mkdir" "-p" "src/deps"))))))))))
f906d30c 419
eeb883cb 420(define-public m17n-db
9a4c9715 421 (package
eeb883cb
RW
422 (name "m17n-db")
423 (version "1.8.0")
424 (source
425 (origin
426 (method url-fetch)
427 (uri (string-append "mirror://savannah/m17n/m17n-db-"
428 version ".tar.gz"))
429 (sha256
430 (base32
431 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
9a4c9715 432 (build-system gnu-build-system)
08fc0d68 433 (inputs
eeb883cb 434 `(("gettext" ,gettext-minimal)))
77c9286d 435 (arguments
eeb883cb
RW
436 `(#:configure-flags
437 (list (string-append "--with-charmaps="
438 (assoc-ref %build-inputs "libc")
439 "/share/i18n/charmaps"))))
440 ;; With `guix lint' the home-page URI returns a small page saying
441 ;; that your browser does not handle frames. This triggers the "URI
442 ;; returns suspiciously small file" warning.
443 (home-page "https://www.nongnu.org/m17n/")
444 (synopsis "Multilingual text processing library (database)")
445 (description "The m17n library realizes multilingualization of
446many aspects of applications. The m17n library represents
447multilingual text as an object named M-text. M-text is a string with
448attributes called text properties, and designed to substitute for
449string in C. Text properties carry any information required to input,
450display and edit the text.
c7e553a3 451
eeb883cb
RW
452This package contains the library database.")
453 (license license:lgpl2.1+)))
1095bd1d 454
eeb883cb 455(define-public m17n-lib
2316078a 456 (package
eeb883cb
RW
457 (name "m17n-lib")
458 (version "1.8.0")
2316078a
RW
459 (source
460 (origin
461 (method url-fetch)
eeb883cb
RW
462 (uri (string-append "mirror://savannah/m17n/m17n-lib-"
463 version ".tar.gz"))
2316078a
RW
464 (sha256
465 (base32
eeb883cb 466 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))))
64e43c67 467 (build-system gnu-build-system)
64e43c67 468 (inputs
eeb883cb
RW
469 `(("fribidi" ,fribidi)
470 ("gd" ,gd)
471 ("libotf" ,libotf)
472 ("libxft" ,libxft)
473 ("libxml2" ,libxml2)
474 ("m17n-db" ,m17n-db)))
85777fe5 475 (arguments
eeb883cb
RW
476 `(#:parallel-build? #f))
477 ;; With `guix lint' the home-page URI returns a small page saying
478 ;; that your browser does not handle frames. This triggers the "URI
479 ;; returns suspiciously small file" warning.
480 (home-page "https://www.nongnu.org/m17n/")
481 (synopsis "Multilingual text processing library (runtime)")
482 (description "The m17n library realizes multilingualization of
483many aspects of applications. The m17n library represents
484multilingual text as an object named M-text. M-text is a string with
485attributes called text properties, and designed to substitute for
486string in C. Text properties carry any information required to input,
487display and edit the text.
cf9ce01f 488
eeb883cb
RW
489This package contains the library runtime.")
490 (license license:lgpl2.1+)))