]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a new command `info-display-manual'.
authorEli Zaretskii <eliz@gnu.org>
Fri, 1 Apr 2011 10:10:47 +0000 (13:10 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 1 Apr 2011 10:10:47 +0000 (13:10 +0300)
 lisp/info.el (info-display-manual): New function.

etc/NEWS
lisp/ChangeLog
lisp/info.el

index 14d788ec5549b11df2f75f4fb9eb282dfb7e7bef..999d278dc2e5f261a56cb69d15ff72627e9e9e53 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -676,6 +676,14 @@ binding `log-view-expanded-log-entry-function' to a suitable function.
 
 *** New command `nato-region' converts text to NATO phonetic alphabet.
 
+*** The new command `info-display-manual' will display an Info manual
+specified by its name.  If that manual is already visited in some Info
+buffer within the current session, the command will display that
+buffer.  Otherwise, it will load the manual and display it.  This is
+handy if you have many manuals in many Info buffers, and don't
+remember the name of the buffer visiting the manual you want to
+consult.
+
 \f
 * New Modes and Packages in Emacs 24.1
 
index 32e9c92a2553e19890e531057796042f7ecf9881..5c6e7365491e41fffaa1cb51ae598388410bd74b 100644 (file)
@@ -1,3 +1,7 @@
+2011-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+       * info.el (info-display-manual): New function.
+
 2011-03-31  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * loadup.el: Load minibuffer after loaddefs, to use define-minor-mode.
index fb753659737ff44c78d01c4d39e5307d54072d80..34c486d3754727d9c165e43204587d3e8c9494cb 100644 (file)
@@ -4930,6 +4930,27 @@ type returned by `Info-bookmark-make-record', which see."
     (bookmark-default-handler
      `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk)))))
 
+\f
+;;;###autoload
+(defun info-display-manual (manual)
+  "Go to Info buffer that displays MANUAL, creating it if none already exists."
+  (interactive "sManual name: ")
+  (let ((blist (buffer-list))
+       (manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
+       (case-fold-search t)
+       found)
+    (dolist (buffer blist)
+      (with-current-buffer buffer
+       (when (and (eq major-mode 'Info-mode)
+                  (stringp Info-current-file)
+                  (string-match manual-re Info-current-file))
+         (setq found buffer
+               blist nil))))
+    (if found
+       (pop-to-buffer found)
+      (info-initialize)
+      (info (Info-find-file manual)))))
+
 (provide 'info)
 
 ;;; info.el ends here