Commit 6e469709 authored by Alan Mackenzie's avatar Alan Mackenzie

In attempted recursive minibuffer use, display error message in correct frame

This was problematic when minibuffer-follows-selected-frame was non-nil.
Introduce a new parameter DONT-SET-FRAME to set-window-configuration.

* doc/lispref/windows.texi (Window Configurations): Describe the new &optional
parameter to set-window-configuration.

* etc/NEWS (Lisp Changes): Note the new parameter to set-window-configuration.

* src/keyboard.c (read_char_help_form_unwind): Add a new Qnil argument to the
call of Fset_window_configuration.

* src/minibuf.c (read_minibuf): Cons up a Qt with the window configuration in
the argument to record_unwind_protect for the window configuration (twice).

* src/window.c (Fset_window_configuration): Add the new &optional parameter
and document it in the doc string.  At the final do_switch_frame operation,
restore the original frame when DONT-SET-FRAME is non-nil.
(restore_window_configuration): Handle the new parameter when the supplied
argument is a cons.
parent cb2e34b4
Pipeline #7844 passed with stage
in 65 minutes and 46 seconds
......@@ -5869,13 +5869,16 @@ which window parameters (if any) are saved by this function.
@xref{Window Parameters}.
@end defun
@defun set-window-configuration configuration
@defun set-window-configuration configuration &optional dont-set-frame
This function restores the configuration of windows and buffers as
specified by @var{configuration}, for the frame that
@var{configuration} was created for, regardless of whether that frame
is selected or not. The argument @var{configuration} must be a value
that was previously returned by @code{current-window-configuration}
for that frame.
for that frame. Normally the function also selects the frame which is
recorded in the configuration, but if @var{dont-set-frame} is
non-@code{nil}, it leaves selected the frame which was current at the
start of the function.
If the frame from which @var{configuration} was saved is dead, all
this function does is to restore the value of the variable
......@@ -203,12 +203,6 @@ This command would previously not redefine values defined by these
forms, but this command has now been changed to work more like
'eval-defun', and reset the values as specified.
** New user options 'copy-region-blink-delay' and 'delete-pair-blink-delay'.
'copy-region-blink-delay' specifies a delay to indicate the region
copied by 'kill-ring-save'. 'delete-pair-blink-delay' specifies
a delay to show a paired character to delete.
** New command 'undo-redo'.
It undoes previous undo commands, but doesn't record itself as an
......@@ -441,11 +435,6 @@ their 'default-directory' under VC.
*** New command 'vc-dir-root' uses the root directory without asking.
*** New face 'log-view-commit-body'.
This is used when expanding commit messages from 'vc-print-root-log'
and similar commands.
*** The responsible VC backend is now the most specific one.
'vc-responsible-backend' loops over the backends in
......@@ -669,13 +658,6 @@ to the search string.
*** New input method 'compose' based on X Multi_key sequences.
*** New input method 'iso-transl' with the same keys as 'C-x 8'.
After selecting it as a transient input method with 'C-u C-x \
iso-transl RET', it supports the same key sequences as 'C-x 8',
so e.g. like 'C-x 8 [' inserts a left single quotation mark,
'C-x \ [' does the same.
*** Improved language transliteration in Malayalam input methods.
Added a new Mozhi scheme. The inapplicable ITRANS scheme is now
......@@ -1142,13 +1124,6 @@ project's root directory, respectively.
*** New user option 'project-list-file'.
** xref
*** Prefix arg of 'xref-goto-xref' quits the *xref* buffer.
So typing 'C-u RET' in the *xref* buffer quits its window
before navigating to the selected location.
** json.el
......@@ -1265,11 +1240,6 @@ and the result is not truncated in any way.
*** The '/' operator now has higher precedence in (La)TeX input mode.
It no longer has lower precedence than '+' and '-'.
*** Calc now marks its windows dedicated.
The new user option 'calc-make-windows-dedicated' controls this. It
is t by default; set to nil to get back the old behavior.
** term-mode
......@@ -1346,11 +1316,6 @@ visited errors, so you can have an overview what errors were already visited.
If 'tab-always-indent' is 'complete', this new user option can be used to
further tweak whether to complete or indent.
*** 'dired-query' now uses 'read-char-from-minibuffer'.
Using it instead of 'read-char-choice' allows using 'C-x o'
to switch to the help window displayed after typing 'C-h'.
*** 'zap-up-to-char' now uses 'read-char-from-minibuffer'.
This allows navigating through the history of characters that have
......@@ -1758,6 +1723,11 @@ ledit.el, lmenu.el, lucid.el and old-whitespace.el.
* Lisp Changes in Emacs 28.1
** 'set-window-configuration' now takes an optional 'dont-set-frame'
parameter which, when non-nil, instructs the function not to select
the frame recorded in the configuration.
** 'define-globalized-minor-mode' now takes a ':predicate' parameter.
This can be used to control which major modes the minor mode should be
......@@ -1999,11 +1969,6 @@ image API via 'M-x report-emacs-bug'.
** The user option 'make-pointer-invisible' is now honored on macOS.
** On macOS, 's-<left>' and 's-<right>' are now bound to
'move-beginning-of-line' and 'move-end-of-line' respectively. The commands
to select previous/next frame are still bound to 's-~' and 's-`'.
This file is part of GNU Emacs.
......@@ -2122,7 +2122,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);
Fset_window_configuration (window_config, Qnil);
#define STOP_POLLING \
......@@ -501,14 +501,15 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
record_unwind_protect_void (choose_minibuf_frame);
record_unwind_protect (restore_window_configuration,
Fcurrent_window_configuration (Qnil));
Fcons (Qt, Fcurrent_window_configuration (Qnil)));
/* If the minibuffer window is on a different frame, save that
frame's configuration too. */
mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window));
if (!EQ (mini_frame, selected_frame))
record_unwind_protect (restore_window_configuration,
Fcurrent_window_configuration (mini_frame));
Fcons (Qt,
Fcurrent_window_configuration (mini_frame)));
/* If the minibuffer is on an iconified or invisible frame,
make it visible now. */
......@@ -6824,19 +6824,25 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
DEFUN ("set-window-configuration", Fset_window_configuration,
Sset_window_configuration, 1, 1, 0,
Sset_window_configuration, 1, 2, 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.
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 configuration, Lisp_Object dont_set_frame)
register struct save_window_data *data;
struct Lisp_Vector *saved_windows;
Lisp_Object new_current_buffer;
Lisp_Object frame;
Lisp_Object old_frame = selected_frame;
struct frame *f;
ptrdiff_t old_point = -1;
......@@ -7153,7 +7159,10 @@ the return value is nil. Otherwise the value is t. */)
select_window above totally superfluous; it still sets f's
selected window. */
if (FRAME_LIVE_P (XFRAME (data->selected_frame)))
do_switch_frame (data->selected_frame, 0, 0, Qnil);
do_switch_frame (NILP (dont_set_frame)
? data->selected_frame
: old_frame
, 0, 0, Qnil);
......@@ -7187,11 +7196,13 @@ the return value is nil. Otherwise the value is t. */)
return FRAME_LIVE_P (f) ? Qt : Qnil;
restore_window_configuration (Lisp_Object configuration)
Fset_window_configuration (configuration);
if (CONSP (configuration))
Fset_window_configuration (XCDR (configuration), XCAR (configuration));
Fset_window_configuration (configuration, Qnil);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment