]> code.delx.au - gnu-emacs/blobdiff - lisp/help-mode.el
Merge from emacs-23
[gnu-emacs] / lisp / help-mode.el
index 573554aa448bc28d644e6b7417a868a5f273d2b1..eefc68ab627fc0758d1da6b19fbd75f527321572 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -244,6 +245,25 @@ The format is (FUNCTION ARGS...).")
                       (message "Unable to find location in file"))))
   'help-echo (purecopy "mouse-2, RET: find face's definition"))
 
+(define-button-type 'help-package
+  :supertype 'help-xref
+  'help-function 'describe-package
+  'help-echo (purecopy "mouse-2, RET: Describe package"))
+
+(define-button-type 'help-package-def
+  :supertype 'help-xref
+  'help-function (lambda (file) (dired file))
+  'help-echo (purecopy "mouse-2, RET: visit package directory"))
+
+(define-button-type 'help-theme-def
+  :supertype 'help-xref
+  'help-function 'find-file
+  'help-echo (purecopy "mouse-2, RET: visit theme file"))
+
+(define-button-type 'help-theme-edit
+  :supertype 'help-xref
+  'help-function 'customize-create-theme
+  'help-echo (purecopy "mouse-2, RET: edit this theme file"))
 \f
 ;;;###autoload
 (defun help-mode ()
@@ -272,6 +292,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
@@ -433,7 +456,9 @@ that."
                     (let ((data (match-string 2)))
                       (save-match-data
                         (unless (string-match "^([^)]+)" data)
-                          (setq data (concat "(emacs)" data))))
+                          (setq data (concat "(emacs)" data)))
+                       (setq data ;; possible newlines if para filled
+                             (replace-regexp-in-string "[ \t\n]+" " " data t t)))
                       (help-xref-button 2 'help-info data))))
                 ;; URLs
                 (save-excursion
@@ -781,6 +806,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