aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/help-mode.el
diff options
context:
space:
mode:
authorStefan Monnier2015-07-06 13:25:26 -0400
committerStefan Monnier2015-07-06 13:25:26 -0400
commit824fc04b660631e7ff976a36b7f70f7c3d5fc181 (patch)
treea500a9e9ab7010e70e5bfb8b9b09c16fe58d7f9f /lisp/help-mode.el
parent2a8dca13a7f5efd36390e5a93e55d3809f325c21 (diff)
downloademacs-824fc04b660631e7ff976a36b7f70f7c3d5fc181.tar.gz
emacs-824fc04b660631e7ff976a36b7f70f7c3d5fc181.zip
(describe-symbol): Rewrite describe-function-or-variable
* lisp/help-fns.el (describe-symbol-backends): New var. (help-xref-stack-item): Declare. (describe-symbol): Rename from describe-function-or-variable. Rewrite using describe-symbol-backends instead of help-xref-interned. * lisp/help.el (help-map): Use it. * lisp/help-mode.el (help-symbol, help-follow-symbol): Use it. (help-xref-interned): Make it into an obsolete alias.
Diffstat (limited to 'lisp/help-mode.el')
-rw-r--r--lisp/help-mode.el57
1 files changed, 3 insertions, 54 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 6454eed27bd..cdddd542532 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -148,7 +148,7 @@ The format is (FUNCTION ARGS...).")
148 148
149(define-button-type 'help-symbol 149(define-button-type 'help-symbol
150 :supertype 'help-xref 150 :supertype 'help-xref
151 'help-function #'help-xref-interned 151 'help-function #'describe-symbol
152 'help-echo (purecopy "mouse-2, RET: describe this symbol")) 152 'help-echo (purecopy "mouse-2, RET: describe this symbol"))
153 153
154(define-button-type 'help-back 154(define-button-type 'help-back
@@ -624,58 +624,7 @@ See `help-make-xrefs'."
624;; Additional functions for (re-)creating types of help buffers. 624;; Additional functions for (re-)creating types of help buffers.
625 625
626;;;###autoload 626;;;###autoload
627(defun help-xref-interned (symbol &optional buffer frame) 627(define-obsolete-function-alias 'help-xref-interned 'describe-symbol "25.1")
628 "Follow a hyperlink which appeared to be an arbitrary interned SYMBOL.
629Both variable, function and face documentation are extracted into a single
630help buffer. If SYMBOL is a variable, include buffer-local value for optional
631BUFFER or FRAME."
632 (with-current-buffer (help-buffer)
633 ;; Push the previous item on the stack before clobbering the output buffer.
634 (help-setup-xref nil nil)
635 (let ((facedoc (when (facep symbol)
636 ;; Don't record the current entry in the stack.
637 (setq help-xref-stack-item nil)
638 (describe-face symbol)))
639 (fdoc (when (fboundp symbol)
640 ;; Don't record the current entry in the stack.
641 (setq help-xref-stack-item nil)
642 (describe-function symbol)))
643 (sdoc (when (or (boundp symbol)
644 (get symbol 'variable-documentation))
645 ;; Don't record the current entry in the stack.
646 (setq help-xref-stack-item nil)
647 (describe-variable symbol buffer frame))))
648 (cond
649 (sdoc
650 ;; We now have a help buffer on the variable.
651 ;; Insert the function and face text before it.
652 (when (or fdoc facedoc)
653 (goto-char (point-min))
654 (let ((inhibit-read-only t))
655 (when fdoc
656 (insert fdoc "\n\n")
657 (when facedoc
658 (insert (make-string 30 ?-) "\n\n" (symbol-name symbol)
659 " is also a " "face." "\n\n")))
660 (when facedoc
661 (insert facedoc "\n\n"))
662 (insert (make-string 30 ?-) "\n\n" (symbol-name symbol)
663 " is also a " "variable." "\n\n"))
664 ;; Don't record the `describe-variable' item in the stack.
665 (setq help-xref-stack-item nil)
666 (help-setup-xref (list #'help-xref-interned symbol) nil)))
667 (fdoc
668 ;; We now have a help buffer on the function.
669 ;; Insert face text before it.
670 (when facedoc
671 (goto-char (point-max))
672 (let ((inhibit-read-only t))
673 (insert "\n\n" (make-string 30 ?-) "\n\n" (symbol-name symbol)
674 " is also a " "face." "\n\n" facedoc))
675 ;; Don't record the `describe-function' item in the stack.
676 (setq help-xref-stack-item nil)
677 (help-setup-xref (list #'help-xref-interned symbol) nil))))
678 (goto-char (point-min)))))
679 628
680 629
681;; Navigation/hyperlinking with xrefs 630;; Navigation/hyperlinking with xrefs
@@ -774,7 +723,7 @@ Show all docs for that symbol as either a variable, function or face."
774 (when (or (boundp sym) 723 (when (or (boundp sym)
775 (get sym 'variable-documentation) 724 (get sym 'variable-documentation)
776 (fboundp sym) (facep sym)) 725 (fboundp sym) (facep sym))
777 (help-do-xref pos #'help-xref-interned (list sym))))) 726 (help-do-xref pos #'describe-symbol (list sym)))))
778 727
779(defun help-mode-revert-buffer (_ignore-auto noconfirm) 728(defun help-mode-revert-buffer (_ignore-auto noconfirm)
780 (when (or noconfirm (yes-or-no-p "Revert help buffer? ")) 729 (when (or noconfirm (yes-or-no-p "Revert help buffer? "))