X-Git-Url: http://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/4f8dc1536adf5965597d53a1e7867690429a12b2..68be4da83087d0faff227c61ca93c7679230c998:/gnu/packages/emacs.scm diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 34b70fe9e8..0cd3e04381 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -1,21 +1,26 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer -;;; Copyright © 2014, 2015, 2016, 2017, 2018 Mark H Weaver +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver ;;; Copyright © 2014, 2015, 2016, 2017 Alex Kost ;;; Copyright © 2016, 2018 Arun Isaac ;;; Copyright © 2016 Federico Beffa ;;; Copyright © 2016 David Thompson -;;; Copyright © 2016 Nils Gillmann +;;; Copyright © 2016 Nikita ;;; Copyright © 2017 Marius Bakke -;;; Copyright © 2017 Maxim Cournoyer +;;; Copyright © 2017, 2019, 2020 Maxim Cournoyer ;;; Copyright © 2017 Alex Vong ;;; Copyright © 2017, 2018 Ricardo Wurmus ;;; Copyright © 2017 Jan Nieuwenhuizen ;;; Copyright © 2018 Efraim Flashner ;;; Copyright © 2018 Mathieu Othacehe -;;; Copyright © 2018 Tobias Geerinckx-Rice +;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice +;;; Copyright © 2019 Jesse John Gildersleve +;;; Copyright © 2019 Valentin Ignatev +;;; Copyright © 2019 Leo Prikler +;;; Copyright © 2019 Amin Bandali +;;; Copyright © 2020 Jack Hill ;;; ;;; This file is part of GNU Guix. ;;; @@ -49,16 +54,19 @@ #:use-module (gnu packages gd) #:use-module (gnu packages gettext) #:use-module (gnu packages glib) - #:use-module (gnu packages gnome) ; for librsvg + #:use-module (gnu packages gnome) ; for librsvg #:use-module (gnu packages gtk) #:use-module (gnu packages guile) #:use-module (gnu packages image) #:use-module (gnu packages imagemagick) - #:use-module (gnu packages linux) ; alsa-lib + #:use-module (gnu packages linux) ; alsa-lib + #:use-module (gnu packages mail) ; for mailutils + #:use-module (gnu packages multiprecision) #:use-module (gnu packages ncurses) #:use-module (gnu packages pkg-config) #:use-module (gnu packages texinfo) #:use-module (gnu packages tls) + #:use-module (gnu packages web) ; for jansson #:use-module (gnu packages webkit) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) @@ -68,56 +76,67 @@ (define-public emacs (package (name "emacs") - (version "26.1") + (version "27.1") (source (origin - (method url-fetch) - (uri (string-append "mirror://gnu/emacs/emacs-" - version ".tar.xz")) - (sha256 - (base32 - "0b6k1wq44rc8gkvxhi1bbjxbz3cwg29qbq8mklq2az6p1hjgrx0w")) - (patches (search-patches "emacs-exec-path.patch" - "emacs-fix-scheme-indent-function.patch" - "emacs-source-date-epoch.patch")) - (modules '((guix build utils))) - (snippet - ;; Delete the bundled byte-compiled elisp files and - ;; generated autoloads. - '(with-directory-excursion "lisp" - (for-each delete-file - (append (find-files "." "\\.elc$") - (find-files "." "loaddefs\\.el$") - ;; This is the only "autoloads" file that - ;; does not have "*loaddefs.el" name. - '("eshell/esh-groups.el"))) + (method url-fetch) + (uri (string-append "mirror://gnu/emacs/emacs-" + version ".tar.xz")) + (sha256 + (base32 + "0h9f2wpmp6rb5rfwvqwv1ia1nw86h74p7hnz3vb3gjazj67i4k2a")) + (patches (search-patches "emacs-exec-path.patch" + "emacs-fix-scheme-indent-function.patch" + "emacs-ignore-empty-xim-styles.patch" + "emacs-source-date-epoch.patch")) + (modules '((guix build utils))) + (snippet + '(with-directory-excursion "lisp" + ;; Delete the bundled byte-compiled elisp files and generated + ;; autoloads. + (for-each delete-file + (append (find-files "." "\\.elc$") + (find-files "." "loaddefs\\.el$") + (find-files "eshell" "^esh-groups\\.el$"))) - ;; Make sure Tramp looks for binaries in the right places on - ;; remote GuixSD machines, where 'getconf PATH' returns - ;; something bogus. - (substitute* "net/tramp-sh.el" - ;; Patch the line after "(defcustom tramp-remote-path". - (("\\(tramp-default-remote-path") - (format #f "(tramp-default-remote-path ~s ~s ~s ~s " - "~/.guix-profile/bin" "~/.guix-profile/sbin" - "/run/current-system/profile/bin" - "/run/current-system/profile/sbin"))) + ;; Make sure Tramp looks for binaries in the right places on + ;; remote Guix System machines, where 'getconf PATH' returns + ;; something bogus. + (substitute* "net/tramp-sh.el" + ;; Patch the line after "(defcustom tramp-remote-path". + (("\\(tramp-default-remote-path") + (format #f "(tramp-default-remote-path ~s ~s ~s ~s " + "~/.guix-profile/bin" "~/.guix-profile/sbin" + "/run/current-system/profile/bin" + "/run/current-system/profile/sbin"))) - ;; Make sure Man looks for C header files in the right - ;; places. - (substitute* "man.el" - (("\"/usr/local/include\"" line) - (string-join - (list line - "\"~/.guix-profile/include\"" - "\"/var/guix/profiles/system/profile/include\"") - " "))) - #t)))) + ;; Make sure Man looks for C header files in the right + ;; places. + (substitute* "man.el" + (("\"/usr/local/include\"" line) + (string-join + (list line + "\"~/.guix-profile/include\"" + "\"/var/guix/profiles/system/profile/include\"") + " "))) + #t)))) (build-system glib-or-gtk-build-system) (arguments - `(#:tests? #f ; no check target - #:configure-flags (list "--with-modules") + `(#:tests? #f ; no check target + #:configure-flags (list "--with-modules" + "--with-cairo" + "--disable-build-details") #:phases (modify-phases %standard-phases + (add-after 'unpack 'patch-program-file-names + (lambda _ + (substitute* '("src/callproc.c" + "lisp/term.el" + "lisp/htmlfontify.el" + "lisp/textmodes/artist.el" + "lisp/progmodes/sh-script.el") + (("\"/bin/sh\"") + (format #f "~s" (which "sh")))) + #t)) (add-before 'configure 'fix-/bin/pwd (lambda _ ;; Use `pwd', not `/bin/pwd'. @@ -126,13 +145,22 @@ "pwd")) #t)) (add-after 'install 'install-site-start - ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages - ;; provided by Guix and installed in - ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are - ;; automatically found. + ;; Use 'guix-emacs' in "site-start.el", which is used autoload the + ;; Elisp packages found in EMACSLOADPATH. (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) - (lisp-dir (string-append out "/share/emacs/site-lisp"))) + (lisp-dir (string-append out "/share/emacs/site-lisp")) + (emacs (string-append out "/bin/emacs"))) + + ;; This is duplicated from emacs-utils to prevent coupling. + (define* (emacs-byte-compile-directory dir) + (let ((expr `(progn + (setq byte-compile-debug t) + (byte-recompile-directory + (file-name-as-directory ,dir) 0 1)))) + (invoke emacs "--quick" "--batch" + (format #f "--eval=~s" expr)))) + (copy-file (assoc-ref inputs "guix-emacs.el") (string-append lisp-dir "/guix-emacs.el")) (with-output-to-file (string-append lisp-dir "/site-start.el") @@ -140,20 +168,69 @@ (display (string-append "(when (require 'guix-emacs nil t)\n" " (guix-emacs-autoload-packages))\n")))) - #t)))))) + ;; Remove the extraneous subdirs.el file, as it causes Emacs to + ;; add recursively all the the sub-directories of a profile's + ;; share/emacs/site-lisp union when added to EMACSLOADPATH, + ;; which leads to conflicts. + (delete-file (string-append lisp-dir "/subdirs.el")) + ;; Byte compile the site-start files. + (emacs-byte-compile-directory lisp-dir)) + #t)) + (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp + ;; restore the dump file that Emacs installs somewhere in + ;; libexec/ to its original state + (lambda* (#:key outputs target #:allow-other-keys) + (let* ((libexec (string-append (assoc-ref outputs "out") + "/libexec")) + ;; each of these find-files should return one file + (pdmp (find-files libexec "^emacs\\.pdmp$")) + (pdmp-real (find-files libexec + "^\\.emacs\\.pdmp-real$"))) + (for-each (lambda (wrapper real) + (delete-file wrapper) + (rename-file real wrapper)) + pdmp pdmp-real)) + #t)) + (add-after 'glib-or-gtk-wrap 'strip-double-wrap + (lambda* (#:key outputs #:allow-other-keys) + ;; Directly copy emacs-X.Y to emacs, so that it is not wrapped + ;; twice. This also fixes a minor issue, where WMs would not be + ;; able to track emacs back to emacs.desktop. + (with-directory-excursion (assoc-ref outputs "out") + (copy-file (string-append + "bin/emacs-" + ,(version-major+minor (package-version emacs))) + "bin/emacs") + #t))) + (add-before 'reset-gzip-timestamps 'make-compressed-files-writable + ;; The 'reset-gzip-timestamps phase will throw a permission error + ;; if gzip files aren't writable then. This phase is needed when + ;; building from a git checkout. + (lambda _ + (for-each make-file-writable + (find-files %output ".*\\.t?gz$")) + #t))))) (inputs `(("gnutls" ,gnutls) ("ncurses" ,ncurses) + ;; Avoid Emacs's limited movemail substitute that retrieves POP3 email + ;; only via insecure channels. This is not needed for (modern) IMAP. + ("mailutils" ,mailutils) + ;; TODO: Add the optional dependencies. ("libx11" ,libx11) ("gtk+" ,gtk+) + ("cairo" ,cairo) + ("pango" ,pango) + ("harfbuzz" ,harfbuzz) ("libxft" ,libxft) ("libtiff" ,libtiff) ("giflib" ,giflib) - ("libjpeg" ,libjpeg) - ("imagemagick" ,imagemagick) + ("libjpeg" ,libjpeg-turbo) ("acl" ,acl) + ("jansson" ,jansson) + ("gmp" ,gmp) ;; When looking for libpng `configure' links with `-lpng -lz', so we ;; must also provide zlib as an input. @@ -178,6 +255,11 @@ (native-search-paths (list (search-path-specification + (variable "EMACSLOADPATH") + ;; The versioned entry is for the Emacs' builtin libraries. + (files (list "share/emacs/site-lisp" + (string-append "share/emacs/" version "/lisp")))) + (search-path-specification (variable "INFOPATH") (files '("share/info"))))) @@ -197,39 +279,45 @@ languages.") (define-public emacs-minimal ;; This is the version that you should use as an input to packages that just ;; need to byte-compile .el files. - (package (inherit emacs) + (package/inherit emacs (name "emacs-minimal") (synopsis "The extensible text editor (used only for byte-compilation)") (build-system gnu-build-system) (arguments - `(,@(substitute-keyword-arguments (package-arguments emacs) - ((#:phases phases) - `(modify-phases ,phases - (delete 'install-site-start)))) - #:configure-flags (list "--with-gnutls=no"))) + (substitute-keyword-arguments (package-arguments emacs) + ((#:configure-flags flags ''()) + `(list "--with-gnutls=no" "--disable-build-details")) + ((#:phases phases) + `(modify-phases ,phases + (delete 'restore-emacs-pdmp) + (delete 'strip-double-wrap))))) (inputs - `(("ncurses" ,ncurses))) + `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el")) + ("ncurses" ,ncurses))) (native-inputs `(("pkg-config" ,pkg-config))))) (define-public emacs-xwidgets - (package - (inherit emacs) + (package/inherit emacs (name "emacs-xwidgets") (synopsis "The extensible, customizable, self-documenting text editor (with xwidgets support)") (build-system gnu-build-system) (arguments - `(#:configure-flags - '("--with-xwidgets") - ,@(package-arguments emacs))) + (substitute-keyword-arguments (package-arguments emacs) + ((#:configure-flags flags ''()) + `(cons "--with-xwidgets" ,flags)) + ((#:phases phases) + `(modify-phases ,phases + (delete 'restore-emacs-pdmp) + (delete 'strip-double-wrap))))) (inputs `(("webkitgtk" ,webkitgtk) ("libxcomposite" ,libxcomposite) ,@(package-inputs emacs))))) (define-public emacs-no-x - (package (inherit emacs) + (package/inherit emacs (name "emacs-no-x") (synopsis "The extensible, customizable, self-documenting text editor (console only)") @@ -238,26 +326,50 @@ editor (console only)") (package-inputs emacs) '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg" "imagemagick" "libpng" "librsvg" "libxpm" "libice" - "libsm" + "libsm" "cairo" "pango" "harfbuzz" ;; These depend on libx11, so remove them as well. - "libotf" "m17n-lib" "dbus"))))) + "libotf" "m17n-lib" "dbus"))) + (arguments + (substitute-keyword-arguments (package-arguments emacs) + ((#:configure-flags flags ''()) + `(delete "--with-cairo" ,flags)) + ((#:phases phases) + `(modify-phases ,phases + (delete 'restore-emacs-pdmp) + (delete 'strip-double-wrap))))))) (define-public emacs-no-x-toolkit - (package (inherit emacs) + (package/inherit emacs (name "emacs-no-x-toolkit") (synopsis "The extensible, customizable, self-documenting text editor (without an X toolkit)" ) (build-system gnu-build-system) (inputs (append `(("inotify-tools" ,inotify-tools)) (alist-delete "gtk+" (package-inputs emacs)))) - (arguments (append '(#:configure-flags '("--with-x-toolkit=no")) - (package-arguments emacs))))) + (arguments + (substitute-keyword-arguments (package-arguments emacs) + ((#:configure-flags flags ''()) + `(cons "--with-x-toolkit=no" ,flags)) + ((#:phases phases) + `(modify-phases ,phases + (delete 'restore-emacs-pdmp) + (delete 'strip-double-wrap))))))) + +(define-public emacs-wide-int + (package/inherit emacs + (name "emacs-wide-int") + (synopsis "The extensible, customizable, self-documenting text +editor (with wide ints)" ) + (arguments + (substitute-keyword-arguments (package-arguments emacs) + ((#:configure-flags flags) + `(cons "--with-wide-int" ,flags)))))) (define-public guile-emacs (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b") (revision "0")) - (package (inherit emacs) + (package/inherit emacs (name "guile-emacs") (version (git-version "0.0.0" revision commit)) (source (origin @@ -281,6 +393,8 @@ editor (without an X toolkit)" ) ;; Tests aren't passing for now. #:tests? #f ,@(package-arguments emacs)) + ((#:configure-flags flags ''()) + `(delete "--with-cairo" ,flags)) ((#:phases phases) `(modify-phases ,phases (add-after 'unpack 'autogen @@ -289,7 +403,9 @@ editor (without an X toolkit)" ) ;; Build sometimes fails: deps/dispnew.d: No such file or directory (add-before 'build 'make-deps-dir (lambda _ - (invoke "mkdir" "-p" "src/deps")))))))))) + (invoke "mkdir" "-p" "src/deps"))) + (delete 'restore-emacs-pdmp) + (delete 'strip-double-wrap)))))))) (define-public m17n-db (package