bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65575: [PATCH v3 3/4] gnu: emacs: Allow producing verbose messages w


From: Maxim Cournoyer
Subject: bug#65575: [PATCH v3 3/4] gnu: emacs: Allow producing verbose messages when loading autoloads.
Date: Fri, 1 Sep 2023 00:53:20 -0400

* gnu/packages/aux-files/emacs/guix-emacs.el: Expound commentary.
(guix-emacs-verbose): New variable.
(guix-emacs--load-file-no-error): New procedure.
(guix-emacs-autoload-packages): Use it.

---

(no changes since v2)

Changes in v2:
- New commit

 gnu/packages/aux-files/emacs/guix-emacs.el | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el 
b/gnu/packages/aux-files/emacs/guix-emacs.el
index 4db7ec28c9..84284dde39 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -22,8 +22,9 @@
 
 ;;; Commentary:
 
-;; This file provides auxiliary code to autoload Emacs packages
-;; installed with Guix.
+;; This file provides auxiliary code to autoload Emacs packages installed with
+;; Guix.  To produce verbose messages useful while debugging, set the
+;; GUIX-EMACS-VERBOSE variable to true.
 
 ;;; Code:
 (require 'seq)
@@ -41,6 +42,15 @@ The files in the list do not have extensions (.el, .elc)."
                        (directory-files directory 'full-name
                                         guix-emacs-autoloads-regexp))))
 
+(defcustom guix-emacs-verbose nil
+  "Set to true to provide verbose messages, such as when loading packages."
+  :type 'boolean
+  :group 'guix-emacs)
+
+(defun guix-emacs--load-file-no-error (file)
+  "Load FILE, ignoring any errors"
+  (load file 'noerror (not guix-emacs-verbose)))
+
 (defun guix-emacs--non-core-load-path ()
   ;; Filter out core Elisp directories, which are already handled by Emacs.
   (seq-filter (lambda (dir)
@@ -63,9 +73,7 @@ The files in the list do not have extensions (.el, .elc)."
   (interactive)
   (let ((autoloads (mapcan #'guix-emacs-find-autoloads
                            (guix-emacs--non-core-load-path))))
-    (mapc (lambda (f)
-            (load f 'noerror t))
-          autoloads)))
+    (mapc #'guix-emacs--load-file-no-error autoloads)))
 
 ;;;###autoload
 (defun guix-emacs-load-package-descriptors ()
-- 
2.41.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]