]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix revert-buffer functionality of Help mode and Info.
authorJuri Linkov <juri@jurta.org>
Thu, 17 Jun 2010 20:56:17 +0000 (23:56 +0300)
committerJuri Linkov <juri@jurta.org>
Thu, 17 Jun 2010 20:56:17 +0000 (23:56 +0300)
* lisp/help-mode.el (help-mode): Set buffer-local variable
revert-buffer-function to help-mode-revert-buffer.
(help-mode-revert-buffer): New function.

* lisp/info.el (Info-revert-find-node): Check for major-mode Info-mode
before popping to "*info*" (like in other Info functions).
Keep buffer-name in old-buffer-name.  Keep Info-history-forward in
old-history-forward.  Pop to old-buffer-name or "*info*" to
recreate the killed buffer.  Set Info-history-forward from
old-history-forward.
(Info-breadcrumbs-depth): Add :group and :version.

lisp/ChangeLog
lisp/help-mode.el
lisp/info.el

index 054f97b12550cb370311a89f89b7de2cc8eeab26..fffbc555e9726daa726820d875bcbcd58c17115e 100644 (file)
@@ -1,3 +1,17 @@
+2010-06-17  Juri Linkov  <juri@jurta.org>
+
+       * help-mode.el (help-mode): Set buffer-local variable
+       revert-buffer-function to help-mode-revert-buffer.
+       (help-mode-revert-buffer): New function.
+
+       * info.el (Info-revert-find-node): Check for major-mode Info-mode
+       before popping to "*info*" (like in other Info functions).
+       Keep buffer-name in old-buffer-name.  Keep Info-history-forward in
+       old-history-forward.  Pop to old-buffer-name or "*info*" to
+       recreate the killed buffer.  Set Info-history-forward from
+       old-history-forward.
+       (Info-breadcrumbs-depth): Add :group and :version.
+
 2010-06-17  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * emacs-lisp/package.el (package-menu-mode-map): Add a menu.
index f115e4253252f44471358f68595fa6d3476833e2..c478bf6d16cea890ff0cfdaf6bfbf814828ac00f 100644 (file)
@@ -272,6 +272,9 @@ Commands:
          (with-current-buffer buffer
            (bury-buffer))))
 
+  (set (make-local-variable 'revert-buffer-function)
+       'help-mode-revert-buffer)
+
   (run-mode-hooks 'help-mode-hook))
 
 ;;;###autoload
@@ -783,6 +786,17 @@ Show all docs for that symbol as either a variable, function or face."
              (fboundp sym) (facep sym))
       (help-do-xref pos #'help-xref-interned (list sym)))))
 
+(defun help-mode-revert-buffer (ignore-auto noconfirm)
+  (when (or noconfirm (yes-or-no-p "Revert help buffer? "))
+    (let ((pos (point))
+         (item help-xref-stack-item)
+         ;; Pretend there is no current item to add to the history.
+         (help-xref-stack-item nil)
+         ;; Use the current buffer.
+         (help-xref-following t))
+      (apply (car item) (cdr item))
+      (goto-char pos))))
+
 (defun help-insert-string (string)
   "Insert STRING to the help buffer and install xref info for it.
 This function can be used to restore the old contents of the help buffer
index e76a8da146eb84075d9578e4d16509726a74507a..9a30f63fff09e149ade1ad26282ec8dfdf1962b6 100644 (file)
@@ -238,7 +238,9 @@ This only has an effect if `Info-hide-note-references' is non-nil."
 (defcustom Info-breadcrumbs-depth 4
   "Depth of breadcrumbs to display.
 0 means do not display breadcrumbs."
-  :type 'integer)
+  :version "23.1"
+  :type 'integer
+  :group 'info)
 
 (defcustom Info-search-whitespace-regexp "\\s-+"
   "If non-nil, regular expression to match a sequence of whitespace chars.
@@ -800,17 +802,22 @@ otherwise, that defaults to `Top'."
   "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
 When *info* is already displaying FILENAME and NODENAME, the window position
 is preserved, if possible."
-  (pop-to-buffer "*info*")
+  (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
   (let ((old-filename Info-current-file)
        (old-nodename Info-current-node)
+       (old-buffer-name (buffer-name))
        (pcolumn      (current-column))
        (pline        (count-lines (point-min) (line-beginning-position)))
        (wline        (count-lines (point-min) (window-start)))
+       (old-history-forward Info-history-forward)
        (old-history  Info-history)
        (new-history  (and Info-current-file
                           (list Info-current-file Info-current-node (point)))))
     (kill-buffer (current-buffer))
+    (pop-to-buffer (or old-buffer-name "*info*"))
+    (Info-mode)
     (Info-find-node filename nodename)
+    (setq Info-history-forward old-history-forward)
     (setq Info-history old-history)
     (if (and (equal old-filename Info-current-file)
             (equal old-nodename Info-current-node))