comparison lisp/info.el @ 359:da45fa7bc8d1

*** empty log message ***
author Roland McGrath <roland@gnu.org>
date Sun, 28 Jul 1991 00:21:00 +0000
parents 3f3710052f22
children 0840eff2ecd5
comparison
equal deleted inserted replaced
358:71c9042fb90d 359:da45fa7bc8d1
921 ;; Make mode line update. 921 ;; Make mode line update.
922 (set-buffer-modified-p (buffer-modified-p)) 922 (set-buffer-modified-p (buffer-modified-p))
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)