diff options
| author | Alan Mackenzie | 2021-04-20 10:14:40 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2021-04-20 10:14:40 +0000 |
| commit | 55db25b2579e5d84dfcf3a15957fc7a827abf25f (patch) | |
| tree | fb6e10d4f8cc64ded0af807b8c6384a99b4392fc /src | |
| parent | 296ef2e99b7cd83ad236230ddc941c7dbc8766e6 (diff) | |
| download | emacs-55db25b2579e5d84dfcf3a15957fc7a827abf25f.tar.gz emacs-55db25b2579e5d84dfcf3a15957fc7a827abf25f.zip | |
Introduce and use minibuffer-mode. This fixes bug #47150
* lisp/minibuffer.el (minibuffer-mode): New derived mode.
* src/minibuf.c (syms_of_minibuf): New DEFSYMs Qminibuffer_mode,
Qminibuffer_inactive_mode, Qminibuffer_completing_file_name,
Qselect_frame_set_input_focus, Qadd_to_history.
(read_minibuf, set_minibuffer_mode, read_minibuf_unwind): Use the new DEFSYMs
in place of continual interning.
(set_minibuffer_mode): Put an active minibuffer into minibuffer-mode rather
than fundamental-mode.
* doc/emacs/mini.texi (Minibuffer Edit): Mention minibuffer-mode.
* doc/lispref/minibuf.texi (Intro to Minibuffers): Add a paragraph about
minibuffer-mode.
* etc/NEWS (Incompatible Lisp Changes in Emacs 28.1): Add an entry.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index f0258172766..b823224a5f2 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -567,7 +567,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 567 | in previous recursive minibuffer, but was not set explicitly | 567 | in previous recursive minibuffer, but was not set explicitly |
| 568 | to t for this invocation, so set it to nil in this minibuffer. | 568 | to t for this invocation, so set it to nil in this minibuffer. |
| 569 | Save the old value now, before we change it. */ | 569 | Save the old value now, before we change it. */ |
| 570 | specbind (intern ("minibuffer-completing-file-name"), | 570 | specbind (Qminibuffer_completing_file_name, |
| 571 | Vminibuffer_completing_file_name); | 571 | Vminibuffer_completing_file_name); |
| 572 | if (EQ (Vminibuffer_completing_file_name, Qlambda)) | 572 | if (EQ (Vminibuffer_completing_file_name, Qlambda)) |
| 573 | Vminibuffer_completing_file_name = Qnil; | 573 | Vminibuffer_completing_file_name = Qnil; |
| @@ -920,13 +920,13 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 920 | && !EQ (XWINDOW (XFRAME (calling_frame)->minibuffer_window) | 920 | && !EQ (XWINDOW (XFRAME (calling_frame)->minibuffer_window) |
| 921 | ->frame, | 921 | ->frame, |
| 922 | calling_frame)))) | 922 | calling_frame)))) |
| 923 | call2 (intern ("select-frame-set-input-focus"), calling_frame, Qnil); | 923 | call2 (Qselect_frame_set_input_focus, calling_frame, Qnil); |
| 924 | 924 | ||
| 925 | /* Add the value to the appropriate history list, if any. This is | 925 | /* Add the value to the appropriate history list, if any. This is |
| 926 | done after the previous buffer has been made current again, in | 926 | done after the previous buffer has been made current again, in |
| 927 | case the history variable is buffer-local. */ | 927 | case the history variable is buffer-local. */ |
| 928 | if (! (NILP (Vhistory_add_new_input) || NILP (histstring))) | 928 | if (! (NILP (Vhistory_add_new_input) || NILP (histstring))) |
| 929 | call2 (intern ("add-to-history"), histvar, histstring); | 929 | call2 (Qadd_to_history, histvar, histstring); |
| 930 | 930 | ||
| 931 | /* If Lisp form desired instead of string, parse it. */ | 931 | /* If Lisp form desired instead of string, parse it. */ |
| 932 | if (expflag) | 932 | if (expflag) |
| @@ -965,13 +965,13 @@ set_minibuffer_mode (Lisp_Object buf, EMACS_INT depth) | |||
| 965 | Fset_buffer (buf); | 965 | Fset_buffer (buf); |
| 966 | if (depth > 0) | 966 | if (depth > 0) |
| 967 | { | 967 | { |
| 968 | if (!NILP (Ffboundp (intern ("fundamental-mode")))) | 968 | if (!NILP (Ffboundp (Qminibuffer_mode))) |
| 969 | call0 (intern ("fundamental-mode")); | 969 | call0 (Qminibuffer_mode); |
| 970 | } | 970 | } |
| 971 | else | 971 | else |
| 972 | { | 972 | { |
| 973 | if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode")))) | 973 | if (!NILP (Ffboundp (Qminibuffer_inactive_mode))) |
| 974 | call0 (intern ("minibuffer-inactive-mode")); | 974 | call0 (Qminibuffer_inactive_mode); |
| 975 | else | 975 | else |
| 976 | Fkill_all_local_variables (); | 976 | Fkill_all_local_variables (); |
| 977 | } | 977 | } |
| @@ -1163,7 +1163,7 @@ read_minibuf_unwind (void) | |||
| 1163 | dead, we may keep displaying this buffer (tho it's inactive), so reset it, | 1163 | dead, we may keep displaying this buffer (tho it's inactive), so reset it, |
| 1164 | to make sure we don't leave around bindings and stuff which only | 1164 | to make sure we don't leave around bindings and stuff which only |
| 1165 | made sense during the read_minibuf invocation. */ | 1165 | made sense during the read_minibuf invocation. */ |
| 1166 | call0 (intern ("minibuffer-inactive-mode")); | 1166 | call0 (Qminibuffer_inactive_mode); |
| 1167 | 1167 | ||
| 1168 | /* We've exited the recursive edit, so switch the current windows | 1168 | /* We've exited the recursive edit, so switch the current windows |
| 1169 | away from the expired minibuffer window, both in the current | 1169 | away from the expired minibuffer window, both in the current |
| @@ -2333,6 +2333,12 @@ syms_of_minibuf (void) | |||
| 2333 | /* A frame parameter. */ | 2333 | /* A frame parameter. */ |
| 2334 | DEFSYM (Qminibuffer_exit, "minibuffer-exit"); | 2334 | DEFSYM (Qminibuffer_exit, "minibuffer-exit"); |
| 2335 | 2335 | ||
| 2336 | DEFSYM (Qminibuffer_mode, "minibuffer-mode"); | ||
| 2337 | DEFSYM (Qminibuffer_inactive_mode, "minibuffer-inactive-mode"); | ||
| 2338 | DEFSYM (Qminibuffer_completing_file_name, "minibuffer-completing-file-name"); | ||
| 2339 | DEFSYM (Qselect_frame_set_input_focus, "select-frame-set-input-focus"); | ||
| 2340 | DEFSYM (Qadd_to_history, "add-to-history"); | ||
| 2341 | |||
| 2336 | DEFVAR_LISP ("read-expression-history", Vread_expression_history, | 2342 | DEFVAR_LISP ("read-expression-history", Vread_expression_history, |
| 2337 | doc: /* A history list for arguments that are Lisp expressions to evaluate. | 2343 | doc: /* A history list for arguments that are Lisp expressions to evaluate. |
| 2338 | For example, `eval-expression' uses this. */); | 2344 | For example, `eval-expression' uses this. */); |