From c51032b71828d198377a4bbc53d216fbb9500ffb Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Thu, 6 Mar 2025 10:54:42 +0100 Subject: [PATCH] Drop 'help-window-keep-selected' --- doc/emacs/help.texi | 8 ------- lisp/emacs-lisp/shortdoc.el | 7 ++---- lisp/help-fns.el | 4 +--- lisp/help-mode.el | 24 +++++--------------- lisp/help.el | 14 +----------- lisp/info-look.el | 44 +++++++++++++++---------------------- 6 files changed, 28 insertions(+), 73 deletions(-) diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index 13e2058cd88..856b2ccddde 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -24,14 +24,6 @@ is unconditionally selected by help commands, and if its value is @code{other}, the help window is selected only if there are more than two windows on the selected frame. -@vindex help-window-keep-selected - Conversely, many commands in the @samp{*Help*} buffer will pop up a -new window to display the results. For instance, clicking on the link -to show the source code, or using the @key{i} command to display the -manual entry, will (by default) pop up a new window. If -@code{help-window-keep-selected} is changed to non-@code{nil}, the -window displaying the @samp{*Help*} buffer will be reused instead. - @cindex searching documentation efficiently @cindex looking for a subject in documentation If you are looking for a certain feature, but don't know what it is diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 06e0d3f1b0e..f3e7a02c1bb 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -1605,16 +1605,13 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), :eval (keymap-lookup (current-global-map) "C-x x g"))) ;;;###autoload -(defun shortdoc-display-group (group &optional function same-window) +(defun shortdoc-display-group (group &optional function) "Pop to a buffer with short documentation summary for functions in GROUP. If FUNCTION is non-nil, place point on the entry for FUNCTION (if any). If SAME-WINDOW, don't pop to a new window." (interactive (list (completing-read "Show summary for functions in: " shortdoc--groups))) - (funcall (if same-window - #'pop-to-buffer-same-window - #'pop-to-buffer) - (shortdoc-display-group-1 group)) + (pop-to-buffer (shortdoc-display-group-1 group)) (goto-char (point-min)) (when function (text-property-search-forward 'shortdoc-function function t) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index a97e67cf7c5..fc494b7b93e 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1050,9 +1050,7 @@ TYPE indicates the namespace and is `fun' or `var'." (setq times (1+ times)) (insert-text-button (symbol-name group) - 'action (lambda (_) - (shortdoc-display-group group object - help-window-keep-selected)) + 'action (lambda (_) (shortdoc-display-group group object)) 'follow-link t 'help-echo "mouse-1, RET: show documentation group")) groups) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 7a9b85f3a70..7c18e577b4b 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -275,9 +275,7 @@ The format is (FUNCTION ARGS...).") (let* ((location (find-function-search-for-symbol fun type file)) (position (cdr location))) - (if help-window-keep-selected - (pop-to-buffer-same-window (car location)) - (pop-to-buffer (car location))) + (pop-to-buffer (car location)) (run-hooks 'find-function-after-hook) (if position (progn @@ -303,10 +301,7 @@ The format is (FUNCTION ARGS...).") (setq file (locate-library file t)) (if (and file (file-readable-p file)) (progn - (if help-window-keep-selected - (pop-to-buffer-same-window - (find-file-noselect file)) - (pop-to-buffer (find-file-noselect file))) + (pop-to-buffer (find-file-noselect file)) (widen) (goto-char (point-min)) (if (re-search-forward @@ -325,9 +320,7 @@ The format is (FUNCTION ARGS...).") (setq file (help-C-file-name var 'var))) (let* ((location (find-variable-noselect var file)) (position (cdr location))) - (if help-window-keep-selected - (pop-to-buffer-same-window (car location)) - (pop-to-buffer (car location))) + (pop-to-buffer (car location)) (run-hooks 'find-function-after-hook) (if position (progn @@ -348,9 +341,7 @@ The format is (FUNCTION ARGS...).") (let* ((location (find-function-search-for-symbol fun 'defface file)) (position (cdr location))) - (if help-window-keep-selected - (pop-to-buffer-same-window (car location)) - (pop-to-buffer (car location))) + (pop-to-buffer (car location)) (if position (progn ;; Widen the buffer if necessary to go to this position. @@ -387,9 +378,7 @@ The format is (FUNCTION ARGS...).") :supertype 'help-xref 'help-function (lambda (file pos) - (if help-window-keep-selected - (view-file file) - (view-file-other-window file)) + (view-file file) (goto-char pos)) 'help-echo "mouse-2, RET: show corresponding NEWS announcement") @@ -865,8 +854,7 @@ The help buffers are divided into \"pages\" by the ^L character." (unless help-mode--current-data (error "No symbol to look up in the current buffer")) (info-lookup-symbol (plist-get help-mode--current-data :symbol) - 'emacs-lisp-mode - help-window-keep-selected)) + 'emacs-lisp-mode)) (defun help-goto-lispref-info () "View the Emacs Lisp manual *info* node of the current help item." diff --git a/lisp/help.el b/lisp/help.el index 75803afdfd4..6cdf71cea39 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -2160,25 +2160,13 @@ the help window appears on another frame, it may get selected and its frame get input focus even if this option is nil. This option has effect if and only if the help window was created -by `with-help-window'. - -Also see `help-window-keep-selected'." +by `with-help-window'." :type '(choice (const :tag "never (nil)" nil) (const :tag "other" other) (const :tag "always (t)" t)) :group 'help :version "23.1") -(defcustom help-window-keep-selected nil - "If non-nil, navigation commands in the *Help* buffer will reuse the window. -If nil, many commands in the *Help* buffer, like \\\\[help-view-source] and \\[help-goto-info], will -pop to a different window to display the results. - -Also see `help-window-select'." - :type 'boolean - :group 'help - :version "29.1") - (define-obsolete-variable-alias 'help-enable-auto-load 'help-enable-autoload "27.1") diff --git a/lisp/info-look.el b/lisp/info-look.el index c625894054e..797e69f5bce 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -278,7 +278,7 @@ system." ;;;###autoload (put 'info-lookup-symbol 'info-file "emacs") ;;;###autoload -(defun info-lookup-symbol (symbol &optional mode same-window) +(defun info-lookup-symbol (symbol &optional mode) "Look up and display documentation of SYMBOL in the relevant Info manual. SYMBOL should be an identifier: a function or method, a macro, a variable, a data type, a class, etc. @@ -291,13 +291,10 @@ MODE is the major mode whose Info manuals to search for the documentation of SYMBOL. It defaults to the current buffer's `major-mode'; if that mode doesn't have any Info manuals known to Emacs, the command will prompt for MODE to use, with completion. With prefix arg, the command -always prompts for MODE. - -Is SAME-WINDOW, try to reuse the current window instead of -popping up a new one." +always prompts for MODE." (interactive (info-lookup-interactive-arguments 'symbol current-prefix-arg)) - (info-lookup 'symbol symbol mode same-window)) + (info-lookup 'symbol symbol mode)) (put 'info-lookup-symbol 'minibuffer-action (cons (lambda (sym) @@ -398,7 +395,7 @@ If optional argument QUERY is non-nil, query for the help mode." spec mode))) -(defun info-lookup (topic item mode &optional same-window) +(defun info-lookup (topic item mode) "Display the documentation of TOPIC whose name is ITEM, using MODE's manuals. TOPIC should be any known symbol of a help topic type, such as `file' or `symbol'. See the documentation of HELP-TOPIC in the doc @@ -407,10 +404,7 @@ ITEM is the item whose documentation to search: file name if TOPIC is `file', a symbol if TOPIC is `symbol', etc. MODE is the `major-mode' whose Info manuals to search for documentation of ITEM; if it's nil, the function uses `info-lookup-file-name-alist' -and the current buffer's file name to guess the mode. - -If SAME-WINDOW, reuse the current window. If nil, pop to a -different window." +and the current buffer's file name to guess the mode." (or mode (setq mode (info-lookup-select-mode))) (setq mode (info-lookup--item-to-mode item mode)) (let* ((completions (info-lookup->completions topic mode)) @@ -433,21 +427,19 @@ different window." (if (not info-lookup-other-window-flag) (info) (save-window-excursion (info)) - (if same-window - (pop-to-buffer-same-window "*info*") - (let* ((info-window (get-buffer-window "*info*" t)) - (info-frame (and info-window (window-frame info-window)))) - (if (and info-frame - (not (eq info-frame (selected-frame))) - (display-multi-frame-p) - (memq info-frame (frames-on-display-list))) - ;; *info* is visible in another frame on same display. - ;; Raise that frame and select the window. - (progn - (select-window info-window) - (raise-frame info-frame)) - ;; In any other case, switch to *info* another window. - (switch-to-buffer-other-window "*info*")))))) + (let* ((info-window (get-buffer-window "*info*" t)) + (info-frame (and info-window (window-frame info-window)))) + (if (and info-frame + (not (eq info-frame (selected-frame))) + (display-multi-frame-p) + (memq info-frame (frames-on-display-list))) + ;; *info* is visible in another frame on same display. + ;; Raise that frame and select the window. + (progn + (select-window info-window) + (raise-frame info-frame)) + ;; In any other case, switch to *info* another window. + (switch-to-buffer-other-window "*info*"))))) (while (and (not found) modes) (setq doc-spec (info-lookup->doc-spec topic (car modes))) (while (and (not found) doc-spec) -- 2.39.5