Rename minor-modes to local-minor-modes

* doc/lispref/modes.texi (Minor Modes): Update documentation.
* lisp/simple.el (completion-with-modes-p): Change usage.

* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Change usage.

* src/buffer.c: Rename from minor_modes to local_minor_modes
throughout.
(syms_of_buffer): Rename minor-modes to local-minor-modes.

* src/buffer.h (struct buffer): Rename minor_modes_.

* src/pdumper.c (dump_buffer): Update hash and usage.
This commit is contained in:
Lars Ingebrigtsen 2021-02-15 12:44:57 +01:00
parent 54e577fbc1
commit 0bd846c174
7 changed files with 19 additions and 17 deletions

View file

@ -1461,7 +1461,7 @@ used only with Diff mode.
other minor modes in effect. It should be possible to activate and
deactivate minor modes in any order.
@defvar minor-modes
@defvar local-minor-modes
This buffer-local variable lists the currently enabled minor modes in
the current buffer, and is a list of symbols.
@end defvar

View file

@ -2295,7 +2295,7 @@ minor mode activated. Note that using this form will create byte code
that is not compatible with byte code in previous Emacs versions.
+++
** New buffer-local variable 'minor-modes'.
** 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).

View file

@ -331,10 +331,10 @@ or call the function `%s'."))))
(t
t)))
(unless ,globalp
;; Keep `minor-modes' up to date.
(setq minor-modes (delq ',modefun minor-modes))
;; Keep `local-minor-modes' up to date.
(setq local-minor-modes (delq ',modefun local-minor-modes))
(when ,getter
(push ',modefun 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))

View file

@ -1984,13 +1984,14 @@ BUFFER, or any of the active minor modes in BUFFER."
(if (null (cdr modes))
(or (provided-mode-derived-p
(buffer-local-value 'major-mode buffer) (car modes))
(memq (car modes) (buffer-local-value 'minor-modes buffer)))
(memq (car modes)
(buffer-local-value 'local-minor-modes buffer)))
;; Uncommon case: Multiple modes.
(apply #'provided-mode-derived-p
(buffer-local-value 'major-mode buffer)
modes)
(seq-intersection modes
(buffer-local-value 'minor-modes buffer)
(buffer-local-value 'local-minor-modes buffer)
#'eq)))))
(defun completion-with-modes-p (modes buffer)
@ -2002,7 +2003,7 @@ or (if one of MODES is a minor mode), if it is switched on in BUFFER."
modes)
;; It's a minor mode.
(seq-intersection modes
(buffer-local-value 'minor-modes buffer)
(buffer-local-value 'local-minor-modes buffer)
#'eq)))
(defun completion-button-p (category buffer)

View file

@ -292,9 +292,9 @@ bset_major_mode (struct buffer *b, Lisp_Object val)
b->major_mode_ = val;
}
static void
bset_minor_modes (struct buffer *b, Lisp_Object val)
bset_local_minor_modes (struct buffer *b, Lisp_Object val)
{
b->minor_modes_ = val;
b->local_minor_modes_ = val;
}
static void
bset_mark (struct buffer *b, Lisp_Object val)
@ -898,7 +898,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
bset_file_truename (b, Qnil);
bset_display_count (b, make_fixnum (0));
bset_backed_up (b, Qnil);
bset_minor_modes (b, Qnil);
bset_local_minor_modes (b, Qnil);
bset_auto_save_file_name (b, Qnil);
set_buffer_internal_1 (b);
Fset (intern ("buffer-save-without-query"), Qnil);
@ -973,7 +973,7 @@ reset_buffer (register struct buffer *b)
b->clip_changed = 0;
b->prevent_redisplay_optimizations_p = 1;
bset_backed_up (b, Qnil);
bset_minor_modes (b, Qnil);
bset_local_minor_modes (b, Qnil);
BUF_AUTOSAVE_MODIFF (b) = 0;
b->auto_save_failure_time = 0;
bset_auto_save_file_name (b, Qnil);
@ -5158,7 +5158,7 @@ init_buffer_once (void)
bset_auto_save_file_name (&buffer_local_flags, make_fixnum (-1));
bset_read_only (&buffer_local_flags, make_fixnum (-1));
bset_major_mode (&buffer_local_flags, make_fixnum (-1));
bset_minor_modes (&buffer_local_flags, make_fixnum (-1));
bset_local_minor_modes (&buffer_local_flags, make_fixnum (-1));
bset_mode_name (&buffer_local_flags, make_fixnum (-1));
bset_undo_list (&buffer_local_flags, make_fixnum (-1));
bset_mark_active (&buffer_local_flags, make_fixnum (-1));
@ -5625,7 +5625,8 @@ The default value (normally `fundamental-mode') affects new buffers.
A value of nil means to use the current buffer's major mode, provided
it is not marked as "special". */);
DEFVAR_PER_BUFFER ("minor-modes", &BVAR (current_buffer, minor_modes),
DEFVAR_PER_BUFFER ("local-minor-modes",
&BVAR (current_buffer, local_minor_modes),
Qnil,
doc: /* Minor modes currently active in the current buffer.
This is a list of symbols, or nil if there are no minor modes active. */);

View file

@ -339,7 +339,7 @@ struct buffer
Lisp_Object major_mode_;
/* Symbol listing all currently enabled minor modes. */
Lisp_Object minor_modes_;
Lisp_Object local_minor_modes_;
/* Pretty name of major mode (e.g., "Lisp"). */
Lisp_Object mode_name_;

View file

@ -2692,7 +2692,7 @@ dump_hash_table (struct dump_context *ctx,
static dump_off
dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
{
#if CHECK_STRUCTS && !defined HASH_buffer_732A01EB61
#if CHECK_STRUCTS && !defined HASH_buffer_F8FE65D42F
# error "buffer changed. See CHECK_STRUCTS comment in config.h."
#endif
struct buffer munged_buffer = *in_buffer;
@ -2703,7 +2703,7 @@ dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
buffer->window_count = 0;
else
eassert (buffer->window_count == -1);
buffer->minor_modes_ = Qnil;
buffer->local_minor_modes_ = Qnil;
buffer->last_selected_window_ = Qnil;
buffer->display_count_ = make_fixnum (0);
buffer->clip_changed = 0;