gnu: emacs: Delete the subdirs.el file under the site-lisp directory.
[jackhill/guix/guix.git] / gnu / packages / emacs.scm
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 ;;;
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
36 (define-module (gnu packages emacs)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system glib-or-gtk)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages acl)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages fontutils)
49 #:use-module (gnu packages fribidi)
50 #:use-module (gnu packages gd)
51 #:use-module (gnu packages gettext)
52 #:use-module (gnu packages glib)
53 #:use-module (gnu packages gnome) ; for librsvg
54 #:use-module (gnu packages gtk)
55 #:use-module (gnu packages guile)
56 #:use-module (gnu packages image)
57 #:use-module (gnu packages imagemagick)
58 #:use-module (gnu packages linux) ; alsa-lib
59 #:use-module (gnu packages mail) ; for mailutils
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)
64 #:use-module (gnu packages webkit)
65 #:use-module (gnu packages xml)
66 #:use-module (gnu packages xorg)
67 #:use-module (guix utils)
68 #:use-module (srfi srfi-1))
69
70 (define-public emacs
71 (package
72 (name "emacs")
73 (version "26.3")
74 (source (origin
75 (method url-fetch)
76 (uri (string-append "mirror://gnu/emacs/emacs-"
77 version ".tar.xz"))
78 (sha256
79 (base32
80 "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"))
81 (patches (search-patches "emacs-exec-path.patch"
82 "emacs-fix-scheme-indent-function.patch"
83 "emacs-source-date-epoch.patch"))
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.
94 '("eshell/esh-groups.el")))
95
96 ;; Make sure Tramp looks for binaries in the right places on
97 ;; remote Guix System machines, where 'getconf PATH' returns
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"
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\"")
115 " ")))
116 #t))))
117 (build-system glib-or-gtk-build-system)
118 (arguments
119 `(#:tests? #f ; no check target
120 #:configure-flags (list "--with-modules"
121 "--disable-build-details")
122 #:phases
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")
129 "pwd"))
130 #t))
131 (add-after 'install 'install-site-start
132 ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages
133 ;; provided by Guix and installed in
134 ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
135 ;; automatically found.
136 (lambda* (#:key inputs outputs #:allow-other-keys)
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"))
141 (with-output-to-file (string-append lisp-dir "/site-start.el")
142 (lambda ()
143 (display
144 (string-append "(when (require 'guix-emacs nil t)\n"
145 " (guix-emacs-autoload-packages))\n"))))
146 ;; Remove the extraneous subdirs.el file, as it causes Emacs to
147 ;; add recursively all the the sub-directories of a profile's
148 ;; share/emacs/site-lisp union when added to EMACSLOADPATH,
149 ;; which leads to conflicts.
150 (delete-file (string-append lisp-dir "/subdirs.el"))
151 #t))))))
152 (inputs
153 `(("gnutls" ,gnutls)
154 ("ncurses" ,ncurses)
155
156 ;; Avoid Emacs's limited movemail substitute that retrieves POP3 email
157 ;; only via insecure channels. This is not needed for (modern) IMAP.
158 ("mailutils" ,mailutils)
159
160 ;; TODO: Add the optional dependencies.
161 ("libx11" ,libx11)
162 ("gtk+" ,gtk+)
163 ("libxft" ,libxft)
164 ("libtiff" ,libtiff)
165 ("giflib" ,giflib)
166 ("libjpeg" ,libjpeg)
167 ("imagemagick" ,imagemagick)
168 ("acl" ,acl)
169
170 ;; When looking for libpng `configure' links with `-lpng -lz', so we
171 ;; must also provide zlib as an input.
172 ("libpng" ,libpng)
173 ("zlib" ,zlib)
174
175 ("librsvg" ,librsvg)
176 ("libxpm" ,libxpm)
177 ("libxml2" ,libxml2)
178 ("libice" ,libice)
179 ("libsm" ,libsm)
180 ("alsa-lib" ,alsa-lib)
181 ("dbus" ,dbus)
182
183 ;; multilingualization support
184 ("libotf" ,libotf)
185 ("m17n-lib" ,m17n-lib)))
186 (native-inputs
187 `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
188 ("pkg-config" ,pkg-config)
189 ("texinfo" ,texinfo)))
190
191 (native-search-paths
192 (list (search-path-specification
193 (variable "EMACSLOADPATH")
194 ;; The versioned entry is for the Emacs' builtin libraries.
195 (files (list "share/emacs/site-lisp"
196 (string-append "share/emacs/" version "/lisp"))))
197 (search-path-specification
198 (variable "INFOPATH")
199 (files '("share/info")))))
200
201 (home-page "https://www.gnu.org/software/emacs/")
202 (synopsis "The extensible, customizable, self-documenting text editor")
203 (description
204 "GNU Emacs is an extensible and highly customizable text editor. It is
205 based on an Emacs Lisp interpreter with extensions for text editing. Emacs
206 has been extended in essentially all areas of computing, giving rise to a
207 vast array of packages supporting, e.g., email, IRC and XMPP messaging,
208 spreadsheets, remote server editing, and much more. Emacs includes extensive
209 documentation on all aspects of the system, from basic editing to writing
210 large Lisp programs. It has full Unicode support for nearly all human
211 languages.")
212 (license license:gpl3+)))
213
214 (define-public emacs-minimal
215 ;; This is the version that you should use as an input to packages that just
216 ;; need to byte-compile .el files.
217 (package (inherit emacs)
218 (name "emacs-minimal")
219 (synopsis "The extensible text editor (used only for byte-compilation)")
220 (build-system gnu-build-system)
221 (arguments
222 (substitute-keyword-arguments (package-arguments emacs)
223 ((#:phases phases)
224 `(modify-phases ,phases
225 (delete 'install-site-start)))
226 ((#:configure-flags flags ''())
227 `(list "--with-gnutls=no" "--disable-build-details"))))
228 (inputs
229 `(("ncurses" ,ncurses)))
230 (native-inputs
231 `(("pkg-config" ,pkg-config)))))
232
233 (define-public emacs-xwidgets
234 (package
235 (inherit emacs)
236 (name "emacs-xwidgets")
237 (synopsis "The extensible, customizable, self-documenting text
238 editor (with xwidgets support)")
239 (build-system gnu-build-system)
240 (arguments
241 (substitute-keyword-arguments (package-arguments emacs)
242 ((#:configure-flags flags ''())
243 `(cons "--with-xwidgets" ,flags))))
244 (inputs
245 `(("webkitgtk" ,webkitgtk)
246 ("libxcomposite" ,libxcomposite)
247 ,@(package-inputs emacs)))))
248
249 (define-public emacs-no-x
250 (package (inherit emacs)
251 (name "emacs-no-x")
252 (synopsis "The extensible, customizable, self-documenting text
253 editor (console only)")
254 (build-system gnu-build-system)
255 (inputs (fold alist-delete
256 (package-inputs emacs)
257 '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
258 "imagemagick" "libpng" "librsvg" "libxpm" "libice"
259 "libsm"
260
261 ;; These depend on libx11, so remove them as well.
262 "libotf" "m17n-lib" "dbus")))))
263
264 (define-public emacs-no-x-toolkit
265 (package (inherit emacs)
266 (name "emacs-no-x-toolkit")
267 (synopsis "The extensible, customizable, self-documenting text
268 editor (without an X toolkit)" )
269 (build-system gnu-build-system)
270 (inputs (append `(("inotify-tools" ,inotify-tools))
271 (alist-delete "gtk+" (package-inputs emacs))))
272 (arguments
273 `(,@(substitute-keyword-arguments (package-arguments emacs)
274 ((#:configure-flags cf)
275 `(cons "--with-x-toolkit=no" ,cf)))))))
276
277 (define-public guile-emacs
278 (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")
279 (revision "0"))
280 (package (inherit emacs)
281 (name "guile-emacs")
282 (version (git-version "0.0.0" revision commit))
283 (source (origin
284 (method git-fetch)
285 (uri (git-reference
286 (url "https://git.hcoop.net/git/bpt/emacs.git")
287 (commit commit)))
288 (file-name (git-file-name name version))
289 (patches (search-patches "guile-emacs-fix-configure.patch"))
290 (sha256
291 (base32
292 "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
293 (native-inputs
294 `(("autoconf" ,autoconf)
295 ("automake" ,automake)
296 ("guile" ,guile-for-guile-emacs)
297 ,@(package-native-inputs emacs)))
298 (arguments
299 (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
300 #:parallel-build? #f
301 ;; Tests aren't passing for now.
302 #:tests? #f
303 ,@(package-arguments emacs))
304 ((#:phases phases)
305 `(modify-phases ,phases
306 (add-after 'unpack 'autogen
307 (lambda _
308 (invoke "sh" "autogen.sh")))
309 ;; Build sometimes fails: deps/dispnew.d: No such file or directory
310 (add-before 'build 'make-deps-dir
311 (lambda _
312 (invoke "mkdir" "-p" "src/deps"))))))))))
313
314 (define-public m17n-db
315 (package
316 (name "m17n-db")
317 (version "1.8.0")
318 (source
319 (origin
320 (method url-fetch)
321 (uri (string-append "mirror://savannah/m17n/m17n-db-"
322 version ".tar.gz"))
323 (sha256
324 (base32
325 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
326 (build-system gnu-build-system)
327 (inputs
328 `(("gettext" ,gettext-minimal)))
329 (arguments
330 `(#:configure-flags
331 (list (string-append "--with-charmaps="
332 (assoc-ref %build-inputs "libc")
333 "/share/i18n/charmaps"))))
334 ;; With `guix lint' the home-page URI returns a small page saying
335 ;; that your browser does not handle frames. This triggers the "URI
336 ;; returns suspiciously small file" warning.
337 (home-page "https://www.nongnu.org/m17n/")
338 (synopsis "Multilingual text processing library (database)")
339 (description "The m17n library realizes multilingualization of
340 many aspects of applications. The m17n library represents
341 multilingual text as an object named M-text. M-text is a string with
342 attributes called text properties, and designed to substitute for
343 string in C. Text properties carry any information required to input,
344 display and edit the text.
345
346 This package contains the library database.")
347 (license license:lgpl2.1+)))
348
349 (define-public m17n-lib
350 (package
351 (name "m17n-lib")
352 (version "1.8.0")
353 (source
354 (origin
355 (method url-fetch)
356 (uri (string-append "mirror://savannah/m17n/m17n-lib-"
357 version ".tar.gz"))
358 (sha256
359 (base32
360 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))))
361 (build-system gnu-build-system)
362 (inputs
363 `(("fribidi" ,fribidi)
364 ("gd" ,gd)
365 ("libotf" ,libotf)
366 ("libxft" ,libxft)
367 ("libxml2" ,libxml2)
368 ("m17n-db" ,m17n-db)))
369 (arguments
370 `(#:parallel-build? #f))
371 ;; With `guix lint' the home-page URI returns a small page saying
372 ;; that your browser does not handle frames. This triggers the "URI
373 ;; returns suspiciously small file" warning.
374 (home-page "https://www.nongnu.org/m17n/")
375 (synopsis "Multilingual text processing library (runtime)")
376 (description "The m17n library realizes multilingualization of
377 many aspects of applications. The m17n library represents
378 multilingual text as an object named M-text. M-text is a string with
379 attributes called text properties, and designed to substitute for
380 string in C. Text properties carry any information required to input,
381 display and edit the text.
382
383 This package contains the library runtime.")
384 (license license:lgpl2.1+)))