diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index ed2258c199f..b4494e2fad5 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -26,6 +26,7 @@ ;;; Copyright © 2023 Declan Tsien ;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2025 Nicolas Graves +;;; Copyright © 2025 Jake Forster ;;; ;;; This file is part of GNU Guix. ;;; @@ -192,6 +193,7 @@ "\"~/.guix-home/include\"" "\"/run/current-system/profile/include\"") " "))))))) + (outputs '("out" "doc")) (build-system gnu-build-system) (arguments (list @@ -311,6 +313,21 @@ (("/bin//sh") (search-input-file inputs "bin/sh"))) (substitute* "test/lisp/eshell/em-script-tests.el" (("/usr/bin/env") (search-input-file inputs "bin/env")))))) + (add-before 'configure 'install-c-source + (lambda _ + (let ((dest (string-append #$output:doc "/share/emacs/c-source")) + (lisp-dir (string-append #$output:doc + "/share/emacs/site-lisp"))) + (mkdir-p dest) + (copy-recursively "src" dest) + (mkdir-p lisp-dir) + (with-output-to-file (string-append lisp-dir + "/guix-emacs-c-source.el") + (lambda () + (display + (string-append + "(setq find-function-C-source-directory \"" dest "\")\n\n" + "(provide 'guix-emacs-c-source)"))))))) (add-after 'install 'install-site-start ;; Use 'guix-emacs' in "site-start.el", which is used autoload the ;; Elisp packages found in EMACSLOADPATH. @@ -338,7 +355,10 @@ "(when (require 'guix-emacs nil t)\n" " (guix-emacs-autoload-packages 'no-reload)\n" " (advice-add 'package-load-all-descriptors" - " :after #'guix-emacs-load-package-descriptors))")))) + " :after #'guix-emacs-load-package-descriptors))\n\n" + ";; The file guix-emacs-c-source.el is available from the" + " 'doc' output.\n" + "(require 'guix-emacs-c-source nil 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,