aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2006-03-20 00:42:21 +0000
committerLuc Teirlinck2006-03-20 00:42:21 +0000
commit8a31f8130248ec4576a603c2e99ba1f5c8d2377d (patch)
tree9217d6c3c4d0c71d49d0aa0b1b5ebbea8ed594bb
parentdb13394c30127d2100423850a6142e8ca43c11c2 (diff)
downloademacs-8a31f8130248ec4576a603c2e99ba1f5c8d2377d.tar.gz
emacs-8a31f8130248ec4576a603c2e99ba1f5c8d2377d.zip
(help-follow-symbol): New function. Essentially identical to the old
`help-follow', but do not let `push-button' do the work when on an xref. (help-mode-map): Bind `help-follow-symbol' to "C-c C-c". (help-xref-symbol-regexp): Make no xref for symbol preceded by the word `program'. (From Richard M. Stallman.) (help-follow-mouse, help-follow): Throw error if not on xref. Delete no longer used args. (From Richard M. Stallman.)
-rw-r--r--lisp/help-mode.el61
1 files changed, 32 insertions, 29 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index c2e1f59e578..94621535154 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -40,7 +40,7 @@
40 40
41(define-key help-mode-map [mouse-2] 'help-follow-mouse) 41(define-key help-mode-map [mouse-2] 'help-follow-mouse)
42(define-key help-mode-map "\C-c\C-b" 'help-go-back) 42(define-key help-mode-map "\C-c\C-b" 'help-go-back)
43(define-key help-mode-map "\C-c\C-c" 'help-follow) 43(define-key help-mode-map "\C-c\C-c" 'help-follow-symbol)
44;; Documentation only, since we use minor-mode-overriding-map-alist. 44;; Documentation only, since we use minor-mode-overriding-map-alist.
45(define-key help-mode-map "\r" 'help-follow) 45(define-key help-mode-map "\r" 'help-follow)
46 46
@@ -233,10 +233,10 @@ Commands:
233 "Label to use by `help-make-xrefs' for the go-back reference.") 233 "Label to use by `help-make-xrefs' for the go-back reference.")
234 234
235(defconst help-xref-symbol-regexp 235(defconst help-xref-symbol-regexp
236 (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|" 236 (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|" ; Link to var
237 "\\(function\\|command\\)\\|" 237 "\\(function\\|command\\)\\|" ; Link to function
238 "\\(face\\)\\|" 238 "\\(face\\)\\|" ; Link to face
239 "\\(symbol\\)\\|" 239 "\\(symbol\\|program\\)\\|" ; Don't link
240 "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)" 240 "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)"
241 "[ \t\n]+\\)?" 241 "[ \t\n]+\\)?"
242 ;; Note starting with word-syntax character: 242 ;; Note starting with word-syntax character:
@@ -584,15 +584,6 @@ help buffer."
584 584
585;; Navigation/hyperlinking with xrefs 585;; Navigation/hyperlinking with xrefs
586 586
587(defun help-follow-mouse (click)
588 "Follow the cross-reference that you CLICK on."
589 (interactive "e")
590 (let* ((start (event-start click))
591 (window (car start))
592 (pos (car (cdr start))))
593 (with-current-buffer (window-buffer window)
594 (help-follow pos))))
595
596(defun help-xref-go-back (buffer) 587(defun help-xref-go-back (buffer)
597 "From BUFFER, go back to previous help buffer text using `help-xref-stack'." 588 "From BUFFER, go back to previous help buffer text using `help-xref-stack'."
598 (let (item position method args) 589 (let (item position method args)
@@ -627,26 +618,38 @@ a proper [back] button."
627 (let ((help-xref-following t)) 618 (let ((help-xref-following t))
628 (apply function args))) 619 (apply function args)))
629 620
630(defun help-follow (&optional pos) 621;; The doc string is meant to explain what buttons do.
631 "Follow cross-reference at POS, defaulting to point. 622(defun help-follow-mouse ()
623 "Follow the cross-reference that you click on."
624 (interactive)
625 (error "No cross-reference here"))
626
627;; The doc string is meant to explain what buttons do.
628(defun help-follow ()
629 "Follow cross-reference at point.
632 630
633For the cross-reference format, see `help-make-xrefs'." 631For the cross-reference format, see `help-make-xrefs'."
632 (interactive)
633 (error "No cross-reference here"))
634
635(defun help-follow-symbol (&optional pos)
636 "In help buffer, show docs for symbol at POS, defaulting to point.
637Show all docs for that symbol as either a variable, function or face."
634 (interactive "d") 638 (interactive "d")
635 (unless pos 639 (unless pos
636 (setq pos (point))) 640 (setq pos (point)))
637 (unless (push-button pos) 641 ;; check if the symbol under point is a function, variable or face
638 ;; check if the symbol under point is a function or variable 642 (let ((sym
639 (let ((sym 643 (intern
640 (intern 644 (save-excursion
641 (save-excursion 645 (goto-char pos) (skip-syntax-backward "w_")
642 (goto-char pos) (skip-syntax-backward "w_") 646 (buffer-substring (point)
643 (buffer-substring (point) 647 (progn (skip-syntax-forward "w_")
644 (progn (skip-syntax-forward "w_") 648 (point)))))))
645 (point))))))) 649 (when (or (boundp sym)
646 (when (or (boundp sym) 650 (get sym 'variable-documentation)
647 (get sym 'variable-documentation) 651 (fboundp sym) (facep sym))
648 (fboundp sym) (facep sym)) 652 (help-do-xref pos #'help-xref-interned (list sym)))))
649 (help-do-xref pos #'help-xref-interned (list sym))))))
650 653
651(defun help-insert-string (string) 654(defun help-insert-string (string)
652 "Insert STRING to the help buffer and install xref info for it. 655 "Insert STRING to the help buffer and install xref info for it.