aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mackenzie2020-11-19 10:31:50 +0000
committerAlan Mackenzie2020-11-19 10:31:50 +0000
commit6e469709c550ba18d9d5a34f6bb89908472f0eb2 (patch)
tree7a785ff8f1deb6a7a2704e8a0bf6331dc6e0b70d /src
parentcb2e34b49332cf2664de6fc4a8a79da5965298ed (diff)
downloademacs-6e469709c550ba18d9d5a34f6bb89908472f0eb2.tar.gz
emacs-6e469709c550ba18d9d5a34f6bb89908472f0eb2.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c2
-rw-r--r--src/minibuf.c5
-rw-r--r--src/window.c21
3 files changed, 20 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 49a0a8bd236..1579c007ecf 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2122,7 +2122,7 @@ read_char_help_form_unwind (void)
2122 Lisp_Object window_config = XCAR (help_form_saved_window_configs); 2122 Lisp_Object window_config = XCAR (help_form_saved_window_configs);
2123 help_form_saved_window_configs = XCDR (help_form_saved_window_configs); 2123 help_form_saved_window_configs = XCDR (help_form_saved_window_configs);
2124 if (!NILP (window_config)) 2124 if (!NILP (window_config))
2125 Fset_window_configuration (window_config); 2125 Fset_window_configuration (window_config, Qnil);
2126} 2126}
2127 2127
2128#define STOP_POLLING \ 2128#define STOP_POLLING \
diff --git a/src/minibuf.c b/src/minibuf.c
index c4adca15365..464e3018f7d 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -501,14 +501,15 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
501 record_unwind_protect_void (choose_minibuf_frame); 501 record_unwind_protect_void (choose_minibuf_frame);
502 502
503 record_unwind_protect (restore_window_configuration, 503 record_unwind_protect (restore_window_configuration,
504 Fcurrent_window_configuration (Qnil)); 504 Fcons (Qt, Fcurrent_window_configuration (Qnil)));
505 505
506 /* If the minibuffer window is on a different frame, save that 506 /* If the minibuffer window is on a different frame, save that
507 frame's configuration too. */ 507 frame's configuration too. */
508 mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window)); 508 mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window));
509 if (!EQ (mini_frame, selected_frame)) 509 if (!EQ (mini_frame, selected_frame))
510 record_unwind_protect (restore_window_configuration, 510 record_unwind_protect (restore_window_configuration,
511 Fcurrent_window_configuration (mini_frame)); 511 Fcons (Qt,
512 Fcurrent_window_configuration (mini_frame)));
512 513
513 /* If the minibuffer is on an iconified or invisible frame, 514 /* If the minibuffer is on an iconified or invisible frame,
514 make it visible now. */ 515 make it visible now. */
diff --git a/src/window.c b/src/window.c
index a6de34f3db6..6cd3122b43b 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6824,19 +6824,25 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
6824} 6824}
6825 6825
6826DEFUN ("set-window-configuration", Fset_window_configuration, 6826DEFUN ("set-window-configuration", Fset_window_configuration,
6827 Sset_window_configuration, 1, 1, 0, 6827 Sset_window_configuration, 1, 2, 0,
6828 doc: /* Set the configuration of windows and buffers as specified by CONFIGURATION. 6828 doc: /* Set the configuration of windows and buffers as specified by CONFIGURATION.
6829CONFIGURATION must be a value previously returned 6829CONFIGURATION must be a value previously returned
6830by `current-window-configuration' (which see). 6830by `current-window-configuration' (which see).
6831
6832Normally, this function selects the frame of the CONFIGURATION, but if
6833DONT-SET-FRAME is non-nil, it leaves selected the frame which was
6834current at the start of the function.
6835
6831If CONFIGURATION was made from a frame that is now deleted, 6836If CONFIGURATION was made from a frame that is now deleted,
6832only frame-independent values can be restored. In this case, 6837only frame-independent values can be restored. In this case,
6833the return value is nil. Otherwise the value is t. */) 6838the return value is nil. Otherwise the value is t. */)
6834 (Lisp_Object configuration) 6839 (Lisp_Object configuration, Lisp_Object dont_set_frame)
6835{ 6840{
6836 register struct save_window_data *data; 6841 register struct save_window_data *data;
6837 struct Lisp_Vector *saved_windows; 6842 struct Lisp_Vector *saved_windows;
6838 Lisp_Object new_current_buffer; 6843 Lisp_Object new_current_buffer;
6839 Lisp_Object frame; 6844 Lisp_Object frame;
6845 Lisp_Object old_frame = selected_frame;
6840 struct frame *f; 6846 struct frame *f;
6841 ptrdiff_t old_point = -1; 6847 ptrdiff_t old_point = -1;
6842 USE_SAFE_ALLOCA; 6848 USE_SAFE_ALLOCA;
@@ -7153,7 +7159,10 @@ the return value is nil. Otherwise the value is t. */)
7153 select_window above totally superfluous; it still sets f's 7159 select_window above totally superfluous; it still sets f's
7154 selected window. */ 7160 selected window. */
7155 if (FRAME_LIVE_P (XFRAME (data->selected_frame))) 7161 if (FRAME_LIVE_P (XFRAME (data->selected_frame)))
7156 do_switch_frame (data->selected_frame, 0, 0, Qnil); 7162 do_switch_frame (NILP (dont_set_frame)
7163 ? data->selected_frame
7164 : old_frame
7165 , 0, 0, Qnil);
7157 } 7166 }
7158 7167
7159 FRAME_WINDOW_CHANGE (f) = true; 7168 FRAME_WINDOW_CHANGE (f) = true;
@@ -7187,11 +7196,13 @@ the return value is nil. Otherwise the value is t. */)
7187 return FRAME_LIVE_P (f) ? Qt : Qnil; 7196 return FRAME_LIVE_P (f) ? Qt : Qnil;
7188} 7197}
7189 7198
7190
7191void 7199void
7192restore_window_configuration (Lisp_Object configuration) 7200restore_window_configuration (Lisp_Object configuration)
7193{ 7201{
7194 Fset_window_configuration (configuration); 7202 if (CONSP (configuration))
7203 Fset_window_configuration (XCDR (configuration), XCAR (configuration));
7204 else
7205 Fset_window_configuration (configuration, Qnil);
7195} 7206}
7196 7207
7197 7208