From 3926ebd2e1c4a5eba7941c4b86608443c8e66ebd Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Wed, 26 Jun 2024 20:55:12 +0200 Subject: [PATCH] Remove 'read-minibuffer-restore-windows' --- doc/lispref/minibuf.texi | 12 ------------ lisp/cus-start.el | 1 - lisp/erc/erc-goodies.el | 2 -- lisp/minibuffer.el | 12 ++++++++++++ lisp/tab-bar.el | 16 ---------------- src/minibuf.c | 25 ------------------------- 6 files changed, 12 insertions(+), 56 deletions(-) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 268d5f06693..bd8538ced82 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -420,18 +420,6 @@ Both @var{prompt} and @code{minibuffer-default-prompt-format} are run through @code{substitute-command-keys} (@pxref{Keys in Documentation}). @end defun -@defvar read-minibuffer-restore-windows -If this option is non-@code{nil} (the default), getting input from the -minibuffer will restore, on exit, the window configurations of the frame -where the minibuffer was entered from and, if it is different, the frame -that owns the minibuffer window. This means that if, for example, a -user splits a window while getting input from the minibuffer on the same -frame, that split will be undone when exiting the minibuffer. - -If this option is @code{nil}, no such restorations are done. Hence, the -window split mentioned above will persist after exiting the minibuffer. -@end defvar - @node Object from Minibuffer @section Reading Lisp Objects with the Minibuffer @cindex minibuffer input, reading lisp objects diff --git a/lisp/cus-start.el b/lisp/cus-start.el index b90b35dc8c5..a0034b3a2c0 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -438,7 +438,6 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of "21.1" :set minibuffer-prompt-properties--setter) (minibuffer-auto-raise minibuffer boolean) - (read-minibuffer-restore-windows minibuffer boolean "28.1") ;; options property set at end (read-buffer-function minibuffer (choice (const nil) diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index 9837ec302ee..97c9b264983 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -167,7 +167,6 @@ function used `window-scroll-functions', which was replaced by (if erc-scrolltobottom-mode (if erc-scrolltobottom-all (progn - (setq-local read-minibuffer-restore-windows nil) (when (zerop scroll-conservatively) (setq-local scroll-step 1)) (unless (eq erc-scrolltobottom-all 'relaxed) @@ -180,7 +179,6 @@ function used `window-scroll-functions', which was replaced by (remove-hook 'post-command-hook #'erc--scrolltobottom-on-post-command t) (remove-hook 'window-configuration-change-hook #'erc--scrolltobottom-on-win-conf-change t) - (kill-local-variable 'read-minibuffer-restore-windows) (kill-local-variable 'scroll-step) (kill-local-variable 'erc--scrolltobottom-window-info))) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 62c457deb12..90ee14b4db8 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3447,6 +3447,7 @@ The completion method is determined by `completion-at-point-functions'." (define-key map "\M-<" 'minibuffer-beginning-of-buffer) (define-key map "\C-x\M-k" 'minibuffer-kill-from-history) (define-key map "\C-x\M-h" 'minibuffer-alternate-history) + (define-key map "\C-x\C-w" 'minibuffer-insert-symbol-at-point) (define-key map "\C-xj" 'minibuffer-set-action) (define-key map "\n" 'minibuffer-apply) (define-key map "\r" 'exit-minibuffer)) @@ -5414,6 +5415,14 @@ See `completing-read' for the meaning of the arguments." (when file-name-at-point (insert file-name-at-point)))) +(defun minibuffer-insert-symbol-at-point () + "Get a symbol at point in original buffer and insert it to minibuffer." + (interactive "" minibuffer-mode) + (when-let ((sym (with-current-buffer + (window-buffer (minibuffer-selected-window)) + (thing-at-point 'symbol t)))) + (insert sym))) + (defun minibuffer-beginning-of-buffer (&optional arg) "Move to the logical beginning of the minibuffer. This command behaves like `beginning-of-buffer', but if point is @@ -6127,6 +6136,9 @@ interactions is customizable via `minibuffer-regexp-prompts'." (defvar minibuffer-allow-text-properties nil "Unused obsolete variable.") (make-obsolete-variable 'minibuffer-allow-text-properties nil "30.1") +(defvar read-minibuffer-restore-windows nil "Unused obsolete variable.") +(make-obsolete-variable 'read-minibuffer-restore-windows nil "30.1") + (defcustom minibuffer-auto-completion-idle-time 0.4 "Number for seconds to wait before auto-completion in the minibuffer." :type 'float diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 3401b796cac..2bb55b77552 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1509,17 +1509,6 @@ in the buffer even when the buffer was modified." :group 'tab-bar :version "30.1") -(defvar tab-bar-minibuffer-restore-tab nil - "Tab number for `tab-bar-minibuffer-restore-tab'.") - -(defun tab-bar-minibuffer-restore-tab () - "Switch back to the tab where the minibuffer was activated. -This is necessary to prepare the same window configuration where -original windows were saved and will be restored. This function -is used only when `read-minibuffer-restore-windows' is non-nil." - (when tab-bar-minibuffer-restore-tab - (tab-bar-select-tab tab-bar-minibuffer-restore-tab))) - (defun tab-bar-select-tab (&optional tab-number) "Switch to the tab by its absolute position TAB-NUMBER in the tab bar. When this command is bound to a numeric key (with a key prefix or modifier key @@ -1545,11 +1534,6 @@ Negative TAB-NUMBER counts tabs from the end of the tab bar." (to-index (1- (max 1 (min to-number (length tabs))))) (minibuffer-was-active (minibuffer-window-active-p (selected-window)))) - (when (and read-minibuffer-restore-windows minibuffer-was-active - (not tab-bar-minibuffer-restore-tab)) - (setq-local tab-bar-minibuffer-restore-tab (1+ from-index)) - (add-hook 'minibuffer-exit-hook #'tab-bar-minibuffer-restore-tab nil t)) - (unless (eq from-index to-index) (let* ((from-tab (tab-bar--tab)) (to-tab (nth to-index tabs)) diff --git a/src/minibuf.c b/src/minibuf.c index 384de0a7b39..7fac3ce05fa 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -671,18 +671,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, call1 (Qpush_window_buffer_onto_prev, minibuf_window); record_unwind_protect_void (minibuffer_unwind); - if (read_minibuffer_restore_windows) - record_unwind_protect (restore_window_configuration, - list3 (Fcurrent_window_configuration (Qnil), - Qt, Qt)); - - /* If the minibuffer window is on a different frame, save that - frame's configuration too. */ - if (read_minibuffer_restore_windows && - !EQ (mini_frame, selected_frame)) - record_unwind_protect (restore_window_configuration, - list3 (Fcurrent_window_configuration (mini_frame), - Qnil, Qt)); /* If the minibuffer is on an iconified or invisible frame, make it visible now. */ @@ -2312,19 +2300,6 @@ for instance when running a headless Emacs server. Functions like instead. */); inhibit_interaction = 0; - DEFVAR_BOOL ("read-minibuffer-restore-windows", read_minibuffer_restore_windows, - doc: /* Non-nil means restore window configurations on exit from minibuffer. -If this is non-nil (the default), reading input with the minibuffer will -restore, on exit, the window configurations of the frame where the -minibuffer was entered from and, if it is different, the frame that owns -the associated minibuffer window. - -If this is nil, window configurations are not restored upon exiting -the minibuffer. However, if `minibuffer-restore-windows' is present -in `minibuffer-exit-hook', exiting the minibuffer will remove the window -showing the *Completions* buffer, if any. */); - read_minibuffer_restore_windows = true; - defsubr (&Sactive_minibuffer_window); defsubr (&Sset_minibuffer_window); defsubr (&Sread_from_minibuffer); -- 2.39.2