aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-emacs.el29
-rw-r--r--emacs/guix-info.el17
-rw-r--r--emacs/guix-init.el.in4
3 files changed, 41 insertions, 9 deletions
diff --git a/emacs/guix-emacs.el b/emacs/guix-emacs.el
index 512a2e2b1a..4c3aa23115 100644
--- a/emacs/guix-emacs.el
+++ b/emacs/guix-emacs.el
@@ -42,19 +42,40 @@ If PROFILE is nil, use `guix-user-profile'."
(expand-file-name "share/emacs/site-lisp"
(or profile guix-user-profile)))
+(defun guix-emacs-find-autoloads-in-directory (directory)
+ "Return list of Emacs 'autoloads' files in DIRECTORY."
+ (directory-files directory 'full-name "-autoloads\\.el\\'" 'no-sort))
+
+(defun guix-emacs-subdirs (directory)
+ "Return list of DIRECTORY subdirectories."
+ (cl-remove-if (lambda (file)
+ (or (string-match-p (rx "/." string-end) file)
+ (string-match-p (rx "/.." string-end) file)
+ (not (file-directory-p file))))
+ (directory-files directory 'full-name nil 'no-sort)))
+
(defun guix-emacs-find-autoloads (&optional profile)
"Return list of autoloads of Emacs packages installed in PROFILE.
If PROFILE is nil, use `guix-user-profile'.
Return nil if there are no emacs packages installed in PROFILE."
- (let ((dir (guix-emacs-directory profile)))
- (if (file-directory-p dir)
- (directory-files dir 'full-name "-autoloads\\.el\\'")
+ (let ((elisp-root-dir (guix-emacs-directory profile)))
+ (if (file-directory-p elisp-root-dir)
+ (let ((elisp-pkgs-dir (expand-file-name "guix.d" elisp-root-dir))
+ (root-autoloads (guix-emacs-find-autoloads-in-directory
+ elisp-root-dir)))
+ (if (file-directory-p elisp-pkgs-dir)
+ (let ((pkgs-autoloads
+ (cl-mapcan #'guix-emacs-find-autoloads-in-directory
+ (guix-emacs-subdirs elisp-pkgs-dir))))
+ (append root-autoloads pkgs-autoloads))
+ root-autoloads))
(message "Directory '%s' does not exist." dir)
nil)))
;;;###autoload
(defun guix-emacs-load-autoloads (&optional all)
"Load autoloads for Emacs packages installed in a user profile.
+Add autoloads directories to `load-path'.
If ALL is nil, activate only those packages that were installed
after the last activation, otherwise activate all Emacs packages
installed in `guix-user-profile'."
@@ -65,6 +86,8 @@ installed in `guix-user-profile'."
(cl-nset-difference autoloads guix-emacs-autoloads
:test #'string=))))
(dolist (file files)
+ (cl-pushnew (file-name-directory file) load-path
+ :test #'string=)
(load file 'noerror))
(setq guix-emacs-autoloads autoloads)))
diff --git a/emacs/guix-info.el b/emacs/guix-info.el
index bb21024c0c..f17ce01ab6 100644
--- a/emacs/guix-info.el
+++ b/emacs/guix-info.el
@@ -1,6 +1,7 @@
;;; guix-info.el --- Info buffers for displaying entries -*- lexical-binding: t -*-
-;; Copyright © 2014 Alex Kost <alezost@gmail.com>
+;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
+;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
;; This file is part of GNU Guix.
@@ -482,6 +483,12 @@ If nil, insert package in a default way.")
(defvar guix-package-info-heading-params '(synopsis description)
"List of parameters displayed in a heading along with name and version.")
+(defcustom guix-package-info-fill-heading t
+ "If nil, insert heading parameters in a raw form, without
+filling them to fit the window."
+ :type 'boolean
+ :group 'guix-package-info)
+
(defun guix-package-info-insert-heading (entry)
"Insert the heading for package ENTRY.
Show package name, version, and `guix-package-info-heading-params'."
@@ -494,8 +501,12 @@ Show package name, version, and `guix-package-info-heading-params'."
(face (guix-get-symbol (symbol-name param)
'info 'package)))
(when val
- (guix-format-insert val (and (facep face) face))
- (insert "\n\n"))))
+ (let* ((col (min (window-width) fill-column))
+ (val (if guix-package-info-fill-heading
+ (guix-get-filled-string val col)
+ val)))
+ (guix-format-insert val (and (facep face) face))
+ (insert "\n\n")))))
guix-package-info-heading-params))
(defun guix-package-info-insert-with-heading (entry)
diff --git a/emacs/guix-init.el.in b/emacs/guix-init.el.in
index 4e40d7171a..728bc375c2 100644
--- a/emacs/guix-init.el.in
+++ b/emacs/guix-init.el.in
@@ -1,5 +1,4 @@
(require 'guix-autoloads)
-(require 'guix-emacs)
(defvar guix-load-path
(replace-regexp-in-string "${prefix}" "@prefix@" "@emacsuidir@")
@@ -13,9 +12,8 @@ avoid loading autoloads of Emacs packages installed in
:type 'boolean
:group 'guix)
-(add-to-list 'load-path (guix-emacs-directory))
-
(when guix-package-enable-at-startup
+ (require 'guix-emacs)
(guix-emacs-load-autoloads 'all))
(provide 'guix-init)