bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#38843: define-globalized-minor-mode enable boolean will prevent load


From: Lars Ingebrigtsen
Subject: bug#38843: define-globalized-minor-mode enable boolean will prevent loading with :require
Date: Fri, 30 Oct 2020 15:49:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

"Paul W. Rankin" <hello@paulwrankin.com> writes:

> If a global minor modes is based on local minor modes, it may use a
> :require keyword in the global minor mode definition, e.g. from
> page-break-lines:
>
>     ;;;###autoload
>     (define-global-minor-mode global-page-break-lines-mode
>       page-break-lines-mode page-break-lines-mode-maybe
>       :require 'page-break-lines
>       :group 'page-break-lines)
>
> Toggling the option global-page-break-lines-mode in this case will add
> the following to the user's init:
>
>     '(global-page-break-lines-mode t nil (page-break-lines))
>
> The problem occurs when page-break-lines is for whatever reason
> unavailable, it will prevent Emacs from loading.

So the problem is basically that you've switched a minor mode on via
Customize, but then deleted the minor mode.  I'm actually not sure
whether it makes sense for Emacs to signal an error or not here: You've
asked to have a mode switched on, but then Emacs can't do that because
it can't find the file it's defined in.

So this is, in some ways, no different from having a `require' in your
.emacs that no longer exists.

On the other hand, it's a bit unfriendly, and doing the same with other
mode variables doesn't bug out.  The following patch fixes the problem.

Does anybody have an opinion here?

diff --git a/lisp/custom.el b/lisp/custom.el
index cc445fe765..94c36dedd9 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1010,7 +1010,9 @@ custom-theme-set-variables
               set)
          (when requests
            (put symbol 'custom-requests requests)
-            (mapc #'require requests))
+            (mapc (lambda (lib) (ignore-error file-missing
+                                  (require lib)))
+                  requests))
           (setq set (or (get symbol 'custom-set) #'custom-set-default))
          (put symbol 'saved-value (list value))
          (put symbol 'saved-variable-comment comment)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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