Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / emacs.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>
3 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages emacs)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix build-system glib-or-gtk)
28 #:use-module (guix build-system trivial)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages gtk)
31 #:use-module (gnu packages gnome)
32 #:use-module (gnu packages ncurses)
33 #:use-module (gnu packages texinfo)
34 #:use-module (gnu packages gnutls)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages guile)
37 #:use-module (gnu packages xorg)
38 #:use-module (gnu packages lesstif)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages version-control)
42 #:use-module (gnu packages imagemagick)
43 #:use-module (gnu packages w3m)
44 #:use-module (gnu packages wget)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages xml)
48 #:use-module (gnu packages glib)
49 #:use-module (gnu packages acl)
50 #:use-module (gnu packages perl)
51 #:use-module (gnu packages linux) ;alsa
52 #:use-module (gnu packages xiph)
53 #:use-module (gnu packages mp3)
54 #:use-module (guix utils)
55 #:use-module (srfi srfi-1))
56
57 (define-public emacs
58 (package
59 (name "emacs")
60 (version "24.4")
61 (source (origin
62 (method url-fetch)
63 (uri (string-append "mirror://gnu/emacs/emacs-"
64 version ".tar.xz"))
65 (sha256
66 (base32
67 "1zflm6ac34s6v166p58ilxrxbxjm0q2wfc25f8y0mjml1lbr3qs7"))))
68 (build-system glib-or-gtk-build-system)
69 (arguments
70 '(#:phases (alist-cons-before
71 'configure 'fix-/bin/pwd
72 (lambda _
73 ;; Use `pwd', not `/bin/pwd'.
74 (substitute* (find-files "." "^Makefile\\.in$")
75 (("/bin/pwd")
76 "pwd")))
77 %standard-phases)))
78 (inputs
79 `(("gnutls" ,gnutls)
80 ("ncurses" ,ncurses)
81
82 ;; TODO: Add the optional dependencies.
83 ("libx11" ,libx11)
84 ("gtk+" ,gtk+)
85 ("libxft" ,libxft)
86 ("libtiff" ,libtiff)
87 ("giflib" ,giflib)
88 ("libjpeg" ,libjpeg-8)
89 ("acl" ,acl)
90
91 ;; When looking for libpng `configure' links with `-lpng -lz', so we
92 ;; must also provide zlib as an input.
93 ("libpng" ,libpng)
94 ("zlib" ,zlib)
95
96 ("librsvg" ,librsvg)
97 ("libxpm" ,libxpm)
98 ("libxml2" ,libxml2)
99 ("libice" ,libice)
100 ("libsm" ,libsm)
101 ("alsa-lib" ,alsa-lib)
102 ("dbus" ,dbus)))
103 (native-inputs
104 `(("pkg-config" ,pkg-config)
105 ("texinfo" ,texinfo)))
106 (home-page "http://www.gnu.org/software/emacs/")
107 (synopsis "The extensible, customizable, self-documenting text editor")
108 (description
109 "GNU Emacs is an extensible and highly customizable text editor. It is
110 based on an Emacs Lisp interpreter with extensions for text editing. Emacs
111 has been extended in essentially all areas of computing, giving rise to a
112 vast array of packages supporting, e.g., email, IRC and XMPP messaging,
113 spreadsheets, remote server editing, and much more. Emacs includes extensive
114 documentation on all aspects of the system, from basic editing to writing
115 large Lisp programs. It has full Unicode support for nearly all human
116 languages.")
117 (license license:gpl3+)))
118
119 (define-public emacs-no-x
120 ;; This is the version that you should use as an input to packages that just
121 ;; need to byte-compile .el files.
122 (package (inherit emacs)
123 (location (source-properties->location (current-source-location)))
124 (name "emacs-no-x")
125 (synopsis "The extensible, customizable, self-documenting text
126 editor (console only)")
127 (build-system gnu-build-system)
128 (inputs (fold alist-delete
129 (package-inputs emacs)
130 '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
131 "libpng" "librsvg" "libxpm" "libice" "libsm"
132
133 ;; D-Bus depends on libx11, so remove it as well.
134 "dbus")))))
135
136 (define-public emacs-no-x-toolkit
137 (package (inherit emacs)
138 (location (source-properties->location (current-source-location)))
139 (name "emacs-no-x-toolkit")
140 (synopsis "The extensible, customizable, self-documenting text
141 editor (without an X toolkit)" )
142 (build-system gnu-build-system)
143 (inputs (append `(("inotify-tools" ,inotify-tools))
144 (alist-delete "gtk+" (package-inputs emacs))))
145 (arguments (append '(#:configure-flags '("--with-x-toolkit=no"))
146 (package-arguments emacs)))))
147
148 \f
149 ;;;
150 ;;; Emacs hacking.
151 ;;;
152
153 (define-public geiser
154 (package
155 (name "geiser")
156 (version "0.7")
157 (source (origin
158 (method url-fetch)
159 (uri (string-append "mirror://savannah/geiser/" version
160 "/geiser-" version ".tar.gz"))
161 (sha256
162 (base32
163 "0cp7r91ibw45yw9k3fz1s13y7ryfsxjgpk57qv37qsznb9lmqylx"))))
164 (build-system gnu-build-system)
165 (arguments
166 '(#:phases (alist-cons-after
167 'install 'post-install
168 (lambda* (#:key outputs #:allow-other-keys)
169 (symlink "geiser-install.el"
170 (string-append (assoc-ref outputs "out")
171 "/share/emacs/site-lisp/"
172 "geiser-autoloads.el")))
173 %standard-phases)))
174 (inputs `(("guile" ,guile-2.0)
175 ("emacs" ,emacs-no-x)))
176 (home-page "http://nongnu.org/geiser/")
177 (synopsis "Collection of Emacs modes for Guile and Racket hacking")
178 (description
179 "Geiser is a collection of Emacs major and minor modes that conspire with
180 one or more Scheme implementations to keep the Lisp Machine Spirit alive. The
181 continuously running Scheme interpreter takes the center of the stage in
182 Geiser. A bundle of Elisp shims orchestrates the dialog between the Scheme
183 implementation, Emacs and, ultimately, the schemer, giving them access to live
184 metadata.")
185 (license license:bsd-3)))
186
187 (define-public paredit
188 (package
189 (name "paredit")
190 (version "23")
191 (source (origin
192 (method url-fetch)
193 (uri (string-append "http://mumble.net/~campbell/emacs/paredit-"
194 version ".el"))
195 (sha256
196 (base32 "1np882jzvxckljx3cjz4absyzmc5hw65cs21sjmbic82163m9lf8"))))
197 (build-system trivial-build-system)
198 (inputs `(("emacs" ,emacs-no-x)))
199 (arguments
200 `(#:modules ((guix build utils)
201 (guix build emacs-utils))
202 #:builder
203 (begin
204 (use-modules (guix build utils))
205 (use-modules (guix build emacs-utils))
206
207 (let* ((emacs (string-append (assoc-ref %build-inputs "emacs")
208 "/bin/emacs"))
209 (source (assoc-ref %build-inputs "source"))
210 (lisp-dir (string-append %output
211 "/share/emacs/site-lisp"))
212 (target (string-append lisp-dir "/paredit.el")))
213 (mkdir-p lisp-dir)
214 (copy-file source target)
215 (with-directory-excursion lisp-dir
216 (parameterize ((%emacs emacs))
217 (emacs-generate-autoloads ,name lisp-dir)
218 (emacs-batch-eval '(byte-compile-file "paredit.el"))))))))
219 (home-page "http://mumble.net/~campbell/emacs/paredit/")
220 (synopsis "Emacs minor mode for editing parentheses")
221 (description
222 "ParEdit (paredit.el) is a minor mode for performing structured editing
223 of S-expression data. The typical example of this would be Lisp or Scheme
224 source code.
225
226 ParEdit helps **keep parentheses balanced** and adds many keys for moving
227 S-expressions and moving around in S-expressions. Its behavior can be jarring
228 for those who may want transient periods of unbalanced parentheses, such as
229 when typing parentheses directly or commenting out code line by line.")
230 (license license:gpl3+)))
231
232 (define-public magit
233 (package
234 (name "magit")
235 (version "1.2.1")
236 (source (origin
237 (method url-fetch)
238 (uri (string-append
239 "https://github.com/magit/magit/releases/download/"
240 version "/" name "-" version ".tar.gz"))
241 (sha256
242 (base32 "1in48g5l5xdc9cf2apnpgx73mqlz2njrpi1w52dgql4qxv3kg6gr"))))
243 (build-system gnu-build-system)
244 (native-inputs `(("texinfo" ,texinfo)))
245 (inputs `(("emacs" ,emacs-no-x)
246 ("git" ,git)
247 ("git:gui" ,git "gui")))
248 (arguments
249 `(#:modules ((guix build gnu-build-system)
250 (guix build utils)
251 (guix build emacs-utils))
252 #:imported-modules (,@%gnu-build-system-modules
253 (guix build emacs-utils))
254 #:tests? #f ; no check target
255 #:phases
256 (alist-replace
257 'configure
258 (lambda* (#:key outputs #:allow-other-keys)
259 (let ((out (assoc-ref outputs "out")))
260 (substitute* "Makefile"
261 (("/usr/local") out)
262 (("/etc") (string-append out "/etc")))))
263 (alist-cons-before
264 'build 'patch-exec-paths
265 (lambda* (#:key inputs #:allow-other-keys)
266 (let ((git (assoc-ref inputs "git"))
267 (git:gui (assoc-ref inputs "git:gui")))
268 (emacs-substitute-variables "magit.el"
269 ("magit-git-executable" (string-append git "/bin/git"))
270 ("magit-gitk-executable" (string-append git:gui "/bin/gitk")))))
271 (alist-cons-after
272 'install 'post-install
273 (lambda* (#:key outputs #:allow-other-keys)
274 (emacs-generate-autoloads
275 ,name (string-append (assoc-ref outputs "out")
276 "/share/emacs/site-lisp/")))
277 %standard-phases)))))
278 (home-page "http://magit.github.io/")
279 (synopsis "Emacs interface for the Git version control system")
280 (description
281 "With Magit, you can inspect and modify your Git repositories with Emacs.
282 You can review and commit the changes you have made to the tracked files, for
283 example, and you can browse the history of past changes. There is support for
284 cherry picking, reverting, merging, rebasing, and other common Git
285 operations.")
286 (license license:gpl3+)))
287
288 \f
289 ;;;
290 ;;; Web browsing.
291 ;;;
292
293 (define-public emacs-w3m
294 (package
295 (name "emacs-w3m")
296 (version "1.4.483+0.20120614")
297 (source (origin
298 (method url-fetch)
299 (uri (string-append "mirror://debian/pool/main/w/w3m-el/w3m-el_"
300 version ".orig.tar.gz"))
301 (sha256
302 (base32 "0ms181gjavnfk79hhv5xl9llik4c6kj0w3c04kgyif8lcy2sxljx"))))
303 (build-system gnu-build-system)
304 (native-inputs `(("autoconf" ,autoconf)))
305 (inputs `(("w3m" ,w3m)
306 ("imagemagick" ,imagemagick)
307 ("emacs" ,emacs-no-x)))
308 (arguments
309 '(#:modules ((guix build gnu-build-system)
310 (guix build utils)
311 (guix build emacs-utils))
312 #:imported-modules (,@%gnu-build-system-modules
313 (guix build emacs-utils))
314 #:configure-flags
315 (let ((out (assoc-ref %outputs "out")))
316 (list (string-append "--with-lispdir="
317 out "/share/emacs/site-lisp")
318 (string-append "--with-icondir="
319 out "/share/images/emacs-w3m")))
320 #:tests? #f ; no check target
321 #:phases
322 (alist-cons-after
323 'unpack 'autoconf
324 (lambda _
325 (zero? (system* "autoconf")))
326 (alist-cons-before
327 'build 'patch-exec-paths
328 (lambda* (#:key inputs outputs #:allow-other-keys)
329 (let ((out (assoc-ref outputs "out"))
330 (w3m (assoc-ref inputs "w3m"))
331 (imagemagick (assoc-ref inputs "imagemagick"))
332 (coreutils (assoc-ref inputs "coreutils")))
333 (emacs-substitute-variables "w3m.el"
334 ("w3m-command" (string-append w3m "/bin/w3m"))
335 ("w3m-touch-command" (string-append coreutils "/bin/touch"))
336 ("w3m-image-viewer" (string-append imagemagick "/bin/display"))
337 ("w3m-icon-directory" (string-append out
338 "/share/images/emacs-w3m")))
339 (emacs-substitute-variables "w3m-image.el"
340 ("w3m-imagick-convert-program" (string-append imagemagick
341 "/bin/convert"))
342 ("w3m-imagick-identify-program" (string-append imagemagick
343 "/bin/identify")))
344 #t))
345 (alist-replace
346 'install
347 (lambda* (#:key outputs #:allow-other-keys)
348 (and (zero? (system* "make" "install" "install-icons"))
349 (with-directory-excursion
350 (string-append (assoc-ref outputs "out")
351 "/share/emacs/site-lisp")
352 (for-each delete-file '("ChangeLog" "ChangeLog.1"))
353 (symlink "w3m-load.el" "w3m-autoloads.el")
354 #t)))
355 %standard-phases)))))
356 (home-page "http://emacs-w3m.namazu.org/")
357 (synopsis "Simple Web browser for Emacs based on w3m")
358 (description
359 "Emacs-w3m is an emacs interface for the w3m web browser.")
360 (license license:gpl2+)))
361
362 (define-public emacs-wget
363 (package
364 (name "emacs-wget")
365 (version "0.5.0")
366 (source (origin
367 (method url-fetch)
368 (uri (string-append "mirror://debian/pool/main/w/wget-el/wget-el_"
369 version ".orig.tar.gz"))
370 (sha256
371 (base32 "10byvyv9dk0ib55gfqm7bcpxmx2qbih1jd03gmihrppr2mn52nff"))))
372 (build-system gnu-build-system)
373 (inputs `(("wget" ,wget)
374 ("emacs" ,emacs-no-x)))
375 (arguments
376 '(#:modules ((guix build gnu-build-system)
377 (guix build utils)
378 (guix build emacs-utils))
379 #:imported-modules (,%gnu-build-system-modules
380 (guix build emacs-utils))
381 #:tests? #f ; no check target
382 #:phases
383 (alist-replace
384 'configure
385 (lambda* (#:key outputs #:allow-other-keys)
386 (substitute* "Makefile"
387 (("/usr/local") (assoc-ref outputs "out"))
388 (("/site-lisp/emacs-wget") "/site-lisp")))
389 (alist-cons-before
390 'build 'patch-exec-paths
391 (lambda* (#:key inputs outputs #:allow-other-keys)
392 (let ((wget (assoc-ref inputs "wget")))
393 (emacs-substitute-variables "wget.el"
394 ("wget-command" (string-append wget "/bin/wget")))))
395 (alist-cons-after
396 'install 'post-install
397 (lambda* (#:key outputs #:allow-other-keys)
398 (emacs-generate-autoloads
399 "wget" (string-append (assoc-ref outputs "out")
400 "/share/emacs/site-lisp/")))
401 %standard-phases)))))
402 (home-page "http://www.emacswiki.org/emacs/EmacsWget")
403 (synopsis "Simple file downloader for Emacs based on wget")
404 (description
405 "Emacs-wget is an emacs interface for the wget file downloader.")
406 (license license:gpl2+)))
407
408 \f
409 ;;;
410 ;;; Multimedia.
411 ;;;
412
413 (define-public emms
414 (package
415 (name "emms")
416 (version "4.0")
417 (source (origin
418 (method url-fetch)
419 (uri (string-append "mirror://gnu/emms/emms-"
420 version ".tar.gz"))
421 (sha256
422 (base32
423 "1q0n3iwva8bvai2rl9sm49sdjmk0wi7vajz4knz01l7g67nrp87l"))
424 (modules '((guix build utils)))
425 (snippet
426 '(substitute* "Makefile"
427 (("/usr/bin/install-info")
428 ;; No need to use 'install-info' since it would create a
429 ;; useless 'dir' file.
430 "true")
431 (("^INFODIR=.*")
432 ;; Install Info files to $out/share/info, not $out/info.
433 "INFODIR := $(PREFIX)/share/info\n")
434 (("/site-lisp/emms")
435 ;; Install directly in share/emacs/site-lisp, not in a
436 ;; sub-directory.
437 "/site-lisp")
438 (("^all: (.*)\n" _ rest)
439 ;; Build 'emms-print-metadata'.
440 (string-append "all: " rest " emms-print-metadata\n"))))))
441 (build-system gnu-build-system)
442 (arguments
443 '(#:modules ((guix build gnu-build-system)
444 (guix build utils)
445 (guix build emacs-utils))
446 #:imported-modules (,%gnu-build-system-modules
447 (guix build emacs-utils))
448
449 #:phases (alist-replace
450 'configure
451 (lambda* (#:key inputs outputs #:allow-other-keys)
452 (let ((out (assoc-ref outputs "out"))
453 (vorbis (assoc-ref inputs "vorbis-tools"))
454 (alsa (assoc-ref inputs "alsa-utils"))
455 (mpg321 (assoc-ref inputs "mpg321"))
456 (mp3info (assoc-ref inputs "mp3info")))
457 ;; Specify the installation directory.
458 (substitute* "Makefile"
459 (("PREFIX=.*$")
460 (string-append "PREFIX := " out "\n")))
461
462 (setenv "SHELL" (which "sh"))
463 (setenv "CC" "gcc")
464
465 ;; Specify the absolute file names of the various
466 ;; programs so that everything works out-of-the-box.
467 (with-directory-excursion "lisp"
468 (emacs-substitute-variables
469 "emms-player-mpg321-remote.el"
470 ("emms-player-mpg321-remote-command"
471 (string-append mpg321 "/bin/mpg321")))
472 (substitute* "emms-player-simple.el"
473 (("\"ogg123\"")
474 (string-append "\"" vorbis "/bin/ogg123\"")))
475 (emacs-substitute-variables "emms-info-ogginfo.el"
476 ("emms-info-ogginfo-program-name"
477 (string-append vorbis "/bin/ogginfo")))
478 (emacs-substitute-variables "emms-info-libtag.el"
479 ("emms-info-libtag-program-name"
480 (string-append out "/bin/emms-print-metadata")))
481 (emacs-substitute-variables "emms-info-mp3info.el"
482 ("emms-info-mp3info-program-name"
483 (string-append mp3info "/bin/mp3info")))
484 (substitute* "emms-volume-amixer.el"
485 (("\"amixer\"")
486 (string-append "\"" alsa "/bin/amixer\"")))
487 (substitute* "emms-tag-editor.el"
488 (("\"mp3info\"")
489 (string-append "\"" mp3info "/bin/mp3info\""))))))
490 (alist-cons-before
491 'install 'pre-install
492 (lambda* (#:key outputs #:allow-other-keys)
493 ;; The 'install' rule expects the target directory to
494 ;; exist.
495 (let* ((out (assoc-ref outputs "out"))
496 (man1 (string-append out "/share/man/man1")))
497 (mkdir-p man1)
498 #t))
499 (alist-cons-after
500 'install 'post-install
501 (lambda* (#:key outputs #:allow-other-keys)
502 (let* ((out (assoc-ref outputs "out"))
503 (target (string-append
504 out "/bin/emms-print-metadata")))
505 (symlink "emms-auto.el"
506 (string-append out "/share/emacs/site-lisp/"
507 "emms-autoloads.el"))
508 (mkdir-p (dirname target))
509 (copy-file "src/emms-print-metadata" target)
510 (chmod target #o555)))
511 %standard-phases)))
512 #:tests? #f))
513 (native-inputs `(("emacs" ,emacs-no-x) ;for (guix build emacs-utils)
514 ("texinfo" ,texinfo)))
515 (inputs `(("alsa-utils" ,alsa-utils)
516 ("vorbis-tools" ,vorbis-tools)
517 ("mpg321" ,mpg321)
518 ("taglib" ,taglib)
519 ("mp3info" ,mp3info)))
520 (synopsis "Emacs Multimedia System")
521 (description
522 "EMMS is the Emacs Multimedia System. It is a small front-end which
523 can control one of the supported external players. Thus, it supports
524 whatever formats are supported by your music player. It also
525 supports tagging and playlist management, all behind a clean and
526 light user interface.")
527 (home-page "http://www.gnu.org/software/emms/")
528 (license license:gpl3+)))
529
530 \f
531 ;;;
532 ;;; Miscellaneous.
533 ;;;
534
535 (define-public bbdb
536 (package
537 (name "bbdb")
538 (version "3.1.2")
539 (source (origin
540 (method url-fetch)
541 (uri (string-append "mirror://savannah/bbdb/bbdb-"
542 version ".tar.gz"))
543 (sha256
544 (base32
545 "1gs16bbpiiy01w9pyg12868r57kx1v3hnw04gmqsmpc40l1hyy05"))
546 (modules '((guix build utils)))
547 (snippet
548 ;; We don't want to build and install the PDF.
549 '(substitute* "doc/Makefile.in"
550 (("^doc_DATA = .*$")
551 "doc_DATA =\n")))))
552 (build-system gnu-build-system)
553 (arguments
554 '(#:phases (alist-cons-after
555 'install 'post-install
556 (lambda* (#:key outputs #:allow-other-keys)
557 ;; Add an autoloads file with the right name for guix.el.
558 (let* ((out (assoc-ref outputs "out"))
559 (site (string-append out "/share/emacs/site-lisp")))
560 (with-directory-excursion site
561 (symlink "bbdb-loaddefs.el" "bbdb-autoloads.el"))))
562 %standard-phases)))
563 (native-inputs `(("emacs" ,emacs-no-x)))
564 (home-page "http://savannah.nongnu.org/projects/bbdb/")
565 (synopsis "Contact management utility for Emacs")
566 (description
567 "BBDB is the Insidious Big Brother Database for GNU Emacs. It provides
568 an address book for email and snail mail addresses, phone numbers and the
569 like. It can be linked with various Emacs mail clients (Message and Mail
570 mode, Rmail, Gnus, MH-E, and VM). BBDB is fully customizable.")
571 (license license:gpl3+)))