From 5819f4fb0a9337fab4c32dac557a02ec6497bce5 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sun, 18 Apr 2021 09:51:32 +0200 Subject: Avoid selecting tooltip windows and frames (Bug#47207) * src/frame.c (do_switch_frame): Don't switch to a tooltip frame. (Fselect_frame): Do not select a tooltip frame. * src/w32fns.c (Fx_show_tip): * src/xfns.c (Fx_show_tip): Set the tooltip window's `no-other-window' parameter so `other-window' will skip it. * src/window.c (select_window): Do not select a tooltip window. (candidate_window_p): Make sure MINIBUF is live. (decode_next_window_args): Make sure that W's frame's minibuffer window is live before including it. (Qno_other_window): New symbol. --- src/frame.c | 15 +++++++++++++-- src/w32fns.c | 2 ++ src/window.c | 36 +++++++++++++++++++++++------------- src/xfns.c | 2 ++ 4 files changed, 40 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/frame.c b/src/frame.c index 028a45afeb7..097cd555c64 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1384,7 +1384,8 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor especially when deleting the initial frame during startup. */ CHECK_FRAME (frame); f = XFRAME (frame); - if (!FRAME_LIVE_P (f)) + /* Silently ignore dead and tooltip frames (Bug#47207). */ + if (!FRAME_LIVE_P (f) || FRAME_TOOLTIP_P (f)) return Qnil; else if (f == sf) return frame; @@ -1508,7 +1509,16 @@ redisplay will display FRAME. This function returns FRAME, or nil if FRAME has been deleted. */) (Lisp_Object frame, Lisp_Object norecord) { - return do_switch_frame (frame, 1, 0, norecord); + struct frame *f; + + CHECK_LIVE_FRAME (frame); + f = XFRAME (frame); + + if (FRAME_TOOLTIP_P (f)) + /* Do not select a tooltip frame (Bug#47207). */ + error ("Cannot select a tooltip frame"); + else + return do_switch_frame (frame, 1, 0, norecord); } DEFUN ("handle-switch-frame", Fhandle_switch_frame, @@ -1523,6 +1533,7 @@ necessarily represent user-visible input focus. */) /* Preserve prefix arg that the command loop just cleared. */ kset_prefix_arg (current_kboard, Vcurrent_prefix_arg); run_hook (Qmouse_leave_buffer_hook); + return do_switch_frame (event, 0, 0, Qnil); } diff --git a/src/w32fns.c b/src/w32fns.c index 9db367bfafe..c07f32ab0cc 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -7434,6 +7434,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, set_window_buffer (window, tip_buf, false, false); w = XWINDOW (window); w->pseudo_window_p = true; + /* Try to avoid that `other-window' select us (Bug#47207). */ + Fset_window_parameter (window, Qno_other_window, Qt); /* Set up the frame's root window. Note: The following code does not try to size the window or its frame correctly. Its only purpose is diff --git a/src/window.c b/src/window.c index 7c238a33fcb..9a49032ba8a 100644 --- a/src/window.c +++ b/src/window.c @@ -504,10 +504,18 @@ select_window (Lisp_Object window, Lisp_Object norecord, { struct window *w; struct frame *sf; + Lisp_Object frame; + struct frame *f; CHECK_LIVE_WINDOW (window); w = XWINDOW (window); + frame = WINDOW_FRAME (w); + f = XFRAME (frame); + + if (FRAME_TOOLTIP_P (f)) + /* Do not select a tooltip window (Bug#47207). */ + error ("Cannot select a tooltip window"); /* Make the selected window's buffer current. */ Fset_buffer (w->contents); @@ -528,14 +536,14 @@ select_window (Lisp_Object window, Lisp_Object norecord, redisplay_other_windows (); sf = SELECTED_FRAME (); - if (XFRAME (WINDOW_FRAME (w)) != sf) + if (f != sf) { - fset_selected_window (XFRAME (WINDOW_FRAME (w)), window); + fset_selected_window (f, window); /* Use this rather than Fhandle_switch_frame so that FRAME_FOCUS_FRAME is moved appropriately as we move around in the state where a minibuffer in a separate frame is active. */ - Fselect_frame (WINDOW_FRAME (w), norecord); + Fselect_frame (frame, norecord); /* Fselect_frame called us back so we've done all the work already. */ eassert (EQ (window, selected_window)); return window; @@ -2596,7 +2604,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, candidate_p = false; else if (MINI_WINDOW_P (w) && (EQ (minibuf, Qlambda) - || (WINDOWP (minibuf) && !EQ (minibuf, window)))) + || (WINDOW_LIVE_P (minibuf) && !EQ (minibuf, window)))) { /* If MINIBUF is `lambda' don't consider any mini-windows. If it is a window, consider only that one. */ @@ -2659,12 +2667,12 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object Lisp_Object miniwin = XFRAME (w->frame)->minibuffer_window; XSETWINDOW (*window, w); - /* MINIBUF nil may or may not include minibuffers. Decide if it - does. */ - if (NILP (*minibuf)) - *minibuf = this_minibuffer_depth (XWINDOW (miniwin)->contents) - ? miniwin - : Qlambda; + /* MINIBUF nil may or may not include minibuffer windows. Decide if + it does. But first make sure that this frame's minibuffer window + is live (Bug#47207). */ + if (WINDOW_LIVE_P (miniwin) && NILP (*minibuf)) + *minibuf = (this_minibuffer_depth (XWINDOW (miniwin)->contents) + ? miniwin : Qlambda); else if (!EQ (*minibuf, Qt)) *minibuf = Qlambda; @@ -2675,9 +2683,10 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object /* ALL_FRAMES nil doesn't specify which frames to include. */ if (NILP (*all_frames)) *all_frames - = (!EQ (*minibuf, Qlambda) - ? FRAME_MINIBUF_WINDOW (XFRAME (w->frame)) - : Qnil); + /* Once more make sure that this frame's minibuffer window is live + before including it (Bug#47207). */ + = ((WINDOW_LIVE_P (miniwin) && !EQ (*minibuf, Qlambda)) + ? miniwin : Qnil); else if (EQ (*all_frames, Qvisible)) ; else if (EQ (*all_frames, make_fixnum (0))) @@ -8232,6 +8241,7 @@ syms_of_window (void) DEFSYM (Qmode_line_format, "mode-line-format"); DEFSYM (Qheader_line_format, "header-line-format"); DEFSYM (Qtab_line_format, "tab-line-format"); + DEFSYM (Qno_other_window, "no-other-window"); DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function, doc: /* Non-nil means call as function to display a help buffer. diff --git a/src/xfns.c b/src/xfns.c index 0507dc8f61d..f120653ee7b 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -7076,6 +7076,8 @@ Text larger than the specified size is clipped. */) set_window_buffer (window, tip_buf, false, false); w = XWINDOW (window); w->pseudo_window_p = true; + /* Try to avoid that `other-window' select us (Bug#47207). */ + Fset_window_parameter (window, Qno_other_window, Qt); /* Set up the frame's root window. Note: The following code does not try to size the window or its frame correctly. Its only purpose is -- cgit v1.2.1 From 077dae3b4ca6a534a0c8061f7b5cf81639e39c3b Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Mon, 19 Apr 2021 08:20:50 +0200 Subject: completing-read: If HIST is the symbol `t', history is not recorded. * lisp/minibuffer.el (completion-all-sorted-completions): Check if `minibuffer-history-variable` is `t` * src/minibuf.c (completing-read): Update docstring * doc/lispref/minibuf.texi: Update documentation of `read-from-minibuffer` and `completing-read` --- src/minibuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/minibuf.c b/src/minibuf.c index a3c1b99bf32..f0258172766 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2023,7 +2023,8 @@ HIST, if non-nil, specifies a history list and optionally the initial (This is the only case in which you should use INITIAL-INPUT instead of DEF.) Positions are counted starting from 1 at the beginning of the list. The variable `history-length' controls the maximum length - of a history list. + of a history list. If HIST is the symbol `t', history is not + recorded. DEF, if non-nil, is the default value or the list of default values. -- cgit v1.2.1 From 55db25b2579e5d84dfcf3a15957fc7a827abf25f Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Tue, 20 Apr 2021 10:14:40 +0000 Subject: 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. --- src/minibuf.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') 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, in previous recursive minibuffer, but was not set explicitly to t for this invocation, so set it to nil in this minibuffer. Save the old value now, before we change it. */ - specbind (intern ("minibuffer-completing-file-name"), + specbind (Qminibuffer_completing_file_name, Vminibuffer_completing_file_name); if (EQ (Vminibuffer_completing_file_name, Qlambda)) Vminibuffer_completing_file_name = Qnil; @@ -920,13 +920,13 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, && !EQ (XWINDOW (XFRAME (calling_frame)->minibuffer_window) ->frame, calling_frame)))) - call2 (intern ("select-frame-set-input-focus"), calling_frame, Qnil); + call2 (Qselect_frame_set_input_focus, calling_frame, Qnil); /* Add the value to the appropriate history list, if any. This is done after the previous buffer has been made current again, in case the history variable is buffer-local. */ if (! (NILP (Vhistory_add_new_input) || NILP (histstring))) - call2 (intern ("add-to-history"), histvar, histstring); + call2 (Qadd_to_history, histvar, histstring); /* If Lisp form desired instead of string, parse it. */ if (expflag) @@ -965,13 +965,13 @@ set_minibuffer_mode (Lisp_Object buf, EMACS_INT depth) Fset_buffer (buf); if (depth > 0) { - if (!NILP (Ffboundp (intern ("fundamental-mode")))) - call0 (intern ("fundamental-mode")); + if (!NILP (Ffboundp (Qminibuffer_mode))) + call0 (Qminibuffer_mode); } else { - if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode")))) - call0 (intern ("minibuffer-inactive-mode")); + if (!NILP (Ffboundp (Qminibuffer_inactive_mode))) + call0 (Qminibuffer_inactive_mode); else Fkill_all_local_variables (); } @@ -1163,7 +1163,7 @@ read_minibuf_unwind (void) dead, we may keep displaying this buffer (tho it's inactive), so reset it, to make sure we don't leave around bindings and stuff which only made sense during the read_minibuf invocation. */ - call0 (intern ("minibuffer-inactive-mode")); + call0 (Qminibuffer_inactive_mode); /* We've exited the recursive edit, so switch the current windows away from the expired minibuffer window, both in the current @@ -2333,6 +2333,12 @@ syms_of_minibuf (void) /* A frame parameter. */ DEFSYM (Qminibuffer_exit, "minibuffer-exit"); + DEFSYM (Qminibuffer_mode, "minibuffer-mode"); + DEFSYM (Qminibuffer_inactive_mode, "minibuffer-inactive-mode"); + DEFSYM (Qminibuffer_completing_file_name, "minibuffer-completing-file-name"); + DEFSYM (Qselect_frame_set_input_focus, "select-frame-set-input-focus"); + DEFSYM (Qadd_to_history, "add-to-history"); + DEFVAR_LISP ("read-expression-history", Vread_expression_history, doc: /* A history list for arguments that are Lisp expressions to evaluate. For example, `eval-expression' uses this. */); -- cgit v1.2.1 From 4e907fa3295e1d3ce2220a2bb9bd984afdec740a Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Tue, 20 Apr 2021 10:53:02 +0000 Subject: Fix bug #47781: (window-list-1 nil t) wrongly returned nil. * src/window.c (candidate_window_p): In the WINDOW_P (all_frames) branch of the conditional, insert "EQ (minibuf, Qt)" in the requisite place. --- src/window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/window.c b/src/window.c index 9a49032ba8a..a22fab24441 100644 --- a/src/window.c +++ b/src/window.c @@ -2648,7 +2648,8 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, candidate_p = ((EQ (XWINDOW (all_frames)->frame, w->frame) || (EQ (f->minibuffer_window, all_frames) && EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f)))) - && !is_minibuffer (0, XWINDOW (all_frames)->contents)); + && (EQ (minibuf, Qt) + || !is_minibuffer (0, XWINDOW (all_frames)->contents))); else if (FRAMEP (all_frames)) candidate_p = EQ (all_frames, w->frame); -- cgit v1.2.1 From efbc07ab57c403bb20958132c63f44dad91f55a0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 20 Apr 2021 08:51:44 -0400 Subject: * src/minibuf.c (read_minibuf): Change multibyte more safely We used to `bset_enable_multibyte_characters` while the buffer is not empty, putting the buffer temporarily in an inconsistent state. Further simplifications along the way: Prefer re-using local var `histvar` and let `insert` do the unibyte<->multibyte conversion if needed. --- src/minibuf.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/minibuf.c b/src/minibuf.c index b823224a5f2..89d9357b4ed 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -728,10 +728,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, Vminibuffer_completing_file_name = Qlambda; /* If variable is unbound, make it nil. */ - histval = find_symbol_value (Vminibuffer_history_variable); + histval = find_symbol_value (histvar); if (EQ (histval, Qunbound)) { - Fset (Vminibuffer_history_variable, Qnil); + Fset (histvar, Qnil); histval = Qnil; } @@ -753,10 +753,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, not work correctly in minibuffers. (Bug#5715, etc) */ bset_truncate_lines (current_buffer, Qnil); - /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ - if (inherit_input_method) - bset_enable_multibyte_characters (current_buffer, enable_multibyte); - /* The current buffer's default directory is usually the right thing for our minibuffer here. However, if you're typing a command at a minibuffer-only frame when minibuf_level is zero, then buf IS @@ -808,9 +804,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); - if (!NILP (BVAR (current_buffer, enable_multibyte_characters)) - && ! STRING_MULTIBYTE (minibuf_prompt)) - minibuf_prompt = Fstring_make_multibyte (minibuf_prompt); + /* If appropriate, copy enable-multibyte-characters into the minibuffer. + In any case don't blindly inherit the multibyteness used previously. */ + bset_enable_multibyte_characters (current_buffer, + inherit_input_method ? enable_multibyte + : Qt); /* Insert the prompt, record where it ends. */ Finsert (1, &minibuf_prompt); -- cgit v1.2.1 From 3e93c2e5ae48e8595e80b1fb69955c2e051ca004 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 20 Apr 2021 10:36:48 -0400 Subject: * src/minibuf.c (Fread_no_blanks_input): Move to `minibuffer.el` * src/keymap.c (syms_of_keymap): * lisp/minibuffer.el (minibuffer-local-ns-map): Move declaration to initialization. (read-no-blanks-input): Move from `minibuf.c`. --- src/keymap.c | 6 ------ src/minibuf.c | 25 ------------------------- 2 files changed, 31 deletions(-) (limited to 'src') diff --git a/src/keymap.c b/src/keymap.c index bb26b6389d4..fb8eceaec18 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -3148,12 +3148,6 @@ syms_of_keymap (void) doc: /* Default keymap to use when reading from the minibuffer. */); Vminibuffer_local_map = Fmake_sparse_keymap (Qnil); - DEFVAR_LISP ("minibuffer-local-ns-map", Vminibuffer_local_ns_map, - doc: /* Local keymap for the minibuffer when spaces are not allowed. */); - Vminibuffer_local_ns_map = Fmake_sparse_keymap (Qnil); - Fset_keymap_parent (Vminibuffer_local_ns_map, Vminibuffer_local_map); - - DEFVAR_LISP ("minor-mode-map-alist", Vminor_mode_map_alist, doc: /* Alist of keymaps to use for minor modes. Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read diff --git a/src/minibuf.c b/src/minibuf.c index 89d9357b4ed..1a637c86ade 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1360,30 +1360,6 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits return unbind_to (count, val); } -DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1, 3, 0, - doc: /* Read a string from the terminal, not allowing blanks. -Prompt with PROMPT. Whitespace terminates the input. If INITIAL is -non-nil, it should be a string, which is used as initial input, with -point positioned at the end, so that SPACE will accept the input. -\(Actually, INITIAL can also be a cons of a string and an integer. -Such values are treated as in `read-from-minibuffer', but are normally -not useful in this function.) - -Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits -the current input method and the setting of`enable-multibyte-characters'. - -If `inhibit-interaction' is non-nil, this function will signal an -`inhibited-interaction' error. */) - (Lisp_Object prompt, Lisp_Object initial, Lisp_Object inherit_input_method) -{ - CHECK_STRING (prompt); - barf_if_interaction_inhibited (); - - return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, - 0, Qminibuffer_history, make_fixnum (0), Qnil, 0, - !NILP (inherit_input_method)); -} - DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, doc: /* Read the name of a command and return as a symbol. Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element @@ -2517,7 +2493,6 @@ instead. */); defsubr (&Sread_variable); defsubr (&Sinternal_complete_buffer); defsubr (&Sread_buffer); - defsubr (&Sread_no_blanks_input); defsubr (&Sminibuffer_depth); defsubr (&Sminibuffer_prompt); -- cgit v1.2.1 From 7792f7b3f3cdc40cf8636096fd5966eecebad1b5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 22 Apr 2021 13:59:08 +0300 Subject: Fix 'window-text-pixel-size' when there's after-string at EOB * src/xdisp.c (move_it_to): Fix logic of reaching TO_CHARPOS when there's a display or overlay string(s) at EOB. (Bug#47860) --- src/xdisp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xdisp.c b/src/xdisp.c index 8ffec93e45d..7a89089958f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10064,8 +10064,20 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos if ((op & MOVE_TO_POS) != 0 && (IT_CHARPOS (*it) > to_charpos || (IT_CHARPOS (*it) == to_charpos + /* Consider TO_CHARPOS as REACHED if we are at + EOB that ends in something other than a newline. */ && to_charpos == ZV - && (ZV_BYTE <= 1 || FETCH_BYTE (ZV_BYTE - 1) != '\n')))) + && (ZV_BYTE <= 1 || FETCH_BYTE (ZV_BYTE - 1) != '\n') + /* But if we have a display or an overlay string + at EOB, keep going until we exhaust all the + characters of the string(s). */ + && (it->sp == 0 + || (STRINGP (it->string) + && (it->current.overlay_string_index < 0 + || (it->current.overlay_string_index >= 0 + && it->current.overlay_string_index + >= it->n_overlay_strings - 1)) + && IT_STRING_CHARPOS (*it) >= it->end_charpos))))) { reached = 9; goto out; -- cgit v1.2.1 From 846989498b66f94739e78ca274c8d1176c137591 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 22 Apr 2021 12:07:21 +0000 Subject: Fix unclean "can't happen" error handling in read_minibuf_unwind Also fix a bug where, with minibuffer-follows-selected-frame neither nil nor t, a minibuffer could appear in two frames at the same time. * src/window.c (Fset_window_configuration): Add a new &optional parameter DONT-SET-MINIWINDOW, which inhibits the minibuffer from being restored from the supplied window configuration. (restore_window_configuration): Enhance to match the above. * src/minibuf.c (read_minibuf): Enhance the argument list to the restore_window_configuration calls to match the above. In the main case, restoring the minibuffer is inhibited. (read_minibuf_unwind): Should the frame with the expired minibuffer not be found ("can't happen"), unwind the stacked data nevertheless, rather than just exiting. * src/keyboard.c (read_char_help_form_unwind): Amend a call of Fset_window_configuration. * doc/lispref/windows.texi (Window Configurations): Document the new form of set-window-configuration. * etc/NEWS (Lisp Changes in Emacs 28.1): Amend the entry for set-window-configuration. --- src/keyboard.c | 2 +- src/minibuf.c | 21 ++++++++++----------- src/window.c | 21 ++++++++++++++------- 3 files changed, 25 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/keyboard.c b/src/keyboard.c index 266ebaa5fdf..5db45ce8e57 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2121,7 +2121,7 @@ read_char_help_form_unwind (void) Lisp_Object window_config = XCAR (help_form_saved_window_configs); help_form_saved_window_configs = XCDR (help_form_saved_window_configs); if (!NILP (window_config)) - Fset_window_configuration (window_config, Qnil); + Fset_window_configuration (window_config, Qnil, Qnil); } #define STOP_POLLING \ diff --git a/src/minibuf.c b/src/minibuf.c index 1a637c86ade..c4482d7f1ee 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -660,17 +660,14 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, record_unwind_protect_void (minibuffer_unwind); record_unwind_protect (restore_window_configuration, - Fcons (Qt, Fcurrent_window_configuration (Qnil))); + list3 (Fcurrent_window_configuration (Qnil), Qt, Qt)); /* If the minibuffer window is on a different frame, save that frame's configuration too. */ if (!EQ (mini_frame, selected_frame)) record_unwind_protect (restore_window_configuration, - Fcons (/* Arrange for the frame later to be - switched back to the calling - frame. */ - Qnil, - Fcurrent_window_configuration (mini_frame))); + list3 (Fcurrent_window_configuration (mini_frame), + Qnil, Qt)); /* If the minibuffer is on an iconified or invisible frame, make it visible now. */ @@ -1069,13 +1066,13 @@ read_minibuf_unwind (void) goto found; } } - return; /* expired minibuffer not found. Maybe we should output an - error, here. */ + exp_MB_frame = Qnil; /* "Can't happen." */ found: - if (!EQ (exp_MB_frame, saved_selected_frame)) + if (!EQ (exp_MB_frame, saved_selected_frame) + && !NILP (exp_MB_frame)) do_switch_frame (exp_MB_frame, 0, 0, Qt); /* This also sets - minibuff_window */ + minibuf_window */ /* To keep things predictable, in case it matters, let's be in the minibuffer when we reset the relevant variables. Don't depend on @@ -1185,7 +1182,8 @@ read_minibuf_unwind (void) } /* Restore the selected frame. */ - if (!EQ (exp_MB_frame, saved_selected_frame)) + if (!EQ (exp_MB_frame, saved_selected_frame) + && !NILP (exp_MB_frame)) do_switch_frame (saved_selected_frame, 0, 0, Qt); } @@ -1200,6 +1198,7 @@ minibuffer_unwind (void) Lisp_Object window; Lisp_Object entry; + if (NILP (exp_MB_frame)) return; /* "Can't happen." */ f = XFRAME (exp_MB_frame); window = f->minibuffer_window; w = XWINDOW (window); diff --git a/src/window.c b/src/window.c index a22fab24441..5134c3df63d 100644 --- a/src/window.c +++ b/src/window.c @@ -6881,19 +6881,22 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config } DEFUN ("set-window-configuration", Fset_window_configuration, - Sset_window_configuration, 1, 2, 0, + Sset_window_configuration, 1, 3, 0, doc: /* Set the configuration of windows and buffers as specified by CONFIGURATION. CONFIGURATION must be a value previously returned by `current-window-configuration' (which see). Normally, this function selects the frame of the CONFIGURATION, but if DONT-SET-FRAME is non-nil, it leaves selected the frame which was -current at the start of the function. +current at the start of the function. If DONT-SET-MINIWINDOW is non-nil, +the mini-window of the frame doesn't get set to the corresponding element +of CONFIGURATION. If CONFIGURATION was made from a frame that is now deleted, only frame-independent values can be restored. In this case, the return value is nil. Otherwise the value is t. */) - (Lisp_Object configuration, Lisp_Object dont_set_frame) + (Lisp_Object configuration, Lisp_Object dont_set_frame, + Lisp_Object dont_set_miniwindow) { register struct save_window_data *data; struct Lisp_Vector *saved_windows; @@ -7104,8 +7107,10 @@ the return value is nil. Otherwise the value is t. */) } } - if (BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) - /* If saved buffer is alive, install it. */ + if ((NILP (dont_set_miniwindow) || !MINI_WINDOW_P (w)) + && BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) + /* If saved buffer is alive, install it, unless it's a + minibuffer we explicitly prohibit. */ { wset_buffer (w, p->buffer); w->start_at_line_beg = !NILP (p->start_at_line_beg); @@ -7258,9 +7263,11 @@ void restore_window_configuration (Lisp_Object configuration) { if (CONSP (configuration)) - Fset_window_configuration (XCDR (configuration), XCAR (configuration)); + Fset_window_configuration (XCAR (configuration), + XCAR (XCDR (configuration)), + XCAR (XCDR (XCDR (configuration)))); else - Fset_window_configuration (configuration, Qnil); + Fset_window_configuration (configuration, Qnil, Qnil); } -- cgit v1.2.1 From 2c2dfbbbf052353d3d64109e9b7e3d9b247d1e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Tue, 21 Apr 2020 10:51:45 +0200 Subject: ; Fix some typos in doc strings and manuals --- src/character.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/character.h b/src/character.h index d19e1e2604c..75351cd1edf 100644 --- a/src/character.h +++ b/src/character.h @@ -42,7 +42,7 @@ INLINE_HEADER_BEGIN F9..FF 11111yyy In each bit pattern, 'x' and 'y' each represent a single bit of the - character code payload, and least one 'y' must be a 1 bit. + character code payload, and at least one 'y' must be a 1 bit. In the 5-byte sequence, the 22-bit payload cannot exceed 3FFF7F. */ -- cgit v1.2.1