Merge branch 'staging' into core-updates
[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 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 Tobias Geerinckx-Rice <me@tobias.gr>
19 ;;;
20 ;;; This file is part of GNU Guix.
21 ;;;
22 ;;; GNU Guix is free software; you can redistribute it and/or modify it
23 ;;; under the terms of the GNU General Public License as published by
24 ;;; the Free Software Foundation; either version 3 of the License, or (at
25 ;;; your option) any later version.
26 ;;;
27 ;;; GNU Guix is distributed in the hope that it will be useful, but
28 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 ;;; GNU General Public License for more details.
31 ;;;
32 ;;; You should have received a copy of the GNU General Public License
33 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34
35 (define-module (gnu packages emacs)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix packages)
38 #:use-module (guix download)
39 #:use-module (guix git-download)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system glib-or-gtk)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages acl)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages base)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages fontutils)
48 #:use-module (gnu packages fribidi)
49 #:use-module (gnu packages gd)
50 #:use-module (gnu packages gettext)
51 #:use-module (gnu packages glib)
52 #:use-module (gnu packages gnome) ; for librsvg
53 #:use-module (gnu packages gtk)
54 #:use-module (gnu packages guile)
55 #:use-module (gnu packages image)
56 #:use-module (gnu packages imagemagick)
57 #:use-module (gnu packages linux) ; alsa-lib
58 #:use-module (gnu packages ncurses)
59 #:use-module (gnu packages pkg-config)
60 #:use-module (gnu packages texinfo)
61 #:use-module (gnu packages tls)
62 #:use-module (gnu packages webkit)
63 #:use-module (gnu packages xml)
64 #:use-module (gnu packages xorg)
65 #:use-module (guix utils)
66 #:use-module (srfi srfi-1))
67
68 (define-public emacs
69 (package
70 (name "emacs")
71 (version "26.2")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "mirror://gnu/emacs/emacs-"
75 version ".tar.xz"))
76 (sha256
77 (base32
78 "13n5m60i47k96mpv5pp6km2ph9rv2m5lmbpzj929v02vpsfyc70m"))
79 (patches (search-patches "emacs-exec-path.patch"
80 "emacs-fix-scheme-indent-function.patch"
81 "emacs-source-date-epoch.patch"))
82 (modules '((guix build utils)))
83 (snippet
84 ;; Delete the bundled byte-compiled elisp files and
85 ;; generated autoloads.
86 '(with-directory-excursion "lisp"
87 (for-each delete-file
88 (append (find-files "." "\\.elc$")
89 (find-files "." "loaddefs\\.el$")
90 ;; This is the only "autoloads" file that
91 ;; does not have "*loaddefs.el" name.
92 '("eshell/esh-groups.el")))
93
94 ;; Make sure Tramp looks for binaries in the right places on
95 ;; remote Guix System machines, where 'getconf PATH' returns
96 ;; something bogus.
97 (substitute* "net/tramp-sh.el"
98 ;; Patch the line after "(defcustom tramp-remote-path".
99 (("\\(tramp-default-remote-path")
100 (format #f "(tramp-default-remote-path ~s ~s ~s ~s "
101 "~/.guix-profile/bin" "~/.guix-profile/sbin"
102 "/run/current-system/profile/bin"
103 "/run/current-system/profile/sbin")))
104
105 ;; Make sure Man looks for C header files in the right
106 ;; places.
107 (substitute* "man.el"
108 (("\"/usr/local/include\"" line)
109 (string-join
110 (list line
111 "\"~/.guix-profile/include\""
112 "\"/var/guix/profiles/system/profile/include\"")
113 " ")))
114 #t))))
115 (build-system glib-or-gtk-build-system)
116 (arguments
117 `(#:tests? #f ; no check target
118 #:configure-flags (list "--with-modules"
119 "--disable-build-details")
120 #:phases
121 (modify-phases %standard-phases
122 (add-before 'configure 'fix-/bin/pwd
123 (lambda _
124 ;; Use `pwd', not `/bin/pwd'.
125 (substitute* (find-files "." "^Makefile\\.in$")
126 (("/bin/pwd")
127 "pwd"))
128 #t))
129 (add-after 'install 'install-site-start
130 ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages
131 ;; provided by Guix and installed in
132 ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
133 ;; automatically found.
134 (lambda* (#:key inputs outputs #:allow-other-keys)
135 (let* ((out (assoc-ref outputs "out"))
136 (lisp-dir (string-append out "/share/emacs/site-lisp")))
137 (copy-file (assoc-ref inputs "guix-emacs.el")
138 (string-append lisp-dir "/guix-emacs.el"))
139 (with-output-to-file (string-append lisp-dir "/site-start.el")
140 (lambda ()
141 (display
142 (string-append "(when (require 'guix-emacs nil t)\n"
143 " (guix-emacs-autoload-packages))\n"))))
144 #t))))))
145 (inputs
146 `(("gnutls" ,gnutls)
147 ("ncurses" ,ncurses)
148
149 ;; TODO: Add the optional dependencies.
150 ("libx11" ,libx11)
151 ("gtk+" ,gtk+)
152 ("libxft" ,libxft)
153 ("libtiff" ,libtiff)
154 ("giflib" ,giflib)
155 ("libjpeg" ,libjpeg)
156 ("imagemagick" ,imagemagick)
157 ("acl" ,acl)
158
159 ;; When looking for libpng `configure' links with `-lpng -lz', so we
160 ;; must also provide zlib as an input.
161 ("libpng" ,libpng)
162 ("zlib" ,zlib)
163
164 ("librsvg" ,librsvg)
165 ("libxpm" ,libxpm)
166 ("libxml2" ,libxml2)
167 ("libice" ,libice)
168 ("libsm" ,libsm)
169 ("alsa-lib" ,alsa-lib)
170 ("dbus" ,dbus)
171
172 ;; multilingualization support
173 ("libotf" ,libotf)
174 ("m17n-lib" ,m17n-lib)))
175 (native-inputs
176 `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
177 ("pkg-config" ,pkg-config)
178 ("texinfo" ,texinfo)))
179
180 (native-search-paths
181 (list (search-path-specification
182 (variable "INFOPATH")
183 (files '("share/info")))))
184
185 (home-page "https://www.gnu.org/software/emacs/")
186 (synopsis "The extensible, customizable, self-documenting text editor")
187 (description
188 "GNU Emacs is an extensible and highly customizable text editor. It is
189 based on an Emacs Lisp interpreter with extensions for text editing. Emacs
190 has been extended in essentially all areas of computing, giving rise to a
191 vast array of packages supporting, e.g., email, IRC and XMPP messaging,
192 spreadsheets, remote server editing, and much more. Emacs includes extensive
193 documentation on all aspects of the system, from basic editing to writing
194 large Lisp programs. It has full Unicode support for nearly all human
195 languages.")
196 (license license:gpl3+)))
197
198 (define-public emacs-minimal
199 ;; This is the version that you should use as an input to packages that just
200 ;; need to byte-compile .el files.
201 (package (inherit emacs)
202 (name "emacs-minimal")
203 (synopsis "The extensible text editor (used only for byte-compilation)")
204 (build-system gnu-build-system)
205 (arguments
206 (substitute-keyword-arguments (package-arguments emacs)
207 ((#:phases phases)
208 `(modify-phases ,phases
209 (delete 'install-site-start)))
210 ((#:configure-flags flags ''())
211 `(list "--with-gnutls=no" "--disable-build-details"))))
212 (inputs
213 `(("ncurses" ,ncurses)))
214 (native-inputs
215 `(("pkg-config" ,pkg-config)))))
216
217 (define-public emacs-xwidgets
218 (package
219 (inherit emacs)
220 (name "emacs-xwidgets")
221 (synopsis "The extensible, customizable, self-documenting text
222 editor (with xwidgets support)")
223 (build-system gnu-build-system)
224 (arguments
225 (substitute-keyword-arguments (package-arguments emacs)
226 ((#:configure-flags flags ''())
227 `(cons "--with-xwidgets" ,flags))))
228 (inputs
229 `(("webkitgtk" ,webkitgtk)
230 ("libxcomposite" ,libxcomposite)
231 ,@(package-inputs emacs)))))
232
233 (define-public emacs-no-x
234 (package (inherit emacs)
235 (name "emacs-no-x")
236 (synopsis "The extensible, customizable, self-documenting text
237 editor (console only)")
238 (build-system gnu-build-system)
239 (inputs (fold alist-delete
240 (package-inputs emacs)
241 '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
242 "imagemagick" "libpng" "librsvg" "libxpm" "libice"
243 "libsm"
244
245 ;; These depend on libx11, so remove them as well.
246 "libotf" "m17n-lib" "dbus")))))
247
248 (define-public emacs-no-x-toolkit
249 (package (inherit emacs)
250 (name "emacs-no-x-toolkit")
251 (synopsis "The extensible, customizable, self-documenting text
252 editor (without an X toolkit)" )
253 (build-system gnu-build-system)
254 (inputs (append `(("inotify-tools" ,inotify-tools))
255 (alist-delete "gtk+" (package-inputs emacs))))
256 (arguments
257 `(,@(substitute-keyword-arguments (package-arguments emacs)
258 ((#:configure-flags cf)
259 `(cons "--with-x-toolkit=no" ,cf)))))))
260
261 (define-public guile-emacs
262 (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")
263 (revision "0"))
264 (package (inherit emacs)
265 (name "guile-emacs")
266 (version (git-version "0.0.0" revision commit))
267 (source (origin
268 (method git-fetch)
269 (uri (git-reference
270 (url "https://git.hcoop.net/git/bpt/emacs.git")
271 (commit commit)))
272 (file-name (git-file-name name version))
273 (patches (search-patches "guile-emacs-fix-configure.patch"))
274 (sha256
275 (base32
276 "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
277 (native-inputs
278 `(("autoconf" ,autoconf)
279 ("automake" ,automake)
280 ("guile" ,guile-for-guile-emacs)
281 ,@(package-native-inputs emacs)))
282 (arguments
283 (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
284 #:parallel-build? #f
285 ;; Tests aren't passing for now.
286 #:tests? #f
287 ,@(package-arguments emacs))
288 ((#:phases phases)
289 `(modify-phases ,phases
290 (add-after 'unpack 'autogen
291 (lambda _
292 (invoke "sh" "autogen.sh")))
293 ;; Build sometimes fails: deps/dispnew.d: No such file or directory
294 (add-before 'build 'make-deps-dir
295 (lambda _
296 (invoke "mkdir" "-p" "src/deps"))))))))))
297
298 (define-public m17n-db
299 (package
300 (name "m17n-db")
301 (version "1.8.0")
302 (source
303 (origin
304 (method url-fetch)
305 (uri (string-append "mirror://savannah/m17n/m17n-db-"
306 version ".tar.gz"))
307 (sha256
308 (base32
309 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
310 (build-system gnu-build-system)
311 (inputs
312 `(("gettext" ,gettext-minimal)))
313 (arguments
314 `(#:configure-flags
315 (list (string-append "--with-charmaps="
316 (assoc-ref %build-inputs "libc")
317 "/share/i18n/charmaps"))))
318 ;; With `guix lint' the home-page URI returns a small page saying
319 ;; that your browser does not handle frames. This triggers the "URI
320 ;; returns suspiciously small file" warning.
321 (home-page "https://www.nongnu.org/m17n/")
322 (synopsis "Multilingual text processing library (database)")
323 (description "The m17n library realizes multilingualization of
324 many aspects of applications. The m17n library represents
325 multilingual text as an object named M-text. M-text is a string with
326 attributes called text properties, and designed to substitute for
327 string in C. Text properties carry any information required to input,
328 display and edit the text.
329
330 This package contains the library database.")
331 (license license:lgpl2.1+)))
332
333 (define-public m17n-lib
334 (package
335 (name "m17n-lib")
336 (version "1.8.0")
337 (source
338 (origin
339 (method url-fetch)
340 (uri (string-append "mirror://savannah/m17n/m17n-lib-"
341 version ".tar.gz"))
342 (sha256
343 (base32
344 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))))
345 (build-system gnu-build-system)
346 (inputs
347 `(("fribidi" ,fribidi)
348 ("gd" ,gd)
349 ("libotf" ,libotf)
350 ("libxft" ,libxft)
351 ("libxml2" ,libxml2)
352 ("m17n-db" ,m17n-db)))
353 (arguments
354 `(#:parallel-build? #f))
355 ;; With `guix lint' the home-page URI returns a small page saying
356 ;; that your browser does not handle frames. This triggers the "URI
357 ;; returns suspiciously small file" warning.
358 (home-page "https://www.nongnu.org/m17n/")
359 (synopsis "Multilingual text processing library (runtime)")
360 (description "The m17n library realizes multilingualization of
361 many aspects of applications. The m17n library represents
362 multilingual text as an object named M-text. M-text is a string with
363 attributes called text properties, and designed to substitute for
364 string in C. Text properties carry any information required to input,
365 display and edit the text.
366
367 This package contains the library runtime.")
368 (license license:lgpl2.1+)))