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.
@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
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
*** 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
---
*** 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
+++
*** 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
---
*** 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
---
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
\f
* 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
---
** 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-`'.
-
\f
----------------------------------------------------------------------
This file is part of GNU Emacs.
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 \
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. */
}
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;
USE_SAFE_ALLOCA;
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);
}
FRAME_WINDOW_CHANGE (f) = true;
return FRAME_LIVE_P (f) ? Qt : Qnil;
}
-
void
restore_window_configuration (Lisp_Object configuration)
{
- Fset_window_configuration (configuration);
+ if (CONSP (configuration))
+ Fset_window_configuration (XCDR (configuration), XCAR (configuration));
+ else
+ Fset_window_configuration (configuration, Qnil);
}