2014-11-30 15:38:43 -05:00
|
|
|
;;; guix-emacs.el --- Emacs packages installed with Guix
|
|
|
|
|
2017-02-18 03:44:52 -05:00
|
|
|
;; Copyright © 2014, 2015, 2016, 2017 Alex Kost <alezost@gmail.com>
|
2017-07-27 01:01:26 -04:00
|
|
|
;; Copyright © 2017 Kyle Meyer <kyle@kyleam.com>
|
2019-10-29 22:07:55 -04:00
|
|
|
;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2014-11-30 15:38:43 -05:00
|
|
|
|
|
|
|
;; This file is part of GNU Guix.
|
|
|
|
|
|
|
|
;; GNU Guix is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
;; GNU Guix is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
2017-02-18 03:44:52 -05:00
|
|
|
;; This file provides auxiliary code to autoload Emacs packages
|
2014-11-30 15:38:43 -05:00
|
|
|
;; installed with Guix.
|
|
|
|
|
|
|
|
;;; Code:
|
2019-10-29 22:07:55 -04:00
|
|
|
(require 'seq)
|
2014-11-30 15:38:43 -05:00
|
|
|
|
2015-12-03 05:03:19 -05:00
|
|
|
(defvar guix-emacs-autoloads-regexp
|
2019-10-29 22:07:55 -04:00
|
|
|
(rx (* any) "-autoloads.el" (zero-or-one "c") string-end)
|
2015-12-03 05:03:19 -05:00
|
|
|
"Regexp to match Emacs 'autoloads' file.")
|
|
|
|
|
2016-02-05 03:46:40 -05:00
|
|
|
(defun guix-emacs-find-autoloads (directory)
|
2015-12-03 05:03:19 -05:00
|
|
|
"Return a list of Emacs 'autoloads' files in DIRECTORY.
|
|
|
|
The files in the list do not have extensions (.el, .elc)."
|
2019-10-29 22:07:55 -04:00
|
|
|
;; `directory-files' doesn't honor group in regexp.
|
|
|
|
(mapcar #'file-name-sans-extension
|
|
|
|
(directory-files directory 'full-name guix-emacs-autoloads-regexp)))
|
2014-11-30 15:38:43 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
2019-10-29 22:07:55 -04:00
|
|
|
(defun guix-emacs-autoload-packages ()
|
|
|
|
"Autoload Emacs packages found in EMACSLOADPATH.
|
2016-02-05 03:46:40 -05:00
|
|
|
|
2019-10-29 22:07:55 -04:00
|
|
|
'Autoload' means to load the 'autoloads' files matching
|
2016-02-05 03:46:40 -05:00
|
|
|
`guix-emacs-autoloads-regexp'."
|
2019-10-29 22:07:55 -04:00
|
|
|
;; FIXME: The autoloads generated by the emacs-build-system are not byte
|
|
|
|
;; compiled.
|
|
|
|
(interactive)
|
2019-11-27 00:02:42 -05:00
|
|
|
(let* ((emacs-non-core-load-path-directories
|
2019-10-29 22:07:55 -04:00
|
|
|
;; Filter out core Elisp directories, which are already autoloaded
|
|
|
|
;; by Emacs.
|
|
|
|
(seq-filter (lambda (dir)
|
|
|
|
(string-match-p "/share/emacs/site-lisp" dir))
|
2019-11-27 00:02:42 -05:00
|
|
|
load-path))
|
2019-11-26 23:51:53 -05:00
|
|
|
(autoloads (mapcan #'guix-emacs-find-autoloads
|
|
|
|
emacs-non-core-load-path-directories)))
|
2019-10-29 22:07:55 -04:00
|
|
|
(mapc (lambda (f)
|
|
|
|
(load f 'noerror))
|
|
|
|
autoloads)))
|
2014-11-30 15:38:43 -05:00
|
|
|
|
|
|
|
(provide 'guix-emacs)
|
|
|
|
|
|
|
|
;;; guix-emacs.el ends here
|