Mercurial > emacs
comparison lisp/help-mode.el @ 83494:b901f4f12f33
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-160
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-161
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-162
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-163
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-164
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-165
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-166
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-167
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-168
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-169
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-170
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-171
Update from CVS: man/mh-e.texi (Folders): Various edits.
* emacs@sv.gnu.org/emacs--devo--0--patch-172
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-58
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-59
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-60
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-61
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-62
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-63
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-64
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-534
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Wed, 22 Mar 2006 15:16:06 +0000 |
parents | ddaea7e69d4f |
children | bcef8f45667d e6bf73e43cf4 |
comparison
equal
deleted
inserted
replaced
83493:1bf2ca323037 | 83494:b901f4f12f33 |
---|---|
38 | 38 |
39 (set-keymap-parent help-mode-map button-buffer-map) | 39 (set-keymap-parent help-mode-map button-buffer-map) |
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 |
47 (defvar help-xref-stack nil | 47 (defvar help-xref-stack nil |
48 "A stack of ways by which to return to help buffers after following xrefs. | 48 "A stack of ways by which to return to help buffers after following xrefs. |
231 | 231 |
232 (defvar help-back-label (purecopy "[back]") | 232 (defvar help-back-label (purecopy "[back]") |
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: |
243 "`\\(\\sw\\(\\sw\\|\\s_\\)+\\)'")) | 243 "`\\(\\sw\\(\\sw\\|\\s_\\)+\\)'")) |
244 "Regexp matching doc string references to symbols. | 244 "Regexp matching doc string references to symbols. |
582 (help-setup-xref (list #'help-xref-interned symbol) nil))))))) | 582 (help-setup-xref (list #'help-xref-interned symbol) nil))))))) |
583 | 583 |
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) |
599 (with-current-buffer buffer | 590 (with-current-buffer buffer |
600 (when help-xref-stack | 591 (when help-xref-stack |
625 a proper [back] button." | 616 a proper [back] button." |
626 ;; There is a reference at point. Follow it. | 617 ;; There is a reference at point. Follow it. |
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 |
633 For the cross-reference format, see `help-make-xrefs'." | 631 For 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. | |
637 Show 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. |
653 This function can be used to restore the old contents of the help buffer | 656 This function can be used to restore the old contents of the help buffer |
654 when going back to the previous topic in the xref stack. It is needed | 657 when going back to the previous topic in the xref stack. It is needed |