summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/easy-mmode.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-03-12 16:42:51 +0100
committerAndrea Corallo <akrl@sdf.org>2021-03-12 16:42:51 +0100
commit82bd6d57d54d4cdb205d921c2476d1dbb17f4188 (patch)
treefca7c47620f8d246015b85aab8dd91e440847743 /lisp/emacs-lisp/easy-mmode.el
parentd9cd55a4f1c3f391b996dfbe77ed24306b37ac9f (diff)
parenta0854f939ce3a1de2c8cbc5e38b106a8df4480f6 (diff)
downloademacs-82bd6d57d54d4cdb205d921c2476d1dbb17f4188.tar.gz
emacs-82bd6d57d54d4cdb205d921c2476d1dbb17f4188.tar.bz2
emacs-82bd6d57d54d4cdb205d921c2476d1dbb17f4188.zip
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'lisp/emacs-lisp/easy-mmode.el')
-rw-r--r--lisp/emacs-lisp/easy-mmode.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 4a9e58083b0..addb58cdbbe 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -332,12 +332,20 @@ or call the function `%s'."))))
t)))
;; Keep minor modes list up to date.
,@(if globalp
- `((setq global-minor-modes (delq ',modefun global-minor-modes))
+ ;; When running this byte-compiled code in earlier
+ ;; Emacs versions, these variables may not be defined
+ ;; there. So check defensively, even if they're
+ ;; always defined in Emacs 28 and up.
+ `((when (boundp 'global-minor-modes)
+ (setq global-minor-modes
+ (delq ',modefun global-minor-modes))
+ (when ,getter
+ (push ',modefun global-minor-modes))))
+ ;; Ditto check.
+ `((when (boundp 'local-minor-modes)
+ (setq local-minor-modes (delq ',modefun local-minor-modes))
(when ,getter
- (push ',modefun global-minor-modes)))
- `((setq local-minor-modes (delq ',modefun local-minor-modes))
- (when ,getter
- (push ',modefun local-minor-modes))))
+ (push ',modefun local-minor-modes)))))
,@body
;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,getter ',hook-on ',hook-off))