diff options
| author | Roland McGrath | 1991-07-28 00:21:00 +0000 |
|---|---|---|
| committer | Roland McGrath | 1991-07-28 00:21:00 +0000 |
| commit | f0a8a3f19809587d848a1e01391af0d3e8791d92 (patch) | |
| tree | 5b06eeaba455364264f6243088602e79f85a39bd | |
| parent | 43bad9918a91877e1361d76544e0e5e78a0b998d (diff) | |
| download | emacs-f0a8a3f19809587d848a1e01391af0d3e8791d92.tar.gz emacs-f0a8a3f19809587d848a1e01391af0d3e8791d92.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/info.el | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/lisp/info.el b/lisp/info.el index f009accc567..d31e86839a8 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -923,3 +923,72 @@ Allowed only if variable `Info-enable-edit' is non-nil." | |||
| 923 | (and (marker-position Info-tag-table-marker) | 923 | (and (marker-position Info-tag-table-marker) |
| 924 | (buffer-modified-p) | 924 | (buffer-modified-p) |
| 925 | (message "Tags may have changed. Use Info-tagify if necessary"))) | 925 | (message "Tags may have changed. Use Info-tagify if necessary"))) |
| 926 | |||
| 927 | (defun Info-find-emacs-command-nodes (command) | ||
| 928 | "Return a list of locations documenting COMMAND in the Emacs Info manual. | ||
| 929 | The locations are of the format used in Info-history, i.e. | ||
| 930 | \(FILENAME NODENAME BUFFERPOS\)." | ||
| 931 | (require 'info) | ||
| 932 | (let ((where '()) | ||
| 933 | (cmd-desc (concat "^\\* " (regexp-quote (symbol-name command)) | ||
| 934 | ":\\s *\\(.*\\)\\.$"))) | ||
| 935 | (save-excursion | ||
| 936 | (Info-find-node "emacs" "Command Index") | ||
| 937 | ;; Take the index node off the Info history. | ||
| 938 | (setq Info-history (cdr Info-history)) | ||
| 939 | (goto-char (point-max)) | ||
| 940 | (while (re-search-backward cmd-desc nil t) | ||
| 941 | (setq where (cons (list Info-current-file | ||
| 942 | (buffer-substring | ||
| 943 | (match-beginning 1) | ||
| 944 | (match-end 1)) | ||
| 945 | 0) | ||
| 946 | where))) | ||
| 947 | where))) | ||
| 948 | |||
| 949 | ;;;###autoload | ||
| 950 | (defun Info-goto-emacs-command-node (command) | ||
| 951 | "Go to the Info node in the Emacs manual for command COMMAND." | ||
| 952 | (interactive "CFind documentation for command: ") | ||
| 953 | (or (commandp command) | ||
| 954 | (signal 'wrong-type-argument (list 'commandp command))) | ||
| 955 | (let ((where (Info-find-emacs-command-nodes command))) | ||
| 956 | (if where | ||
| 957 | (let ((num-matches (length where))) | ||
| 958 | ;; Get Info running, and pop to it in another window. | ||
| 959 | (save-window-excursion | ||
| 960 | (info)) | ||
| 961 | (pop-to-buffer "*info*") | ||
| 962 | (Info-find-node (car (car where)) | ||
| 963 | (car (cdr (car where)))) | ||
| 964 | (if (> num-matches 1) | ||
| 965 | (progn | ||
| 966 | ;; Info-find-node already pushed (car where) onto | ||
| 967 | ;; Info-history. Put the other nodes that were found on | ||
| 968 | ;; the history. | ||
| 969 | (setq Info-history (nconc (cdr where) Info-history)) | ||
| 970 | (message (substitute-command-keys | ||
| 971 | "Found %d other entr%. Use \\[Info-last] to see %s." | ||
| 972 | (1- num-matches) | ||
| 973 | (if (> num-matches 2) "ies" "y") | ||
| 974 | (if (> num-matches 2) "them" "it")))))) | ||
| 975 | (error "Couldn't find documentation for %s." command)))) | ||
| 976 | ;;;###autoload | ||
| 977 | (define-key help-map "\C-f" 'Info-goto-emacs-command-node) | ||
| 978 | |||
| 979 | ;;;###autoload | ||
| 980 | (defun Info-goto-emacs-key-command-node (key) | ||
| 981 | "Go to the Info node in the Emacs manual the command bound to KEY, a string. | ||
| 982 | Interactively, if the binding is execute-extended-command, a command is read." | ||
| 983 | (interactive "kFind documentation for key:") | ||
| 984 | (let ((command (key-binding key))) | ||
| 985 | (cond ((null command) | ||
| 986 | (message "%s is undefined" (key-description keys))) | ||
| 987 | ((and (interactive-p) | ||
| 988 | (eq command 'execute-extended-command)) | ||
| 989 | (Info-goto-emacs-command-node | ||
| 990 | (read-command "Find documentation for command: "))) | ||
| 991 | (t | ||
| 992 | (Info-goto-emacs-command-node command))))) | ||
| 993 | ;;;###autoload | ||
| 994 | (define-key help-map "\C-k" 'Info-goto-emacs-key-command-node) | ||