aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Harder2004-04-05 12:40:56 +0000
committerJesper Harder2004-04-05 12:40:56 +0000
commitab2f22adc0bd00d2f2475952fb6f28e4a31af1f9 (patch)
tree718c383cc188423d79a66a40adacd78cf682a209
parent1d0a6ebb506eeb7151ab598fec4f73f709238e41 (diff)
downloademacs-ab2f22adc0bd00d2f2475952fb6f28e4a31af1f9.tar.gz
emacs-ab2f22adc0bd00d2f2475952fb6f28e4a31af1f9.zip
(info-apropos): New function.
(Info-mode-menu): Add it. (Info-find-node, Info-find-node-2): Grok apropos virtual file.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/info.el87
2 files changed, 82 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e6c9d8d37a3..d495c71de14 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12004-04-05 Jesper Harder <harder@ifa.au.dk> 12004-04-05 Jesper Harder <harder@ifa.au.dk>
2 2
3 * info.el (info-apropos): New function.
4 (Info-mode-menu): Add it.
5 (Info-find-node, Info-find-node-2): Grok apropos virtual file.
6
3 * help-mode.el (help-make-xrefs): Recognize aliased variable with 7 * help-mode.el (help-make-xrefs): Recognize aliased variable with
4 inherited docstring. 8 inherited docstring.
5 9
diff --git a/lisp/info.el b/lisp/info.el
index 0f8fc633cfa..b42e61003f8 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -498,9 +498,13 @@ it says do not attempt further (recursive) error recovery."
498 (if (stringp filename) 498 (if (stringp filename)
499 (let (temp temp-downcase found) 499 (let (temp temp-downcase found)
500 (setq filename (substitute-in-file-name filename)) 500 (setq filename (substitute-in-file-name filename))
501 (if (string= (downcase filename) "dir") 501 (cond
502 (setq found t) 502 ((string= (downcase filename) "dir")
503 (let ((dirs (if (string-match "^\\./" filename) 503 (setq found t))
504 ((string= filename "apropos")
505 (setq found 'apropos))
506 (t
507 (let ((dirs (if (string-match "^\\./" filename)
504 ;; If specified name starts with `./' 508 ;; If specified name starts with `./'
505 ;; then just try current directory. 509 ;; then just try current directory.
506 '("./") 510 '("./")
@@ -538,7 +542,7 @@ it says do not attempt further (recursive) error recovery."
538 temp (car (car suffix-list)) nil))) 542 temp (car (car suffix-list)) nil)))
539 (setq found temp))) 543 (setq found temp)))
540 (setq suffix-list (cdr suffix-list)))) 544 (setq suffix-list (cdr suffix-list))))
541 (setq dirs (cdr dirs))))) 545 (setq dirs (cdr dirs))))))
542 (if found 546 (if found
543 (setq filename found) 547 (setq filename found)
544 (error "Info file %s does not exist" filename)))) 548 (error "Info file %s does not exist" filename))))
@@ -686,10 +690,14 @@ a case-insensitive match is tried."
686 Info-current-file-completions nil 690 Info-current-file-completions nil
687 buffer-file-name nil) 691 buffer-file-name nil)
688 (erase-buffer) 692 (erase-buffer)
689 (if (eq filename t) 693 (cond
690 (Info-insert-dir) 694 ((eq filename t)
695 (Info-insert-dir))
696 ((eq filename 'apropos)
697 (insert-buffer-substring " *info-apropos*"))
698 (t
691 (info-insert-file-contents filename nil) 699 (info-insert-file-contents filename nil)
692 (setq default-directory (file-name-directory filename))) 700 (setq default-directory (file-name-directory filename))))
693 (set-buffer-modified-p nil) 701 (set-buffer-modified-p nil)
694 ;; See whether file has a tag table. Record the location if yes. 702 ;; See whether file has a tag table. Record the location if yes.
695 (goto-char (point-max)) 703 (goto-char (point-max))
@@ -724,7 +732,11 @@ a case-insensitive match is tried."
724 (set-marker Info-tag-table-marker pos))) 732 (set-marker Info-tag-table-marker pos)))
725 (set-marker Info-tag-table-marker nil)) 733 (set-marker Info-tag-table-marker nil))
726 (setq Info-current-file 734 (setq Info-current-file
727 (if (eq filename t) "dir" filename)))) 735 (cond
736 ((eq filename t) "dir")
737 ((eq filename 'apropos) "apropos")
738 (t filename)))
739 ))
728 ;; Use string-equal, not equal, to ignore text props. 740 ;; Use string-equal, not equal, to ignore text props.
729 (if (string-equal nodename "*") 741 (if (string-equal nodename "*")
730 (progn (setq Info-current-node nodename) 742 (progn (setq Info-current-node nodename)
@@ -2124,6 +2136,61 @@ Give a blank topic name to go to the Index node itself."
2124 (progn (beginning-of-line) t) ;; non-nil for recursive call 2136 (progn (beginning-of-line) t) ;; non-nil for recursive call
2125 (goto-char (point-min))))) 2137 (goto-char (point-min)))))
2126 2138
2139;;;###autoload
2140(defun info-apropos (string)
2141 "Grovel indices of all known Info files on your system for STRING.
2142Build a menu of the possible matches."
2143 (interactive "sIndex apropos: ")
2144 (unless (string= string "")
2145 (let ((pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^.]+\\)."
2146 (regexp-quote string)))
2147 (ohist Info-history)
2148 (current-node Info-current-node)
2149 (current-file Info-current-file)
2150 manuals matches temp-file node)
2151 (let ((Info-fontify-maximum-menu-size 0)
2152 Info-use-header-lines
2153 Info-hide-note-references)
2154 (Info-directory)
2155 (message "Searching indices...")
2156 (goto-char (point-min))
2157 (re-search-forward "\\* Menu: *\n" nil t)
2158 (while (re-search-forward "\\*.*: (\\([^)]+\\))" nil t)
2159 (add-to-list 'manuals (match-string 1)))
2160 (dolist (manual manuals)
2161 (message "Searching %s" manual)
2162 (condition-case nil
2163 (save-excursion
2164 (Info-find-node manual "Top")
2165 (when (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
2166 (goto-char (match-beginning 1))
2167 (Info-goto-node (Info-extract-menu-node-name))
2168 (while
2169 (progn
2170 (goto-char (point-min))
2171 (while (re-search-forward pattern nil t)
2172 (add-to-list 'matches
2173 (list (match-string 1)
2174 (match-string 2)
2175 manual)))
2176 (and (setq node (Info-extract-pointer "next" t))
2177 (string-match "\\<Index\\>" node)))
2178 (Info-goto-node node))))
2179 (error nil))))
2180 (Info-goto-node (concat "(" current-file ")" current-node))
2181 (setq Info-history ohist)
2182 (message "Searching indices...done")
2183 (if (null matches)
2184 (message "No matches found")
2185 (with-current-buffer (get-buffer-create " *info-apropos*")
2186 (erase-buffer)
2187 (insert "\n\nFile: apropos, Node: Top, Up: (dir)\n")
2188 (insert "* Menu: \nNodes whose indices contain \"" string "\"\n\n")
2189 (dolist (entry matches)
2190 (insert "* " (car entry) " [" (nth 2 entry)
2191 "]: (" (nth 2 entry) ")" (nth 1 entry) ".\n")))
2192 (Info-find-node "apropos" "top")))))
2193
2127(defun Info-undefined () 2194(defun Info-undefined ()
2128 "Make command be undefined in Info." 2195 "Make command be undefined in Info."
2129 (interactive) 2196 (interactive)
@@ -2343,7 +2410,9 @@ if point is in a menu item description, follow that menu item."
2343 ["Lookup a String" Info-index 2410 ["Lookup a String" Info-index
2344 :help "Look for a string in the index items"] 2411 :help "Look for a string in the index items"]
2345 ["Next Matching Item" Info-index-next 2412 ["Next Matching Item" Info-index-next
2346 :help "Look for another occurrence of previous item"]) 2413 :help "Look for another occurrence of previous item"]
2414 ["Lookup a string in all indices" info-apropos
2415 :help "Look for a string in the indices of all manuals"])
2347 ["Edit" Info-edit :help "Edit contents of this node" 2416 ["Edit" Info-edit :help "Edit contents of this node"
2348 :active Info-enable-edit] 2417 :active Info-enable-edit]
2349 ["Copy Node Name" Info-copy-current-node-name 2418 ["Copy Node Name" Info-copy-current-node-name