From d0a64567f1218bec0de98e685c1e610e4a32038c Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 22 Mar 2020 12:10:26 -0400 Subject: Revert "gnu: emacs: Byte compile the site-lisp directory." This reverts commit 4714d0fc1a96eb6d421b64b0b585fe8043dcd07b. Rational: Having to rebuild Emacs every time (guix build emacs-utils) changes is not great. --- gnu/packages/emacs.scm | 43 ++++--------------------------------------- 1 file changed, 4 insertions(+), 39 deletions(-) (limited to 'gnu/packages/emacs.scm') diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index fd9c7fa875..794cbca38d 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -129,11 +129,6 @@ `(#:tests? #f ; no check target #:configure-flags (list "--with-modules" "--disable-build-details") - #:modules ((guix build emacs-utils) - (guix build glib-or-gtk-build-system) - (guix build utils)) - #:imported-modules ((guix build emacs-utils) - ,@%glib-or-gtk-build-system-modules) #:phases (modify-phases %standard-phases (add-before 'configure 'fix-/bin/pwd @@ -148,8 +143,7 @@ ;; 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")) - (emacs (string-append out "/bin/emacs"))) + (lisp-dir (string-append out "/share/emacs/site-lisp"))) (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") @@ -162,9 +156,6 @@ ;; 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. - (parameterize ((%emacs emacs)) - (emacs-byte-compile-directory lisp-dir)) #t)))))) (inputs `(("gnutls" ,gnutls) @@ -333,12 +324,6 @@ languages.") (build-system gnu-build-system) (arguments (substitute-keyword-arguments (package-arguments emacs) - ((#:modules _) - `((guix build emacs-utils) - ,@%gnu-build-system-modules)) - ((#:imported-modules _) - `((guix build emacs-utils) - ,@%gnu-build-system-modules)) ((#:phases phases) `(modify-phases ,phases (delete 'install-site-start))) @@ -358,12 +343,6 @@ editor (with xwidgets support)") (build-system gnu-build-system) (arguments (substitute-keyword-arguments (package-arguments emacs) - ((#:modules _) - `((guix build emacs-utils) - ,@%gnu-build-system-modules)) - ((#:imported-modules _) - `((guix build emacs-utils) - ,@%gnu-build-system-modules)) ((#:configure-flags flags ''()) `(cons "--with-xwidgets" ,flags)))) (inputs @@ -377,14 +356,6 @@ editor (with xwidgets support)") (synopsis "The extensible, customizable, self-documenting text editor (console only)") (build-system gnu-build-system) - (arguments - (substitute-keyword-arguments (package-arguments emacs) - ((#:modules _) - `((guix build emacs-utils) - ,@%gnu-build-system-modules)) - ((#:imported-modules _) - `((guix build emacs-utils) - ,@%gnu-build-system-modules)))) (inputs (fold alist-delete (package-inputs emacs) '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg" @@ -403,15 +374,9 @@ editor (without an X toolkit)" ) (inputs (append `(("inotify-tools" ,inotify-tools)) (alist-delete "gtk+" (package-inputs emacs)))) (arguments - (substitute-keyword-arguments (package-arguments emacs) - ((#:modules _) - `((guix build emacs-utils) - ,@%gnu-build-system-modules)) - ((#:imported-modules _) - `((guix build emacs-utils) - ,@%gnu-build-system-modules)) - ((#:configure-flags cf) - `(cons "--with-x-toolkit=no" ,cf)))))) + `(,@(substitute-keyword-arguments (package-arguments emacs) + ((#:configure-flags cf) + `(cons "--with-x-toolkit=no" ,cf))))))) (define-public guile-emacs (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b") -- cgit v1.2.3 From ffaec30702f392a50cbd6d3ba229506b5a38e207 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 22 Mar 2020 12:40:25 -0400 Subject: gnu: emacs: Byte compile the site-lisp directory, without coupling. This re-instates what the previously reverted commit did, but without adding a dependency on the (guix build emacs-utils) module. * gnu/packages/emacs.scm (emacs)[phases]{install-site-start}: Define a EMACS-BYTE-COMPILE-DIRECTORY procedure, and use it. --- gnu/packages/emacs.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gnu/packages/emacs.scm') diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 794cbca38d..ec5e6687fd 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -9,7 +9,7 @@ ;;; Copyright © 2016 David Thompson ;;; Copyright © 2016 ng0 ;;; Copyright © 2017 Marius Bakke -;;; Copyright © 2017, 2019 Maxim Cournoyer +;;; Copyright © 2017, 2019, 2020 Maxim Cournoyer ;;; Copyright © 2017 Alex Vong ;;; Copyright © 2017, 2018 Ricardo Wurmus ;;; Copyright © 2017 Jan Nieuwenhuizen @@ -143,7 +143,18 @@ ;; 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 "--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") @@ -156,7 +167,8 @@ ;; share/emacs/site-lisp union when added to EMACSLOADPATH, ;; which leads to conflicts. (delete-file (string-append lisp-dir "/subdirs.el")) - #t)))))) + ;; Byte compile the site-start files. + (emacs-byte-compile-directory lisp-dir))))))) (inputs `(("gnutls" ,gnutls) ("ncurses" ,ncurses) -- cgit v1.2.3 From 3bd3a6257f33901ca66183b17f03f1dc6a059067 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 22 Mar 2020 12:44:24 -0400 Subject: gnu: emacs: Re-indent. * gnu/packages/emacs.scm (emacs): Fix indentation. --- gnu/packages/emacs.scm | 92 +++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'gnu/packages/emacs.scm') diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index ec5e6687fd..cf84af950d 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -76,54 +76,54 @@ (name "emacs") (version "26.3") (source (origin - (method url-fetch) - (uri (string-append "mirror://gnu/emacs/emacs-" - version ".tar.xz")) - (sha256 - (base32 - "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d")) - (patches (search-patches "emacs-exec-path.patch" - "emacs-fix-scheme-indent-function.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$") - ;; This is the only "autoloads" file that - ;; does not have "*loaddefs.el" name. - ;; TODO: Next time changing this package, - ;; replace the following with a call to - ;; `find-files', so that `delete-file' - ;; wouldn't error out when the file is - ;; missing, making the entire snippet field - ;; reusable as-is for `emacs-next' below. - '("eshell/esh-groups.el"))) + (method url-fetch) + (uri (string-append "mirror://gnu/emacs/emacs-" + version ".tar.xz")) + (sha256 + (base32 + "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d")) + (patches (search-patches "emacs-exec-path.patch" + "emacs-fix-scheme-indent-function.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$") + ;; This is the only "autoloads" file that + ;; does not have "*loaddefs.el" name. + ;; TODO: Next time changing this package, + ;; replace the following with a call to + ;; `find-files', so that `delete-file' + ;; wouldn't error out when the file is + ;; missing, making the entire snippet field + ;; reusable as-is for `emacs-next' below. + '("eshell/esh-groups.el"))) - ;; 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 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 -- cgit v1.2.3 From 393c5e69281d997b345362626d7ffb988ab862f6 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 22 Mar 2020 12:46:39 -0400 Subject: gnu: emacs-minimal: Install the custom site-start file. This makes the EMACS-MINIMAL package more generally useful, by adding support to load autoload definitions. Note that this doesn't negatively impact the performance of the emacs-build-system, because at that time the --quick option is used, which disables loading site-start.el (which is the one calling GUIX-EMACS-AUTOLOAD-PACKAGES). * gnu/packages/emacs.scm (emacs-minimal)[phases]: Do not delete the 'install-site-start phase. [inputs]: Add the emacs/guix-emacs.el auxiliary file. --- gnu/packages/emacs.scm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gnu/packages/emacs.scm') diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index cf84af950d..3be3ff0188 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -336,13 +336,11 @@ languages.") (build-system gnu-build-system) (arguments (substitute-keyword-arguments (package-arguments emacs) - ((#:phases phases) - `(modify-phases ,phases - (delete 'install-site-start))) ((#:configure-flags flags ''()) `(list "--with-gnutls=no" "--disable-build-details")))) (inputs - `(("ncurses" ,ncurses))) + `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el")) + ("ncurses" ,ncurses))) (native-inputs `(("pkg-config" ,pkg-config))))) -- cgit v1.2.3 From 4cbd60698daf648979fe8ad924602e87dcdefde1 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sat, 21 Mar 2020 23:16:08 -0400 Subject: gnu: emacs: Patch references to /bin/sh. When attempting to run ert-runner in the build side environment where /bin/sh doesn't exist as part of the emacs-elpy test suite, Emacs was throwing the error "Searching for program: No such file or directory, /bin/sh". This is because the default shell when SHELL is not set was "/bin/sh", as can be seen in callproc.c: sh = getenv ("SHELL"); Vshell_file_name = build_string (sh ? sh : "/bin/sh"); Thus, patch the occurrences of "/bin/sh" in the source files of Emacs to refer to their correct store location. * gnu/packages/emacs.scm (emacs)[phases]{patch-program-file-names}: Add phase. --- gnu/packages/emacs.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gnu/packages/emacs.scm') diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 3be3ff0188..de19998a41 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -131,6 +131,16 @@ "--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 "~s" (which "sh")))) + #t)) (add-before 'configure 'fix-/bin/pwd (lambda _ ;; Use `pwd', not `/bin/pwd'. -- cgit v1.2.3