From: Lars Ingebrigtsen Date: Wed, 21 Aug 2019 20:36:59 +0000 (-0700) Subject: Use `quit-window-hook' in Info instead of having its own command X-Git-Tag: emacs-27.0.90~1328^2~144 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=08dd4b9f0c0f2ccfcd17ae719b4a354919ddfeb5;p=emacs.git Use `quit-window-hook' in Info instead of having its own command * doc/misc/info.texi (Help-Q): Info now uses `quit-window'. * lisp/info.el (info-standalone): Adjust doc string. (Info-exit): Made into obsolete alias. (Info-mode-map): Bind "q" to `quit-window'. (Info-mode-menu): Adjust. (info-tool-bar-map): Ditto. (Info-mode): Adjust doc string. (Info-mode): If Info is standalone, kill Emacs on "q". --- diff --git a/doc/misc/info.texi b/doc/misc/info.texi index e69779a03ca..cbdeaff50ce 100644 --- a/doc/misc/info.texi +++ b/doc/misc/info.texi @@ -929,10 +929,9 @@ is @code{Info-top-node}. @section Quitting Info @kindex q @r{(Info mode)} -@findex Info-exit @cindex quitting Info mode To get out of Info, back to what you were doing before, type @kbd{q} -for @dfn{Quit}. This runs @code{Info-exit} in Emacs. +for @dfn{Quit}. This runs @code{quit-window} in Emacs. This is the end of the basic course on using Info. You have learned how to move in an Info document, and how to follow menus and cross diff --git a/lisp/info.el b/lisp/info.el index 16909736f8d..17a2d63e6de 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -841,7 +841,7 @@ See a list of available Info commands in `Info-mode'." (defun info-standalone () "Run Emacs as a standalone Info reader. Usage: emacs -f info-standalone [filename] -In standalone mode, \\\\[Info-exit] exits Emacs itself." +In standalone mode, \\\\[quit-window] exits Emacs itself." (setq Info-standalone t) (if (and command-line-args-left (not (string-match "^-" (car command-line-args-left)))) @@ -2948,12 +2948,7 @@ N is the digit argument used to invoke this command." (t (user-error "No pointer backward from this node"))))) -(defun Info-exit () - "Exit Info by selecting some other buffer." - (interactive) - (if Info-standalone - (save-buffers-kill-emacs) - (quit-window))) +(define-obsolete-function-alias 'Info-exit #'quit-window "27.1") (defun Info-next-menu-item () "Go to the node of the next menu item." @@ -4045,7 +4040,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'." (define-key map "m" 'Info-menu) (define-key map "n" 'Info-next) (define-key map "p" 'Info-prev) - (define-key map "q" 'Info-exit) + (define-key map "q" 'quit-window) (define-key map "r" 'Info-history-forward) (define-key map "s" 'Info-search) (define-key map "S" 'Info-search-case-sensitively) @@ -4123,7 +4118,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'." :help "Copy the name of the current node into the kill ring"] ["Clone Info buffer" clone-buffer :help "Create a twin copy of the current Info buffer."] - ["Exit" Info-exit :help "Stop reading Info"])) + ["Exit" quit-window :help "Stop reading Info"])) (defvar info-tool-bar-map @@ -4152,7 +4147,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'." :label "Index") (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map :vert-only t) - (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map + (tool-bar-local-item-from-menu 'quit-window "exit" map Info-mode-map :vert-only t) map)) @@ -4280,7 +4275,7 @@ topics. Info has commands to follow the references and show you other nodes. \\\ \\[Info-help] Invoke the Info tutorial. -\\[Info-exit] Quit Info: reselect previously selected buffer. +\\[quit-window] Quit Info: reselect previously selected buffer. Selecting other nodes: \\[Info-mouse-follow-nearest-node] @@ -4353,6 +4348,8 @@ Advanced commands: (add-hook 'clone-buffer-hook 'Info-clone-buffer nil t) (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) (add-hook 'isearch-mode-hook 'Info-isearch-start nil t) + (when Info-standalone + (add-hook 'quit-window-hook 'save-buffers-kill-emacs nil t)) (setq-local isearch-search-fun-function #'Info-isearch-search) (setq-local isearch-wrap-function #'Info-isearch-wrap) (setq-local isearch-push-state-function #'Info-isearch-push-state)