1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>
5 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org>
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>
10 ;;; Copyright © 2016 ng0 <ng0@n0.is>
11 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
12 ;;; Copyright © 2017, 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
13 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
14 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
15 ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
16 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
17 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
18 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
19 ;;; Copyright © 2019 Jesse John Gildersleve <jessejohngildersleve@zohomail.eu>
20 ;;; Copyright © 2019 Valentin Ignatev <valentignatev@gmail.com>
21 ;;; Copyright © 2019 Leo Prikler <leo.prikler@student.tugraz.at>
22 ;;; Copyright © 2019 Amin Bandali <mab@gnu.org>
24 ;;; This file is part of GNU Guix.
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.
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.
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/>.
39 (define-module (gnu packages emacs)
40 #:use-module ((guix licenses) #:prefix license:)
41 #:use-module (guix packages)
42 #:use-module (guix download)
43 #:use-module (guix git-download)
44 #:use-module (guix build-system gnu)
45 #:use-module (guix build-system glib-or-gtk)
46 #:use-module (gnu packages)
47 #:use-module (gnu packages acl)
48 #:use-module (gnu packages autotools)
49 #:use-module (gnu packages base)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages fontutils)
52 #:use-module (gnu packages fribidi)
53 #:use-module (gnu packages gd)
54 #:use-module (gnu packages gettext)
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages gnome) ; for librsvg
57 #:use-module (gnu packages gtk)
58 #:use-module (gnu packages guile)
59 #:use-module (gnu packages image)
60 #:use-module (gnu packages imagemagick)
61 #:use-module (gnu packages linux) ; alsa-lib
62 #:use-module (gnu packages mail) ; for mailutils
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)
67 #:use-module (gnu packages web) ; for jansson
68 #:use-module (gnu packages webkit)
69 #:use-module (gnu packages xml)
70 #:use-module (gnu packages xorg)
71 #:use-module (guix utils)
72 #:use-module (srfi srfi-1))
80 (uri (string-append "mirror://gnu/emacs/emacs-"
84 "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"))
85 (patches (search-patches "emacs-exec-path.patch"
86 "emacs-fix-scheme-indent-function.patch"
87 "emacs-source-date-epoch.patch"))
88 (modules '((guix build utils)))
90 '(with-directory-excursion "lisp"
91 ;; Delete the bundled byte-compiled elisp files and generated
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.
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.
104 '("eshell/esh-groups.el")))
106 ;; Make sure Tramp looks for binaries in the right places on
107 ;; remote Guix System machines, where 'getconf PATH' returns
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"
115 "/run/current-system/profile/sbin")))
117 ;; Make sure Man looks for C header files in the right
119 (substitute* "man.el"
120 (("\"/usr/local/include\"" line)
123 "\"~/.guix-profile/include\""
124 "\"/var/guix/profiles/system/profile/include\"")
127 (build-system glib-or-gtk-build-system)
129 `(#:tests? #f ; no check target
130 #:configure-flags (list "--with-modules"
131 "--disable-build-details")
133 (modify-phases %standard-phases
134 (add-before 'configure 'fix-/bin/pwd
136 ;; Use `pwd', not `/bin/pwd'.
137 (substitute* (find-files "." "^Makefile\\.in$")
141 (add-after 'install 'install-site-start
142 ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages
143 ;; provided by Guix and installed in
144 ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
145 ;; automatically found.
146 (lambda* (#:key inputs outputs #:allow-other-keys)
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"))
151 (with-output-to-file (string-append lisp-dir "/site-start.el")
154 (string-append "(when (require 'guix-emacs nil t)\n"
155 " (guix-emacs-autoload-packages))\n"))))
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"))
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)
170 ;; TODO: Add the optional dependencies.
177 ("imagemagick" ,imagemagick)
180 ;; When looking for libpng `configure' links with `-lpng -lz', so we
181 ;; must also provide zlib as an input.
190 ("alsa-lib" ,alsa-lib)
193 ;; multilingualization support
195 ("m17n-lib" ,m17n-lib)))
197 `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
198 ("pkg-config" ,pkg-config)
199 ("texinfo" ,texinfo)))
202 (list (search-path-specification
203 (variable "EMACSLOADPATH")
204 ;; The versioned entry is for the Emacs' builtin libraries.
205 (files (list "share/emacs/site-lisp"
206 (string-append "share/emacs/" version "/lisp"))))
207 (search-path-specification
208 (variable "INFOPATH")
209 (files '("share/info")))))
211 (home-page "https://www.gnu.org/software/emacs/")
212 (synopsis "The extensible, customizable, self-documenting text editor")
214 "GNU Emacs is an extensible and highly customizable text editor. It is
215 based on an Emacs Lisp interpreter with extensions for text editing. Emacs
216 has been extended in essentially all areas of computing, giving rise to a
217 vast array of packages supporting, e.g., email, IRC and XMPP messaging,
218 spreadsheets, remote server editing, and much more. Emacs includes extensive
219 documentation on all aspects of the system, from basic editing to writing
220 large Lisp programs. It has full Unicode support for nearly all human
222 (license license:gpl3+)))
224 (define-public emacs-next
225 (let ((commit "36abf6864604b3061c2e070f8997491fa2bce44c")
227 (emacs-version "27.0.50"))
231 (version (git-version emacs-version revision commit))
236 (url "https://git.savannah.gnu.org/git/emacs.git")
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))))).
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
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")))
261 ;; Make sure Man looks for C header files in the right
263 (substitute* "man.el"
264 (("\"/usr/local/include\"" line)
267 "\"~/.guix-profile/include\""
268 "\"/var/guix/profiles/system/profile/include\"")
272 (substitute-keyword-arguments (package-arguments emacs)
274 `(modify-phases ,phases
275 ;; The 'reset-gzip-timestamps phase will throw a
276 ;; permission error if gzip files aren't writable then
278 'reset-gzip-timestamps
279 'make-compressed-files-writable
281 (for-each make-file-writable
282 (find-files %output ".*\\.t?gz$"))
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")
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))
300 `(("jansson" ,jansson)
301 ,@(package-inputs emacs)))
303 `(("autoconf" ,autoconf) ; needed when building from trunk
304 ,@(package-native-inputs emacs)))
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.
310 (list (search-path-specification
311 (variable "EMACSLOADPATH")
312 ;; The versioned entry is for the Emacs' builtin libraries.
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"))))))))
320 (define-public emacs-minimal
321 ;; This is the version that you should use as an input to packages that just
322 ;; need to byte-compile .el files.
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)
328 (substitute-keyword-arguments (package-arguments emacs)
330 `(modify-phases ,phases
331 (delete 'install-site-start)))
332 ((#:configure-flags flags ''())
333 `(list "--with-gnutls=no" "--disable-build-details"))))
335 `(("ncurses" ,ncurses)))
337 `(("pkg-config" ,pkg-config)))))
339 (define-public emacs-xwidgets
342 (name "emacs-xwidgets")
343 (synopsis "The extensible, customizable, self-documenting text
344 editor (with xwidgets support)")
345 (build-system gnu-build-system)
347 (substitute-keyword-arguments (package-arguments emacs)
348 ((#:configure-flags flags ''())
349 `(cons "--with-xwidgets" ,flags))))
351 `(("webkitgtk" ,webkitgtk)
352 ("libxcomposite" ,libxcomposite)
353 ,@(package-inputs emacs)))))
355 (define-public emacs-no-x
356 (package (inherit emacs)
358 (synopsis "The extensible, customizable, self-documenting text
359 editor (console only)")
360 (build-system gnu-build-system)
361 (inputs (fold alist-delete
362 (package-inputs emacs)
363 '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
364 "imagemagick" "libpng" "librsvg" "libxpm" "libice"
367 ;; These depend on libx11, so remove them as well.
368 "libotf" "m17n-lib" "dbus")))))
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
374 editor (without an X toolkit)" )
375 (build-system gnu-build-system)
376 (inputs (append `(("inotify-tools" ,inotify-tools))
377 (alist-delete "gtk+" (package-inputs emacs))))
379 `(,@(substitute-keyword-arguments (package-arguments emacs)
380 ((#:configure-flags cf)
381 `(cons "--with-x-toolkit=no" ,cf)))))))
383 (define-public guile-emacs
384 (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")
386 (package (inherit emacs)
388 (version (git-version "0.0.0" revision commit))
392 (url "https://git.hcoop.net/git/bpt/emacs.git")
394 (file-name (git-file-name name version))
395 (patches (search-patches "guile-emacs-fix-configure.patch"))
398 "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
400 `(("autoconf" ,autoconf)
401 ("automake" ,automake)
402 ("guile" ,guile-for-guile-emacs)
403 ,@(package-native-inputs emacs)))
405 (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
407 ;; Tests aren't passing for now.
409 ,@(package-arguments emacs))
411 `(modify-phases ,phases
412 (add-after 'unpack 'autogen
414 (invoke "sh" "autogen.sh")))
415 ;; Build sometimes fails: deps/dispnew.d: No such file or directory
416 (add-before 'build 'make-deps-dir
418 (invoke "mkdir" "-p" "src/deps"))))))))))
420 (define-public m17n-db
427 (uri (string-append "mirror://savannah/m17n/m17n-db-"
431 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
432 (build-system gnu-build-system)
434 `(("gettext" ,gettext-minimal)))
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
446 many aspects of applications. The m17n library represents
447 multilingual text as an object named M-text. M-text is a string with
448 attributes called text properties, and designed to substitute for
449 string in C. Text properties carry any information required to input,
450 display and edit the text.
452 This package contains the library database.")
453 (license license:lgpl2.1+)))
455 (define-public m17n-lib
462 (uri (string-append "mirror://savannah/m17n/m17n-lib-"
466 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))))
467 (build-system gnu-build-system)
469 `(("fribidi" ,fribidi)
474 ("m17n-db" ,m17n-db)))
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
483 many aspects of applications. The m17n library represents
484 multilingual text as an object named M-text. M-text is a string with
485 attributes called text properties, and designed to substitute for
486 string in C. Text properties carry any information required to input,
487 display and edit the text.
489 This package contains the library runtime.")
490 (license license:lgpl2.1+)))