diff options
| author | Lars Ingebrigtsen | 2021-02-14 12:37:44 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-02-14 12:37:44 +0100 |
| commit | 760910f4917ad8ff5e1cd1bf0bfec443b02f0e44 (patch) | |
| tree | e917992524075eba732a2bc7ae21789b9ab9b570 /src | |
| parent | 103039b06c2c9a917fc796d2a4afda8433e37473 (diff) | |
| download | emacs-760910f4917ad8ff5e1cd1bf0bfec443b02f0e44.tar.gz emacs-760910f4917ad8ff5e1cd1bf0bfec443b02f0e44.zip | |
Add a new buffer-local variable `minor-modes'
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Keep
`minor-modes' updated.
* src/buffer.c (bset_minor_modes, Fmake_indirect_buffer)
(reset_buffer, init_buffer_once): Initialise `minor-modes'.
(syms_of_buffer): Add `minor-modes' as a new permanently-local
variable.
* src/buffer.h (struct buffer): Add minor_modes_.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 13 | ||||
| -rw-r--r-- | src/buffer.h | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 80c799e719b..487599dbbed 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -292,6 +292,11 @@ bset_major_mode (struct buffer *b, Lisp_Object val) | |||
| 292 | b->major_mode_ = val; | 292 | b->major_mode_ = val; |
| 293 | } | 293 | } |
| 294 | static void | 294 | static void |
| 295 | bset_minor_modes (struct buffer *b, Lisp_Object val) | ||
| 296 | { | ||
| 297 | b->minor_modes_ = val; | ||
| 298 | } | ||
| 299 | static void | ||
| 295 | bset_mark (struct buffer *b, Lisp_Object val) | 300 | bset_mark (struct buffer *b, Lisp_Object val) |
| 296 | { | 301 | { |
| 297 | b->mark_ = val; | 302 | b->mark_ = val; |
| @@ -893,6 +898,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 893 | bset_file_truename (b, Qnil); | 898 | bset_file_truename (b, Qnil); |
| 894 | bset_display_count (b, make_fixnum (0)); | 899 | bset_display_count (b, make_fixnum (0)); |
| 895 | bset_backed_up (b, Qnil); | 900 | bset_backed_up (b, Qnil); |
| 901 | bset_minor_modes (b, Qnil); | ||
| 896 | bset_auto_save_file_name (b, Qnil); | 902 | bset_auto_save_file_name (b, Qnil); |
| 897 | set_buffer_internal_1 (b); | 903 | set_buffer_internal_1 (b); |
| 898 | Fset (intern ("buffer-save-without-query"), Qnil); | 904 | Fset (intern ("buffer-save-without-query"), Qnil); |
| @@ -967,6 +973,7 @@ reset_buffer (register struct buffer *b) | |||
| 967 | b->clip_changed = 0; | 973 | b->clip_changed = 0; |
| 968 | b->prevent_redisplay_optimizations_p = 1; | 974 | b->prevent_redisplay_optimizations_p = 1; |
| 969 | bset_backed_up (b, Qnil); | 975 | bset_backed_up (b, Qnil); |
| 976 | bset_minor_modes (b, Qnil); | ||
| 970 | BUF_AUTOSAVE_MODIFF (b) = 0; | 977 | BUF_AUTOSAVE_MODIFF (b) = 0; |
| 971 | b->auto_save_failure_time = 0; | 978 | b->auto_save_failure_time = 0; |
| 972 | bset_auto_save_file_name (b, Qnil); | 979 | bset_auto_save_file_name (b, Qnil); |
| @@ -5151,6 +5158,7 @@ init_buffer_once (void) | |||
| 5151 | bset_auto_save_file_name (&buffer_local_flags, make_fixnum (-1)); | 5158 | bset_auto_save_file_name (&buffer_local_flags, make_fixnum (-1)); |
| 5152 | bset_read_only (&buffer_local_flags, make_fixnum (-1)); | 5159 | bset_read_only (&buffer_local_flags, make_fixnum (-1)); |
| 5153 | bset_major_mode (&buffer_local_flags, make_fixnum (-1)); | 5160 | bset_major_mode (&buffer_local_flags, make_fixnum (-1)); |
| 5161 | bset_minor_modes (&buffer_local_flags, make_fixnum (-1)); | ||
| 5154 | bset_mode_name (&buffer_local_flags, make_fixnum (-1)); | 5162 | bset_mode_name (&buffer_local_flags, make_fixnum (-1)); |
| 5155 | bset_undo_list (&buffer_local_flags, make_fixnum (-1)); | 5163 | bset_undo_list (&buffer_local_flags, make_fixnum (-1)); |
| 5156 | bset_mark_active (&buffer_local_flags, make_fixnum (-1)); | 5164 | bset_mark_active (&buffer_local_flags, make_fixnum (-1)); |
| @@ -5617,6 +5625,11 @@ The default value (normally `fundamental-mode') affects new buffers. | |||
| 5617 | A value of nil means to use the current buffer's major mode, provided | 5625 | A value of nil means to use the current buffer's major mode, provided |
| 5618 | it is not marked as "special". */); | 5626 | it is not marked as "special". */); |
| 5619 | 5627 | ||
| 5628 | DEFVAR_PER_BUFFER ("minor-modes", &BVAR (current_buffer, minor_modes), | ||
| 5629 | Qnil, | ||
| 5630 | doc: /* Minor modes currently active in the current buffer. | ||
| 5631 | This is a list of symbols, or nil if there are no minor modes active. */); | ||
| 5632 | |||
| 5620 | DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name), | 5633 | DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name), |
| 5621 | Qnil, | 5634 | Qnil, |
| 5622 | doc: /* Pretty name of current buffer's major mode. | 5635 | doc: /* Pretty name of current buffer's major mode. |
diff --git a/src/buffer.h b/src/buffer.h index 790291f1185..0668d16608b 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -338,6 +338,9 @@ struct buffer | |||
| 338 | /* Symbol naming major mode (e.g., lisp-mode). */ | 338 | /* Symbol naming major mode (e.g., lisp-mode). */ |
| 339 | Lisp_Object major_mode_; | 339 | Lisp_Object major_mode_; |
| 340 | 340 | ||
| 341 | /* Symbol listing all currently enabled minor modes. */ | ||
| 342 | Lisp_Object minor_modes_; | ||
| 343 | |||
| 341 | /* Pretty name of major mode (e.g., "Lisp"). */ | 344 | /* Pretty name of major mode (e.g., "Lisp"). */ |
| 342 | Lisp_Object mode_name_; | 345 | Lisp_Object mode_name_; |
| 343 | 346 | ||