* doc/lispref/modes.texi (Minor Modes): Document it.
* lisp/simple.el (global-minor-modes): New variable.
(completion-in-mode-p): Use it.
(completion-with-modes-p): Use it.
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Support it.
the current buffer, and is a list of symbols.
@end defvar
+@defvar global-minor-modes
+This variable lists the currently enabled global minor modes, and is a
+list of symbols.
+@end defvar
+
@defvar minor-mode-list
The value of this variable is a list of all minor mode commands.
@end defvar
+++
** New buffer-local variable 'local-minor-modes'.
This permanently buffer-local variable holds a list of currently
-enabled minor modes in the current buffer (as a list of symbols).
+enabled non-global minor modes in the current buffer (as a list of
+symbols).
+
++++
+** New variable 'global-minor-modes'.
+This variable holds a list of currently enabled global minor modes (as
+a list of symbols).
+++
** 'define-minor-mode' now takes an :interactive argument.
nil)
(t
t)))
- (unless ,globalp
- ;; Keep `local-minor-modes' up to date.
- (setq local-minor-modes (delq ',modefun local-minor-modes))
- (when ,getter
- (push ',modefun local-minor-modes)))
+ ;; Keep minor modes list up to date.
+ ,@(if globalp
+ `((setq global-minor-modes (delq ',modefun global-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))))
,@body
;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,getter ',hook-on ',hook-off))
nil
"Overlay highlighting the current error message in the `next-error' buffer.")
+(defvar global-minor-modes nil
+ "A list of the currently enabled global minor modes.
+This is a list of symbols.")
+
(defcustom next-error-hook nil
"List of hook functions run by `next-error' after visiting source file."
:type 'hook
(or (provided-mode-derived-p
(buffer-local-value 'major-mode buffer) (car modes))
(memq (car modes)
- (buffer-local-value 'local-minor-modes buffer)))
+ (buffer-local-value 'local-minor-modes buffer))
+ (memq (car modes) global-minor-modes))
;; Uncommon case: Multiple modes.
(apply #'provided-mode-derived-p
(buffer-local-value 'major-mode buffer)
modes)
(seq-intersection modes
(buffer-local-value 'local-minor-modes buffer)
- #'eq)))))
+ #'eq)
+ (seq-intersection modes global-minor-modes #'eq)))))
(defun completion-with-modes-p (modes buffer)
"Say whether MODES are in action in BUFFER.
;; It's a minor mode.
(seq-intersection modes
(buffer-local-value 'local-minor-modes buffer)
- #'eq)))
+ #'eq)
+ (seq-intersection modes global-minor-modes #'eq)))
(defun completion-button-p (category buffer)
"Return non-nil if there's a button of CATEGORY at point in BUFFER."