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