Merge branch 'master' 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 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 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 Nils Gillmann <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.1")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "mirror://gnu/emacs/emacs-"
75 version ".tar.xz"))
76 (sha256
77 (base32
78 "0b6k1wq44rc8gkvxhi1bbjxbz3cwg29qbq8mklq2az6p1hjgrx0w"))
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 GuixSD 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 #:phases
119 (modify-phases %standard-phases
120 (add-before 'configure 'fix-/bin/pwd
121 (lambda _
122 ;; Use `pwd', not `/bin/pwd'.
123 (substitute* (find-files "." "^Makefile\\.in$")
124 (("/bin/pwd")
125 "pwd"))
126 #t))
127 (add-after 'install 'install-site-start
128 ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages
129 ;; provided by Guix and installed in
130 ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
131 ;; automatically found.
132 (lambda* (#:key inputs outputs #:allow-other-keys)
133 (let* ((out (assoc-ref outputs "out"))
134 (lisp-dir (string-append out "/share/emacs/site-lisp")))
135 (copy-file (assoc-ref inputs "guix-emacs.el")
136 (string-append lisp-dir "/guix-emacs.el"))
137 (with-output-to-file (string-append lisp-dir "/site-start.el")
138 (lambda ()
139 (display
140 (string-append "(when (require 'guix-emacs nil t)\n"
141 " (guix-emacs-autoload-packages))\n"))))
142 #t))))))
143 (inputs
144 `(("gnutls" ,gnutls)
145 ("ncurses" ,ncurses)
146
147 ;; TODO: Add the optional dependencies.
148 ("libx11" ,libx11)
149 ("gtk+" ,gtk+)
150 ("libxft" ,libxft)
151 ("libtiff" ,libtiff)
152 ("giflib" ,giflib)
153 ("libjpeg" ,libjpeg)
154 ("imagemagick" ,imagemagick)
155 ("acl" ,acl)
156
157 ;; When looking for libpng `configure' links with `-lpng -lz', so we
158 ;; must also provide zlib as an input.
159 ("libpng" ,libpng)
160 ("zlib" ,zlib)
161
162 ("librsvg" ,librsvg)
163 ("libxpm" ,libxpm)
164 ("libxml2" ,libxml2)
165 ("libice" ,libice)
166 ("libsm" ,libsm)
167 ("alsa-lib" ,alsa-lib)
168 ("dbus" ,dbus)
169
170 ;; multilingualization support
171 ("libotf" ,libotf)
172 ("m17n-lib" ,m17n-lib)))
173 (native-inputs
174 `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
175 ("pkg-config" ,pkg-config)
176 ("texinfo" ,texinfo)))
177
178 (native-search-paths
179 (list (search-path-specification
180 (variable "INFOPATH")
181 (files '("share/info")))))
182
183 (home-page "https://www.gnu.org/software/emacs/")
184 (synopsis "The extensible, customizable, self-documenting text editor")
185 (description
186 "GNU Emacs is an extensible and highly customizable text editor. It is
187 based on an Emacs Lisp interpreter with extensions for text editing. Emacs
188 has been extended in essentially all areas of computing, giving rise to a
189 vast array of packages supporting, e.g., email, IRC and XMPP messaging,
190 spreadsheets, remote server editing, and much more. Emacs includes extensive
191 documentation on all aspects of the system, from basic editing to writing
192 large Lisp programs. It has full Unicode support for nearly all human
193 languages.")
194 (license license:gpl3+)))
195
196 (define-public emacs-minimal
197 ;; This is the version that you should use as an input to packages that just
198 ;; need to byte-compile .el files.
199 (package (inherit emacs)
200 (name "emacs-minimal")
201 (synopsis "The extensible text editor (used only for byte-compilation)")
202 (build-system gnu-build-system)
203 (arguments
204 `(#:configure-flags (list "--with-gnutls=no")
205 ,@(substitute-keyword-arguments (package-arguments emacs)
206 ((#:phases phases)
207 `(modify-phases ,phases
208 (delete 'install-site-start))))))
209 (inputs
210 `(("ncurses" ,ncurses)))
211 (native-inputs
212 `(("pkg-config" ,pkg-config)))))
213
214 (define-public emacs-xwidgets
215 (package
216 (inherit emacs)
217 (name "emacs-xwidgets")
218 (synopsis "The extensible, customizable, self-documenting text
219 editor (with xwidgets support)")
220 (build-system gnu-build-system)
221 (arguments
222 `(#:configure-flags
223 '("--with-xwidgets")
224 ,@(package-arguments emacs)))
225 (inputs
226 `(("webkitgtk" ,webkitgtk)
227 ("libxcomposite" ,libxcomposite)
228 ,@(package-inputs emacs)))))
229
230 (define-public emacs-no-x
231 (package (inherit emacs)
232 (name "emacs-no-x")
233 (synopsis "The extensible, customizable, self-documenting text
234 editor (console only)")
235 (build-system gnu-build-system)
236 (inputs (fold alist-delete
237 (package-inputs emacs)
238 '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
239 "imagemagick" "libpng" "librsvg" "libxpm" "libice"
240 "libsm"
241
242 ;; These depend on libx11, so remove them as well.
243 "libotf" "m17n-lib" "dbus")))))
244
245 (define-public emacs-no-x-toolkit
246 (package (inherit emacs)
247 (name "emacs-no-x-toolkit")
248 (synopsis "The extensible, customizable, self-documenting text
249 editor (without an X toolkit)" )
250 (build-system gnu-build-system)
251 (inputs (append `(("inotify-tools" ,inotify-tools))
252 (alist-delete "gtk+" (package-inputs emacs))))
253 (arguments (append '(#:configure-flags '("--with-x-toolkit=no"))
254 (package-arguments emacs)))))
255
256 (define-public guile-emacs
257 (package (inherit emacs)
258 (name "guile-emacs")
259 (version "20150512.41120e0")
260 (source (origin
261 (method git-fetch)
262 (uri (git-reference
263 (url "git://git.hcoop.net/git/bpt/emacs.git")
264 (commit "41120e0f595b16387eebfbf731fff70481de1b4b")))
265 (file-name (string-append name "-" version "-checkout"))
266 (patches (search-patches "guile-emacs-fix-configure.patch"))
267 (sha256
268 (base32
269 "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
270 (native-inputs
271 `(("autoconf" ,autoconf)
272 ("automake" ,automake)
273 ("guile" ,guile-for-guile-emacs)
274 ,@(package-native-inputs emacs)))
275 (arguments
276 (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
277 #:parallel-build? #f
278 ;; Tests aren't passing for now.
279 #:tests? #f
280 ,@(package-arguments emacs))
281 ((#:phases phases)
282 `(modify-phases ,phases
283 (add-after 'unpack 'autogen
284 (lambda _
285 (invoke "sh" "autogen.sh")))
286 ;; Build sometimes fails: deps/dispnew.d: No such file or directory
287 (add-before 'build 'make-deps-dir
288 (lambda _
289 (invoke "mkdir" "-p" "src/deps")))))))))
290
291 (define-public m17n-db
292 (package
293 (name "m17n-db")
294 (version "1.8.0")
295 (source
296 (origin
297 (method url-fetch)
298 (uri (string-append "mirror://savannah/m17n/m17n-db-"
299 version ".tar.gz"))
300 (sha256
301 (base32
302 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
303 (build-system gnu-build-system)
304 (inputs
305 `(("gettext" ,gettext-minimal)))
306 (arguments
307 `(#:configure-flags
308 (list (string-append "--with-charmaps="
309 (assoc-ref %build-inputs "libc")
310 "/share/i18n/charmaps"))))
311 ;; With `guix lint' the home-page URI returns a small page saying
312 ;; that your browser does not handle frames. This triggers the "URI
313 ;; returns suspiciously small file" warning.
314 (home-page "https://www.nongnu.org/m17n/")
315 (synopsis "Multilingual text processing library (database)")
316 (description "The m17n library realizes multilingualization of
317 many aspects of applications. The m17n library represents
318 multilingual text as an object named M-text. M-text is a string with
319 attributes called text properties, and designed to substitute for
320 string in C. Text properties carry any information required to input,
321 display and edit the text.
322
323 This package contains the library database.")
324 (license license:lgpl2.1+)))
325
326 (define-public m17n-lib
327 (package
328 (name "m17n-lib")
329 (version "1.8.0")
330 (source
331 (origin
332 (method url-fetch)
333 (uri (string-append "mirror://savannah/m17n/m17n-lib-"
334 version ".tar.gz"))
335 (sha256
336 (base32
337 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))))
338 (build-system gnu-build-system)
339 (inputs
340 `(("fribidi" ,fribidi)
341 ("gd" ,gd)
342 ("libotf" ,libotf)
343 ("libxft" ,libxft)
344 ("libxml2" ,libxml2)
345 ("m17n-db" ,m17n-db)))
346 (arguments
347 `(#:parallel-build? #f))
348 ;; With `guix lint' the home-page URI returns a small page saying
349 ;; that your browser does not handle frames. This triggers the "URI
350 ;; returns suspiciously small file" warning.
351 (home-page "https://www.nongnu.org/m17n/")
352 (synopsis "Multilingual text processing library (runtime)")
353 (description "The m17n library realizes multilingualization of
354 many aspects of applications. The m17n library represents
355 multilingual text as an object named M-text. M-text is a string with
356 attributes called text properties, and designed to substitute for
357 string in C. Text properties carry any information required to input,
358 display and edit the text.
359
360 This package contains the library runtime.")
361 (license license:lgpl2.1+)))