]> code.delx.au - gnu-emacs/blob - lisp/info.el
Update FSF's address.
[gnu-emacs] / lisp / info.el
1 ;;; info.el --- info package for Emacs.
2
3 ;; Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc.
4
5 ;; Maintainer: FSF
6 ;; Keywords: help
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;; Note that nowadays we expect info files to be made using makeinfo.
28
29 ;;; Code:
30
31 (defvar Info-history nil
32 "List of info nodes user has visited.
33 Each element of list is a list (FILENAME NODENAME BUFFERPOS).")
34
35 (defvar Info-enable-edit nil
36 "*Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info can edit the current node.
37 This is convenient if you want to write info files by hand.
38 However, we recommend that you not do this.
39 It is better to write a Texinfo file and generate the Info file from that,
40 because that gives you a printed manual as well.")
41
42 (defvar Info-enable-active-nodes t
43 "Non-nil allows Info to execute Lisp code associated with nodes.
44 The Lisp code is executed when the node is selected.")
45
46 (defvar Info-fontify t
47 "*Non-nil enables highlighting and fonts in Info nodes.")
48
49 (defvar Info-fontify-maximum-menu-size 30000
50 "*Maximum size of menu to fontify if `Info-fontify' is non-nil.")
51
52 (defvar Info-directory-list
53 (let ((path (getenv "INFOPATH"))
54 ;; This is for older Emacs versions
55 ;; which might get this info.el from the Texinfo distribution.
56 (path-separator (if (boundp 'path-separator) path-separator
57 (if (eq system-type 'ms-dos) ";" ":")))
58 (source (expand-file-name "info/" source-directory))
59 (sibling (if installation-directory
60 (expand-file-name "info/" installation-directory)))
61 alternative)
62 (if path
63 (let ((list nil)
64 idx)
65 (while (> (length path) 0)
66 (setq idx (or (string-match path-separator path) (length path))
67 list (cons (substring path 0 idx) list)
68 path (substring path (min (1+ idx)
69 (length path)))))
70 (nreverse list))
71 (if (and sibling (file-exists-p sibling))
72 (setq alternative sibling)
73 (setq alternative source))
74 (if (or (member alternative Info-default-directory-list)
75 (not (file-exists-p alternative))
76 ;; On DOS/NT, we use movable executables always,
77 ;; and we must always find the Info dir at run time.
78 (if (or (eq system-type 'ms-dos) (eq system-type 'windows-nt))
79 nil
80 ;; Use invocation-directory for Info only if we used it for
81 ;; exec-directory also.
82 (not (string= exec-directory
83 (expand-file-name "lib-src/"
84 installation-directory)))))
85 Info-default-directory-list
86 (reverse (cons alternative
87 (cdr (reverse Info-default-directory-list)))))))
88 "List of directories to search for Info documentation files.
89 nil means not yet initialized. In this case, Info uses the environment
90 variable INFOPATH to initialize it, or `Info-default-directory-list'
91 if there is no INFOPATH variable in the environment.
92 The last element of `Info-default-directory-list' is the directory
93 where Emacs installs the Info files that come with it.
94
95 If you run the Emacs executable from the `src' directory in the Emacs
96 source tree, the `info' directory in the source tree is used as the last
97 element, in place of the installation Info directory. This is useful
98 when you run a version of Emacs without installing it.")
99
100 (defvar Info-additional-directory-list nil
101 "List of additional directories to search for Info documentation files.
102 These directories are not searched for merging the `dir' file.")
103
104 (defvar Info-current-file nil
105 "Info file that Info is now looking at, or nil.
106 This is the name that was specified in Info, not the actual file name.
107 It doesn't contain directory names or file name extensions added by Info.")
108
109 (defvar Info-current-subfile nil
110 "Info subfile that is actually in the *info* buffer now,
111 or nil if current info file is not split into subfiles.")
112
113 (defvar Info-current-node nil
114 "Name of node that Info is now looking at, or nil.")
115
116 (defvar Info-tag-table-marker (make-marker)
117 "Marker pointing at beginning of current Info file's tag table.
118 Marker points nowhere if file has no tag table.")
119
120 (defvar Info-current-file-completions nil
121 "Cached completion list for current Info file.")
122
123 (defvar Info-index-alternatives nil
124 "List of possible matches for last Info-index command.")
125
126 (defvar Info-standalone nil
127 "Non-nil if Emacs was started solely as an Info browser.")
128
129 (defvar Info-suffix-list
130 (if (eq system-type 'ms-dos)
131 '( (".gz" . "gunzip")
132 (".z" . "gunzip")
133 (".inf" . nil)
134 ("" . nil))
135 '( (".info.Z" . "uncompress")
136 (".info.Y" . "unyabba")
137 (".info.gz" . "gunzip")
138 (".info.z" . "gunzip")
139 (".info" . nil)
140 (".Z" . "uncompress")
141 (".Y" . "unyabba")
142 (".gz" . "gunzip")
143 (".z" . "gunzip")
144 ("" . nil)))
145 "List of file name suffixes and associated decoding commands.
146 Each entry should be (SUFFIX . STRING); the file is given to
147 the command as standard input. If STRING is nil, no decoding is done.
148 Because the SUFFIXes are tried in order, the empty string should
149 be last in the list.")
150
151 ;; Concatenate SUFFIX onto FILENAME. SUFFIX should start with a dot.
152 ;; First, on ms-dos, delete some of the extension in FILENAME
153 ;; to make room.
154 (defun info-insert-file-contents-1 (filename suffix)
155 (if (not (eq system-type 'ms-dos))
156 (concat filename suffix)
157 (let* ((sans-exts (file-name-sans-extension filename))
158 ;; How long is the extension in FILENAME (not counting the dot).
159 (ext-len (max 0 (- (length filename) (length sans-exts) 1)))
160 ext-left)
161 ;; SUFFIX starts with a dot. If FILENAME already has one,
162 ;; get rid of the one in SUFFIX.
163 (or (and (<= ext-len 0)
164 (not (eq (aref filename (1- (length filename))) ?.)))
165 (setq suffix (substring suffix 1)))
166 ;; How many chars of that extension should we keep?
167 (setq ext-left (min ext-len (max 0 (- 3 (length suffix)))))
168 ;; Get rid of the rest of the extension, and add SUFFIX.
169 (concat (substring filename 0 (- (length filename)
170 (- ext-len ext-left)))
171 suffix))))
172
173 (defun info-insert-file-contents (filename &optional visit)
174 "Insert the contents of an info file in the current buffer.
175 Do the right thing if the file has been compressed or zipped."
176 (let ((tail Info-suffix-list)
177 fullname decoder)
178 (if (file-exists-p filename)
179 ;; FILENAME exists--see if that name contains a suffix.
180 ;; If so, set DECODE accordingly.
181 (progn
182 (while (and tail
183 (not (string-match
184 (concat (regexp-quote (car (car tail))) "$")
185 filename)))
186 (setq tail (cdr tail)))
187 (setq fullname filename
188 decoder (cdr (car tail))))
189 ;; Try adding suffixes to FILENAME and see if we can find something.
190 (while (and tail
191 (not (file-exists-p (info-insert-file-contents-1
192 filename (car (car tail))))))
193 (setq tail (cdr tail)))
194 ;; If we found a file with a suffix, set DECODER according to the suffix
195 ;; and set FULLNAME to the file's actual name.
196 (setq fullname (info-insert-file-contents-1 filename (car (car tail)))
197 decoder (cdr (car tail)))
198 (or tail
199 (error "Can't find %s or any compressed version of it" filename)))
200 ;; check for conflict with jka-compr
201 (if (and (featurep 'jka-compr)
202 (jka-compr-installed-p)
203 (jka-compr-get-compression-info fullname))
204 (setq decoder nil))
205 (insert-file-contents fullname visit)
206 (if decoder
207 (let ((buffer-read-only nil)
208 (default-directory (or (file-name-directory fullname)
209 default-directory)))
210 (call-process-region (point-min) (point-max) decoder t t)))))
211
212 ;;;###autoload (add-hook 'same-window-buffer-names "*info*")
213
214 ;;;###autoload
215 (defun info (&optional file)
216 "Enter Info, the documentation browser.
217 Optional argument FILE specifies the file to examine;
218 the default is the top-level directory of Info.
219
220 In interactive use, a prefix argument directs this command
221 to read a file name from the minibuffer."
222 (interactive (if current-prefix-arg
223 (list (read-file-name "Info file name: " nil nil t))))
224 (if file
225 (Info-goto-node (concat "(" file ")"))
226 (if (get-buffer "*info*")
227 (pop-to-buffer "*info*")
228 (Info-directory))))
229
230 ;;;###autoload
231 (defun info-standalone ()
232 "Run Emacs as a standalone Info reader.
233 Usage: emacs -f info-standalone [filename]
234 In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
235 (setq Info-standalone t)
236 (if (and command-line-args-left
237 (not (string-match "^-" (car command-line-args-left))))
238 (condition-case err
239 (progn
240 (info (car command-line-args-left))
241 (setq command-line-args-left (cdr command-line-args-left)))
242 (error (send-string-to-terminal
243 (format "%s\n" (if (eq (car-safe err) 'error)
244 (nth 1 err) err)))
245 (save-buffers-kill-emacs)))
246 (info)))
247
248 ;; Go to an info node specified as separate filename and nodename.
249 ;; no-going-back is non-nil if recovering from an error in this function;
250 ;; it says do not attempt further (recursive) error recovery.
251 (defun Info-find-node (filename nodename &optional no-going-back)
252 ;; Convert filename to lower case if not found as specified.
253 ;; Expand it.
254 (if filename
255 (let (temp temp-downcase found)
256 (setq filename (substitute-in-file-name filename))
257 (if (string= (downcase (file-name-nondirectory filename)) "dir")
258 (setq found t)
259 (let ((dirs (if (string-match "^\\./" filename)
260 ;; If specified name starts with `./'
261 ;; then just try current directory.
262 '("./")
263 (if (file-name-absolute-p filename)
264 ;; No point in searching for an
265 ;; absolute file name
266 '(nil)
267 (if Info-additional-directory-list
268 (append Info-directory-list
269 Info-additional-directory-list)
270 Info-directory-list)))))
271 ;; Search the directory list for file FILENAME.
272 (while (and dirs (not found))
273 (setq temp (expand-file-name filename (car dirs)))
274 (setq temp-downcase
275 (expand-file-name (downcase filename) (car dirs)))
276 ;; Try several variants of specified name.
277 (let ((suffix-list Info-suffix-list))
278 (while (and suffix-list (not found))
279 (cond ((file-exists-p
280 (info-insert-file-contents-1
281 temp (car (car suffix-list))))
282 (setq found temp))
283 ((file-exists-p
284 (info-insert-file-contents-1
285 temp-downcase (car (car suffix-list))))
286 (setq found temp-downcase)))
287 (setq suffix-list (cdr suffix-list))))
288 (setq dirs (cdr dirs)))))
289 (if found
290 (setq filename found)
291 (error "Info file %s does not exist" filename))))
292 ;; Record the node we are leaving.
293 (if (and Info-current-file (not no-going-back))
294 (setq Info-history
295 (cons (list Info-current-file Info-current-node (point))
296 Info-history)))
297 ;; Go into info buffer.
298 (switch-to-buffer "*info*")
299 (buffer-disable-undo (current-buffer))
300 (or (eq major-mode 'Info-mode)
301 (Info-mode))
302 (widen)
303 (setq Info-current-node nil)
304 (unwind-protect
305 (progn
306 ;; Switch files if necessary
307 (or (null filename)
308 (equal Info-current-file filename)
309 (let ((buffer-read-only nil))
310 (setq Info-current-file nil
311 Info-current-subfile nil
312 Info-current-file-completions nil
313 Info-index-alternatives nil
314 buffer-file-name nil)
315 (erase-buffer)
316 (if (eq filename t)
317 (Info-insert-dir)
318 (info-insert-file-contents filename t)
319 (setq default-directory (file-name-directory filename)))
320 (set-buffer-modified-p nil)
321 ;; See whether file has a tag table. Record the location if yes.
322 (set-marker Info-tag-table-marker nil)
323 (goto-char (point-max))
324 (forward-line -8)
325 ;; Use string-equal, not equal, to ignore text props.
326 (or (string-equal nodename "*")
327 (not (search-forward "\^_\nEnd tag table\n" nil t))
328 (let (pos)
329 ;; We have a tag table. Find its beginning.
330 ;; Is this an indirect file?
331 (search-backward "\nTag table:\n")
332 (setq pos (point))
333 (if (save-excursion
334 (forward-line 2)
335 (looking-at "(Indirect)\n"))
336 ;; It is indirect. Copy it to another buffer
337 ;; and record that the tag table is in that buffer.
338 (save-excursion
339 (let ((buf (current-buffer)))
340 (set-buffer (get-buffer-create " *info tag table*"))
341 (buffer-disable-undo (current-buffer))
342 (setq case-fold-search t)
343 (erase-buffer)
344 (insert-buffer-substring buf)
345 (set-marker Info-tag-table-marker
346 (match-end 0))))
347 (set-marker Info-tag-table-marker pos))))
348 (setq Info-current-file
349 (if (eq filename t) "dir" filename))))
350 ;; Use string-equal, not equal, to ignore text props.
351 (if (string-equal nodename "*")
352 (progn (setq Info-current-node nodename)
353 (Info-set-mode-line))
354 ;; Search file for a suitable node.
355 (let ((guesspos (point-min))
356 (regexp (concat "Node: *" (regexp-quote nodename) " *[,\t\n\177]")))
357 ;; First get advice from tag table if file has one.
358 ;; Also, if this is an indirect info file,
359 ;; read the proper subfile into this buffer.
360 (if (marker-position Info-tag-table-marker)
361 (save-excursion
362 (set-buffer (marker-buffer Info-tag-table-marker))
363 (goto-char Info-tag-table-marker)
364 (if (re-search-forward regexp nil t)
365 (progn
366 (setq guesspos (read (current-buffer)))
367 ;; If this is an indirect file,
368 ;; determine which file really holds this node
369 ;; and read it in.
370 (if (not (eq (current-buffer) (get-buffer "*info*")))
371 (setq guesspos
372 (Info-read-subfile guesspos))))
373 (error "No such node: \"%s\"" nodename))))
374 (goto-char (max (point-min) (- guesspos 1000)))
375 ;; Now search from our advised position (or from beg of buffer)
376 ;; to find the actual node.
377 (catch 'foo
378 (while (search-forward "\n\^_" nil t)
379 (forward-line 1)
380 (let ((beg (point)))
381 (forward-line 1)
382 (if (re-search-backward regexp beg t)
383 (throw 'foo t))))
384 (error "No such node: %s" nodename)))
385 (Info-select-node)))
386 ;; If we did not finish finding the specified node,
387 ;; go back to the previous one.
388 (or Info-current-node no-going-back (null Info-history)
389 (let ((hist (car Info-history)))
390 (setq Info-history (cdr Info-history))
391 (Info-find-node (nth 0 hist) (nth 1 hist) t)
392 (goto-char (nth 2 hist)))))
393 (goto-char (point-min)))
394
395 ;; Cache the contents of the (virtual) dir file, once we have merged
396 ;; it for the first time, so we can save time subsequently.
397 (defvar Info-dir-contents nil)
398
399 ;; Cache for the directory we decided to use for the default-directory
400 ;; of the merged dir text.
401 (defvar Info-dir-contents-directory nil)
402
403 ;; Record the file attributes of all the files from which we
404 ;; constructed Info-dir-contents.
405 (defvar Info-dir-file-attributes nil)
406
407 ;; Construct the Info directory node by merging the files named `dir'
408 ;; from various directories. Set the *info* buffer's
409 ;; default-directory to the first directory we actually get any text
410 ;; from.
411 (defun Info-insert-dir ()
412 (if (and Info-dir-contents Info-dir-file-attributes
413 ;; Verify that none of the files we used has changed
414 ;; since we used it.
415 (eval (cons 'and
416 (mapcar '(lambda (elt)
417 (let ((curr (file-attributes (car elt))))
418 ;; Don't compare the access time.
419 (if curr (setcar (nthcdr 4 curr) 0))
420 (setcar (nthcdr 4 (cdr elt)) 0)
421 (equal (cdr elt) curr)))
422 Info-dir-file-attributes))))
423 (insert Info-dir-contents)
424 (let ((dirs Info-directory-list)
425 buffers buffer others nodes dirs-done)
426
427 (setq Info-dir-file-attributes nil)
428
429 ;; Search the directory list for the directory file.
430 (while dirs
431 (let ((truename (file-truename (expand-file-name (car dirs)))))
432 (or (member truename dirs-done)
433 (member (directory-file-name truename) dirs-done)
434 ;; Try several variants of specified name.
435 ;; Try upcasing, appending `.info', or both.
436 (let* (file
437 (attrs
438 (or
439 (progn (setq file (expand-file-name "dir" truename))
440 (file-attributes file))
441 (progn (setq file (expand-file-name "DIR" truename))
442 (file-attributes file))
443 (progn (setq file (expand-file-name "dir.info" truename))
444 (file-attributes file))
445 (progn (setq file (expand-file-name "DIR.INFO" truename))
446 (file-attributes file)))))
447 (setq dirs-done
448 (cons truename
449 (cons (directory-file-name truename)
450 dirs-done)))
451 (if attrs
452 (save-excursion
453 (or buffers
454 (message "Composing main Info directory..."))
455 (set-buffer (generate-new-buffer "info dir"))
456 (insert-file-contents file)
457 (setq buffers (cons (current-buffer) buffers)
458 Info-dir-file-attributes
459 (cons (cons file attrs)
460 Info-dir-file-attributes))))))
461 (setq dirs (cdr dirs))))
462
463 (or buffers
464 (error "Can't find the info directory node"))
465 ;; Distinguish the dir file that comes with Emacs from all the
466 ;; others. Yes, that is really what this is supposed to do.
467 ;; If it doesn't work, fix it.
468 (setq buffer (car buffers)
469 others (cdr buffers))
470
471 ;; Insert the entire original dir file as a start; use its
472 ;; default directory as the default directory for the whole
473 ;; concatenation.
474 (insert-buffer buffer)
475 (setq Info-dir-contents-directory (save-excursion
476 (set-buffer buffer)
477 default-directory))
478
479 ;; Look at each of the other buffers one by one.
480 (while others
481 (let ((other (car others)))
482 ;; In each, find all the menus.
483 (save-excursion
484 (set-buffer other)
485 (goto-char (point-min))
486 ;; Find each menu, and add an elt to NODES for it.
487 (while (re-search-forward "^\\* Menu:" nil t)
488 (let (beg nodename end)
489 (forward-line 1)
490 (setq beg (point))
491 (search-backward "\n\^_")
492 (search-forward "Node: ")
493 (setq nodename (Info-following-node-name))
494 (search-forward "\n\^_" nil 'move)
495 (beginning-of-line)
496 (setq end (point))
497 (setq nodes (cons (list nodename other beg end) nodes))))))
498 (setq others (cdr others)))
499 ;; Add to the main menu a menu item for each other node.
500 (re-search-forward "^\\* Menu:")
501 (forward-line 1)
502 (let ((menu-items '("top"))
503 (nodes nodes)
504 (case-fold-search t)
505 (end (save-excursion (search-forward "\^_" nil t) (point))))
506 (while nodes
507 (let ((nodename (car (car nodes))))
508 (save-excursion
509 (or (member (downcase nodename) menu-items)
510 (re-search-forward (concat "^\\* "
511 (regexp-quote nodename)
512 "::")
513 end t)
514 (progn
515 (insert "* " nodename "::" "\n")
516 (setq menu-items (cons nodename menu-items))))))
517 (setq nodes (cdr nodes))))
518 ;; Now take each node of each of the other buffers
519 ;; and merge it into the main buffer.
520 (while nodes
521 (let ((nodename (car (car nodes))))
522 (goto-char (point-min))
523 ;; Find the like-named node in the main buffer.
524 (if (re-search-forward (concat "\n\^_.*\n.*Node: "
525 (regexp-quote nodename)
526 "[,\n\t]")
527 nil t)
528 (progn
529 (search-forward "\n\^_" nil 'move)
530 (beginning-of-line)
531 (insert "\n"))
532 ;; If none exists, add one.
533 (goto-char (point-max))
534 (insert "\^_\nFile: dir\tNode: " nodename "\n\n* Menu:\n\n"))
535 ;; Merge the text from the other buffer's menu
536 ;; into the menu in the like-named node in the main buffer.
537 (apply 'insert-buffer-substring (cdr (car nodes))))
538 (setq nodes (cdr nodes)))
539 ;; Kill all the buffers we just made.
540 (while buffers
541 (kill-buffer (car buffers))
542 (setq buffers (cdr buffers)))
543 (message "Composing main Info directory...done"))
544 (setq Info-dir-contents (buffer-string)))
545 (setq default-directory Info-dir-contents-directory))
546
547 (defun Info-read-subfile (nodepos)
548 (set-buffer (marker-buffer Info-tag-table-marker))
549 (goto-char (point-min))
550 (search-forward "\n\^_")
551 (let (lastfilepos
552 lastfilename)
553 (forward-line 2)
554 (catch 'foo
555 (while (not (looking-at "\^_"))
556 (if (not (eolp))
557 (let ((beg (point))
558 thisfilepos thisfilename)
559 (search-forward ": ")
560 (setq thisfilename (buffer-substring beg (- (point) 2)))
561 (setq thisfilepos (read (current-buffer)))
562 ;; read in version 19 stops at the end of number.
563 ;; Advance to the next line.
564 (forward-line 1)
565 (if (> thisfilepos nodepos)
566 (throw 'foo t))
567 (setq lastfilename thisfilename)
568 (setq lastfilepos thisfilepos))
569 (forward-line 1))))
570 (set-buffer (get-buffer "*info*"))
571 (or (equal Info-current-subfile lastfilename)
572 (let ((buffer-read-only nil))
573 (setq buffer-file-name nil)
574 (widen)
575 (erase-buffer)
576 (info-insert-file-contents lastfilename)
577 (set-buffer-modified-p nil)
578 (setq Info-current-subfile lastfilename)))
579 (goto-char (point-min))
580 (search-forward "\n\^_")
581 (+ (- nodepos lastfilepos) (point))))
582
583 ;; Select the info node that point is in.
584 (defun Info-select-node ()
585 (save-excursion
586 ;; Find beginning of node.
587 (search-backward "\n\^_")
588 (forward-line 2)
589 ;; Get nodename spelled as it is in the node.
590 (re-search-forward "Node:[ \t]*")
591 (setq Info-current-node
592 (buffer-substring-no-properties (point)
593 (progn
594 (skip-chars-forward "^,\t\n")
595 (point))))
596 (Info-set-mode-line)
597 ;; Find the end of it, and narrow.
598 (beginning-of-line)
599 (let (active-expression)
600 (narrow-to-region (point)
601 (if (re-search-forward "\n[\^_\f]" nil t)
602 (prog1
603 (1- (point))
604 (if (looking-at "[\n\^_\f]*execute: ")
605 (progn
606 (goto-char (match-end 0))
607 (setq active-expression
608 (read (current-buffer))))))
609 (point-max)))
610 (if Info-enable-active-nodes (eval active-expression))
611 (if Info-fontify (Info-fontify-node))
612 (run-hooks 'Info-selection-hook))))
613
614 (defun Info-set-mode-line ()
615 (setq mode-line-buffer-identification
616 (concat
617 "Info: ("
618 (if Info-current-file
619 (file-name-nondirectory Info-current-file)
620 "")
621 ")"
622 (or Info-current-node ""))))
623 \f
624 ;; Go to an info node specified with a filename-and-nodename string
625 ;; of the sort that is found in pointers in nodes.
626
627 (defun Info-goto-node (nodename)
628 "Go to info node named NAME. Give just NODENAME or (FILENAME)NODENAME."
629 (interactive (list (Info-read-node-name "Goto node: ")))
630 (let (filename)
631 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
632 nodename)
633 (setq filename (if (= (match-beginning 1) (match-end 1))
634 ""
635 (substring nodename (match-beginning 2) (match-end 2)))
636 nodename (substring nodename (match-beginning 3) (match-end 3)))
637 (let ((trim (string-match "\\s *\\'" filename)))
638 (if trim (setq filename (substring filename 0 trim))))
639 (let ((trim (string-match "\\s *\\'" nodename)))
640 (if trim (setq nodename (substring nodename 0 trim))))
641 (if transient-mark-mode (deactivate-mark))
642 (Info-find-node (if (equal filename "") nil filename)
643 (if (equal nodename "") "Top" nodename))))
644
645 ;; This function is used as the "completion table" while reading a node name.
646 ;; It does completion using the alist in completion-table
647 ;; unless STRING starts with an open-paren.
648 (defun Info-read-node-name-1 (string predicate code)
649 (let ((no-completion (and (> (length string) 0) (eq (aref string 0) ?\())))
650 (cond ((eq code nil)
651 (if no-completion
652 string
653 (try-completion string completion-table predicate)))
654 ((eq code t)
655 (if no-completion
656 nil
657 (all-completions string completion-table predicate)))
658 ((eq code 'lambda)
659 (if no-completion
660 t
661 (assoc string completion-table))))))
662
663 (defun Info-read-node-name (prompt &optional default)
664 (let* ((completion-ignore-case t)
665 (completion-table (Info-build-node-completions))
666 (nodename (completing-read prompt 'Info-read-node-name-1)))
667 (if (equal nodename "")
668 (or default
669 (Info-read-node-name prompt))
670 nodename)))
671
672 (defun Info-build-node-completions ()
673 (or Info-current-file-completions
674 (let ((compl nil))
675 (save-excursion
676 (save-restriction
677 (if (marker-buffer Info-tag-table-marker)
678 (progn
679 (set-buffer (marker-buffer Info-tag-table-marker))
680 (widen)
681 (goto-char Info-tag-table-marker)
682 (while (re-search-forward "\nNode: \\(.*\\)\177" nil t)
683 (setq compl
684 (cons (list (buffer-substring (match-beginning 1)
685 (match-end 1)))
686 compl))))
687 (widen)
688 (goto-char (point-min))
689 (while (search-forward "\n\^_" nil t)
690 (forward-line 1)
691 (let ((beg (point)))
692 (forward-line 1)
693 (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]"
694 beg t)
695 (setq compl
696 (cons (list (buffer-substring (match-beginning 1)
697 (match-end 1)))
698 compl))))))))
699 (setq Info-current-file-completions compl))))
700 \f
701 (defun Info-restore-point (hl)
702 "If this node has been visited, restore the point value when we left."
703 (while hl
704 (if (and (equal (nth 0 (car hl)) Info-current-file)
705 ;; Use string-equal, not equal, to ignore text props.
706 (string-equal (nth 1 (car hl)) Info-current-node))
707 (progn
708 (goto-char (nth 2 (car hl)))
709 (setq hl nil)) ;terminate the while at next iter
710 (setq hl (cdr hl)))))
711 \f
712 (defvar Info-last-search nil
713 "Default regexp for \\<Info-mode-map>\\[Info-search] command to search for.")
714
715 (defun Info-search (regexp)
716 "Search for REGEXP, starting from point, and select node it's found in."
717 (interactive "sSearch (regexp): ")
718 (if transient-mark-mode (deactivate-mark))
719 (if (equal regexp "")
720 (setq regexp Info-last-search)
721 (setq Info-last-search regexp))
722 (let ((found ()) current
723 (onode Info-current-node)
724 (ofile Info-current-file)
725 (opoint (point))
726 (osubfile Info-current-subfile))
727 (save-excursion
728 (save-restriction
729 (widen)
730 (if (null Info-current-subfile)
731 (progn (re-search-forward regexp) (setq found (point)))
732 (condition-case err
733 (progn (re-search-forward regexp) (setq found (point)))
734 (search-failed nil)))))
735 (if (not found) ;can only happen in subfile case -- else would have erred
736 (unwind-protect
737 (let ((list ()))
738 (set-buffer (marker-buffer Info-tag-table-marker))
739 (goto-char (point-min))
740 (search-forward "\n\^_\nIndirect:")
741 (save-restriction
742 (narrow-to-region (point)
743 (progn (search-forward "\n\^_")
744 (1- (point))))
745 (goto-char (point-min))
746 (search-forward (concat "\n" osubfile ": "))
747 (beginning-of-line)
748 (while (not (eobp))
749 (re-search-forward "\\(^.*\\): [0-9]+$")
750 (goto-char (+ (match-end 1) 2))
751 (setq list (cons (cons (read (current-buffer))
752 (buffer-substring (match-beginning 1)
753 (match-end 1)))
754 list))
755 (goto-char (1+ (match-end 0))))
756 (setq list (nreverse list)
757 current (car (car list))
758 list (cdr list)))
759 (while list
760 (message "Searching subfile %s..." (cdr (car list)))
761 (Info-read-subfile (car (car list)))
762 (setq list (cdr list))
763 ;; (goto-char (point-min))
764 (if (re-search-forward regexp nil t)
765 (setq found (point) list ())))
766 (if found
767 (message "")
768 (signal 'search-failed (list regexp))))
769 (if (not found)
770 (progn (Info-read-subfile opoint)
771 (goto-char opoint)
772 (Info-select-node)))))
773 (widen)
774 (goto-char found)
775 (Info-select-node)
776 ;; Use string-equal, not equal, to ignore text props.
777 (or (and (string-equal onode Info-current-node)
778 (equal ofile Info-current-file))
779 (setq Info-history (cons (list ofile onode opoint)
780 Info-history)))))
781 \f
782 ;; Extract the value of the node-pointer named NAME.
783 ;; If there is none, use ERRORNAME in the error message;
784 ;; if ERRORNAME is nil, just return nil.
785 (defun Info-extract-pointer (name &optional errorname)
786 (save-excursion
787 (goto-char (point-min))
788 (forward-line 1)
789 (if (re-search-backward (concat name ":") nil t)
790 (progn
791 (goto-char (match-end 0))
792 (Info-following-node-name))
793 (if (eq errorname t)
794 nil
795 (error (concat "Node has no " (capitalize (or errorname name))))))))
796
797 ;; Return the node name in the buffer following point.
798 ;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
799 ;; saying which chas may appear in the node name.
800 (defun Info-following-node-name (&optional allowedchars)
801 (skip-chars-forward " \t")
802 (buffer-substring-no-properties
803 (point)
804 (progn
805 (while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
806 (skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
807 (if (looking-at "(")
808 (skip-chars-forward "^)")))
809 (skip-chars-backward " ")
810 (point))))
811
812 (defun Info-next ()
813 "Go to the next node of this node."
814 (interactive)
815 (Info-goto-node (Info-extract-pointer "next")))
816
817 (defun Info-prev ()
818 "Go to the previous node of this node."
819 (interactive)
820 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous")))
821
822 (defun Info-up ()
823 "Go to the superior node of this node."
824 (interactive)
825 (Info-goto-node (Info-extract-pointer "up"))
826 (Info-restore-point Info-history))
827
828 (defun Info-last ()
829 "Go back to the last node visited."
830 (interactive)
831 (or Info-history
832 (error "This is the first Info node you looked at"))
833 (let (filename nodename opoint)
834 (setq filename (car (car Info-history)))
835 (setq nodename (car (cdr (car Info-history))))
836 (setq opoint (car (cdr (cdr (car Info-history)))))
837 (setq Info-history (cdr Info-history))
838 (Info-find-node filename nodename)
839 (setq Info-history (cdr Info-history))
840 (goto-char opoint)))
841
842 (defun Info-directory ()
843 "Go to the Info directory node."
844 (interactive)
845 (Info-find-node "dir" "top"))
846 \f
847 (defun Info-follow-reference (footnotename)
848 "Follow cross reference named NAME to the node it refers to.
849 NAME may be an abbreviation of the reference name."
850 (interactive
851 (let ((completion-ignore-case t)
852 completions default alt-default (start-point (point)) str i bol eol)
853 (save-excursion
854 ;; Store end and beginning of line.
855 (end-of-line)
856 (setq eol (point))
857 (beginning-of-line)
858 (setq bol (point))
859
860 (goto-char (point-min))
861 (while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t)
862 (setq str (buffer-substring
863 (match-beginning 1)
864 (1- (point))))
865 ;; See if this one should be the default.
866 (and (null default)
867 (<= (match-beginning 0) start-point)
868 (<= start-point (point))
869 (setq default t))
870 ;; See if this one should be the alternate default.
871 (and (null alt-default)
872 (and (<= bol (match-beginning 0))
873 (<= (point) eol))
874 (setq alt-default t))
875 (setq i 0)
876 (while (setq i (string-match "[ \n\t]+" str i))
877 (setq str (concat (substring str 0 i) " "
878 (substring str (match-end 0))))
879 (setq i (1+ i)))
880 ;; Record as a completion and perhaps as default.
881 (if (eq default t) (setq default str))
882 (if (eq alt-default t) (setq alt-default str))
883 (setq completions
884 (cons (cons str nil)
885 completions))))
886 ;; If no good default was found, try an alternate.
887 (or default
888 (setq default alt-default))
889 ;; If only one cross-reference found, then make it default.
890 (if (eq (length completions) 1)
891 (setq default (car (car completions))))
892 (if completions
893 (let ((input (completing-read (if default
894 (concat "Follow reference named: ("
895 default ") ")
896 "Follow reference named: ")
897 completions nil t)))
898 (list (if (equal input "")
899 default input)))
900 (error "No cross-references in this node"))))
901 (let (target beg i (str (concat "\\*note " (regexp-quote footnotename))))
902 (while (setq i (string-match " " str i))
903 (setq str (concat (substring str 0 i) "[ \t\n]+" (substring str (1+ i))))
904 (setq i (+ i 6)))
905 (save-excursion
906 (goto-char (point-min))
907 (or (re-search-forward str nil t)
908 (error "No cross-reference named %s" footnotename))
909 (goto-char (+ (match-beginning 0) 5))
910 (setq target
911 (Info-extract-menu-node-name "Bad format cross reference" t)))
912 (while (setq i (string-match "[ \t\n]+" target i))
913 (setq target (concat (substring target 0 i) " "
914 (substring target (match-end 0))))
915 (setq i (+ i 1)))
916 (Info-goto-node target)))
917
918 (defun Info-extract-menu-node-name (&optional errmessage multi-line)
919 (skip-chars-forward " \t\n")
920 (let ((beg (point))
921 str i)
922 (skip-chars-forward "^:")
923 (forward-char 1)
924 (setq str
925 (if (looking-at ":")
926 (buffer-substring-no-properties beg (1- (point)))
927 (skip-chars-forward " \t\n")
928 (Info-following-node-name (if multi-line "^.,\t" "^.,\t\n"))))
929 (while (setq i (string-match "\n" str i))
930 (aset str i ?\ ))
931 ;; Collapse multiple spaces.
932 (while (string-match " +" str)
933 (setq str (replace-match " " t t str)))
934 str))
935
936 ;; No one calls this.
937 ;;(defun Info-menu-item-sequence (list)
938 ;; (while list
939 ;; (Info-menu (car list))
940 ;; (setq list (cdr list))))
941
942 (defun Info-complete-menu-item (string predicate action)
943 (let ((case-fold-search t))
944 (cond ((eq action nil)
945 (let (completions
946 (pattern (concat "\n\\* \\("
947 (regexp-quote string)
948 "[^:\t\n]*\\):")))
949 (save-excursion
950 (set-buffer Info-complete-menu-buffer)
951 (goto-char (point-min))
952 (search-forward "\n* Menu:")
953 (while (re-search-forward pattern nil t)
954 (setq completions (cons (cons (format "%s"
955 (buffer-substring
956 (match-beginning 1)
957 (match-end 1)))
958 (match-beginning 1))
959 completions))))
960 (try-completion string completions predicate)))
961 ((eq action t)
962 (let (completions
963 (pattern (concat "\n\\* \\("
964 (regexp-quote string)
965 "[^:\t\n]*\\):")))
966 (save-excursion
967 (set-buffer Info-complete-menu-buffer)
968 (goto-char (point-min))
969 (search-forward "\n* Menu:")
970 (while (re-search-forward pattern nil t)
971 (setq completions (cons (cons (format "%s"
972 (buffer-substring
973 (match-beginning 1)
974 (match-end 1)))
975 (match-beginning 1))
976 completions))))
977 (all-completions string completions predicate)))
978 (t
979 (save-excursion
980 (set-buffer Info-complete-menu-buffer)
981 (goto-char (point-min))
982 (search-forward "\n* Menu:")
983 (re-search-forward (concat "\n\\* "
984 (regexp-quote string)
985 ":")
986 nil t))))))
987
988
989 (defun Info-menu (menu-item)
990 "Go to node for menu item named (or abbreviated) NAME.
991 Completion is allowed, and the menu item point is on is the default."
992 (interactive
993 (let ((completions '())
994 ;; If point is within a menu item, use that item as the default
995 (default nil)
996 (p (point))
997 beg
998 (last nil))
999 (save-excursion
1000 (goto-char (point-min))
1001 (if (not (search-forward "\n* menu:" nil t))
1002 (error "No menu in this node"))
1003 (setq beg (point))
1004 (and (< (point) p)
1005 (save-excursion
1006 (goto-char p)
1007 (end-of-line)
1008 (re-search-backward "\n\\* \\([^:\t\n]*\\):" beg t)
1009 (setq default (format "%s" (buffer-substring
1010 (match-beginning 1)
1011 (match-end 1)))))))
1012 (let ((item nil))
1013 (while (null item)
1014 (setq item (let ((completion-ignore-case t)
1015 (Info-complete-menu-buffer (current-buffer)))
1016 (completing-read (if default
1017 (format "Menu item (default %s): "
1018 default)
1019 "Menu item: ")
1020 'Info-complete-menu-item nil t)))
1021 ;; we rely on the fact that completing-read accepts an input
1022 ;; of "" even when the require-match argument is true and ""
1023 ;; is not a valid possibility
1024 (if (string= item "")
1025 (if default
1026 (setq item default)
1027 ;; ask again
1028 (setq item nil))))
1029 (list item))))
1030 ;; there is a problem here in that if several menu items have the same
1031 ;; name you can only go to the node of the first with this command.
1032 (Info-goto-node (Info-extract-menu-item menu-item)))
1033
1034 (defun Info-extract-menu-item (menu-item)
1035 (setq menu-item (regexp-quote menu-item))
1036 (save-excursion
1037 (goto-char (point-min))
1038 (or (search-forward "\n* menu:" nil t)
1039 (error "No menu in this node"))
1040 (or (re-search-forward (concat "\n\\* " menu-item ":") nil t)
1041 (re-search-forward (concat "\n\\* " menu-item) nil t)
1042 (error "No such item in menu"))
1043 (beginning-of-line)
1044 (forward-char 2)
1045 (Info-extract-menu-node-name)))
1046
1047 ;; If COUNT is nil, use the last item in the menu.
1048 (defun Info-extract-menu-counting (count)
1049 (save-excursion
1050 (goto-char (point-min))
1051 (or (search-forward "\n* menu:" nil t)
1052 (error "No menu in this node"))
1053 (if count
1054 (or (search-forward "\n* " nil t count)
1055 (error "Too few items in menu"))
1056 (while (search-forward "\n* " nil t)
1057 nil))
1058 (Info-extract-menu-node-name)))
1059
1060 (defun Info-nth-menu-item ()
1061 "Go to the node of the Nth menu item.
1062 N is the digit argument used to invoke this command."
1063 (interactive)
1064 (Info-goto-node
1065 (Info-extract-menu-counting
1066 (- (aref (this-command-keys) (1- (length (this-command-keys)))) ?0))))
1067
1068 (defun Info-top-node ()
1069 "Go to the Top node of this file."
1070 (interactive)
1071 (Info-goto-node "Top"))
1072
1073 (defun Info-final-node ()
1074 "Go to the final node in this file."
1075 (interactive)
1076 (Info-goto-node "Top")
1077 (let (Info-history)
1078 ;; Go to the last node in the menu of Top.
1079 (Info-goto-node (Info-extract-menu-counting nil))
1080 ;; If the last node in the menu is not last in pointer structure,
1081 ;; move forward until we can't go any farther.
1082 (while (Info-forward-node t t) nil)
1083 ;; Then keep moving down to last subnode, unless we reach an index.
1084 (while (and (not (string-match "\\<index\\>" Info-current-node))
1085 (save-excursion (search-forward "\n* Menu:" nil t)))
1086 (Info-goto-node (Info-extract-menu-counting nil)))))
1087
1088 (defun Info-forward-node (&optional not-down no-error)
1089 "Go forward one node, considering all nodes as forming one sequence."
1090 (interactive)
1091 (goto-char (point-min))
1092 (forward-line 1)
1093 ;; three possibilities, in order of priority:
1094 ;; 1. next node is in a menu in this node (but not in an index)
1095 ;; 2. next node is next at same level
1096 ;; 3. next node is up and next
1097 (cond ((and (not not-down)
1098 (save-excursion (search-forward "\n* menu:" nil t))
1099 (not (string-match "\\<index\\>" Info-current-node)))
1100 (Info-goto-node (Info-extract-menu-counting 1))
1101 t)
1102 ((save-excursion (search-backward "next:" nil t))
1103 (Info-next)
1104 t)
1105 ((and (save-excursion (search-backward "up:" nil t))
1106 ;; Use string-equal, not equal, to ignore text props.
1107 (not (string-equal (downcase (Info-extract-pointer "up"))
1108 "top")))
1109 (let ((old-node Info-current-node))
1110 (Info-up)
1111 (let (Info-history success)
1112 (unwind-protect
1113 (setq success (Info-forward-node t no-error))
1114 (or success (Info-goto-node old-node))))))
1115 (no-error nil)
1116 (t (error "No pointer forward from this node"))))
1117
1118 (defun Info-backward-node ()
1119 "Go backward one node, considering all nodes as forming one sequence."
1120 (interactive)
1121 (let ((prevnode (Info-extract-pointer "prev[ious]*" t))
1122 (upnode (Info-extract-pointer "up" t)))
1123 (cond ((and upnode (string-match "(" upnode))
1124 (error "First node in file"))
1125 ((and upnode (or (null prevnode)
1126 ;; Use string-equal, not equal,
1127 ;; to ignore text properties.
1128 (string-equal (downcase prevnode)
1129 (downcase upnode))))
1130 (Info-up))
1131 (prevnode
1132 ;; If we move back at the same level,
1133 ;; go down to find the last subnode*.
1134 (Info-prev)
1135 (let (Info-history)
1136 (while (and (not (string-match "\\<index\\>" Info-current-node))
1137 (save-excursion (search-forward "\n* Menu:" nil t)))
1138 (Info-goto-node (Info-extract-menu-counting nil)))))
1139 (t
1140 (error "No pointer backward from this node")))))
1141
1142 (defun Info-exit ()
1143 "Exit Info by selecting some other buffer."
1144 (interactive)
1145 (if Info-standalone
1146 (save-buffers-kill-emacs)
1147 (switch-to-buffer (prog1 (other-buffer (current-buffer))
1148 (bury-buffer (current-buffer))))))
1149
1150 (defun Info-next-menu-item ()
1151 (interactive)
1152 (save-excursion
1153 (forward-line -1)
1154 (search-forward "\n* menu:" nil t)
1155 (or (search-forward "\n* " nil t)
1156 (error "No more items in menu"))
1157 (Info-goto-node (Info-extract-menu-node-name))))
1158
1159 (defun Info-last-menu-item ()
1160 (interactive)
1161 (save-excursion
1162 (forward-line 1)
1163 (let ((beg (save-excursion
1164 (and (search-backward "\n* menu:" nil t)
1165 (point)))))
1166 (or (and beg (search-backward "\n* " beg t))
1167 (error "No previous items in menu")))
1168 (Info-goto-node (save-excursion
1169 (goto-char (match-end 0))
1170 (Info-extract-menu-node-name)))))
1171
1172 (defmacro Info-no-error (&rest body)
1173 (list 'condition-case nil (cons 'progn (append body '(t))) '(error nil)))
1174
1175 (defun Info-next-preorder ()
1176 "Go to the next subnode or the next node, or go up a level."
1177 (interactive)
1178 (cond ((Info-no-error (Info-next-menu-item)))
1179 ((Info-no-error (Info-next)))
1180 ((Info-no-error (Info-up))
1181 ;; Since we have already gone thru all the items in this menu,
1182 ;; go up to the end of this node.
1183 (goto-char (point-max)))
1184 (t
1185 (error "No more nodes"))))
1186
1187 (defun Info-last-preorder ()
1188 "Go to the last node, popping up a level if there is none."
1189 (interactive)
1190 (cond ((Info-no-error
1191 (Info-last-menu-item)
1192 ;; If we go down a menu item, go to the end of the node
1193 ;; so we can scroll back through it.
1194 (goto-char (point-max)))
1195 (recenter -1))
1196 ((Info-no-error (Info-prev))
1197 (goto-char (point-max))
1198 (recenter -1))
1199 ((Info-no-error (Info-up))
1200 (goto-char (point-min))
1201 (or (search-forward "\n* Menu:" nil t)
1202 (goto-char (point-max))))
1203 (t (error "No previous nodes"))))
1204
1205 (defun Info-scroll-up ()
1206 "Scroll one screenful forward in Info, considering all nodes as one sequence.
1207 Once you scroll far enough in a node that its menu appears on the screen,
1208 the next scroll moves into its first subnode. When you scroll past
1209 the end of a node, that goes to the next node or back up to the parent node."
1210 (interactive)
1211 (if (or (< (window-start) (point-min))
1212 (> (window-start) (point-max)))
1213 (set-window-start (selected-window) (point)))
1214 (let ((virtual-end (save-excursion
1215 (goto-char (point-min))
1216 (if (search-forward "\n* Menu:" nil t)
1217 (point)
1218 (point-max)))))
1219 (if (or (< virtual-end (window-start))
1220 (pos-visible-in-window-p virtual-end))
1221 (Info-next-preorder)
1222 (scroll-up))))
1223
1224 (defun Info-scroll-down ()
1225 "Scroll one screenful back in Info, considering all nodes as one sequence.
1226 Within the menu of a node, this goes to its last subnode.
1227 When you scroll past the beginning of a node, that goes to the
1228 previous node or back up to the parent node."
1229 (interactive)
1230 (if (or (< (window-start) (point-min))
1231 (> (window-start) (point-max)))
1232 (set-window-start (selected-window) (point)))
1233 (let ((virtual-end (save-excursion
1234 (goto-char (point-min))
1235 (search-forward "\n* Menu:" nil t))))
1236 (if (or virtual-end (pos-visible-in-window-p (point-min)))
1237 (Info-last-preorder)
1238 (scroll-down))))
1239
1240 (defun Info-next-reference ()
1241 "Move cursor to the next cross-reference or menu item in the node."
1242 (interactive)
1243 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:")
1244 (old-pt (point)))
1245 (or (eobp) (forward-char 1))
1246 (or (re-search-forward pat nil t)
1247 (progn
1248 (goto-char (point-min))
1249 (or (re-search-forward pat nil t)
1250 (progn
1251 (goto-char old-pt)
1252 (error "No cross references in this node")))))
1253 (goto-char (match-beginning 0))
1254 (if (looking-at "\\* Menu:")
1255 (Info-next-reference))))
1256
1257 (defun Info-prev-reference ()
1258 "Move cursor to the previous cross-reference or menu item in the node."
1259 (interactive)
1260 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:")
1261 (old-pt (point)))
1262 (or (re-search-backward pat nil t)
1263 (progn
1264 (goto-char (point-max))
1265 (or (re-search-backward pat nil t)
1266 (progn
1267 (goto-char old-pt)
1268 (error "No cross references in this node")))))
1269 (goto-char (match-beginning 0))
1270 (if (looking-at "\\* Menu:")
1271 (Info-prev-reference))))
1272
1273 (defun Info-index (topic)
1274 "Look up a string in the index for this file.
1275 The index is defined as the first node in the top-level menu whose
1276 name contains the word \"Index\", plus any immediately following
1277 nodes whose names also contain the word \"Index\".
1278 If there are no exact matches to the specified topic, this chooses
1279 the first match which is a case-insensitive substring of a topic.
1280 Use the `,' command to see the other matches.
1281 Give a blank topic name to go to the Index node itself."
1282 (interactive "sIndex topic: ")
1283 (let ((orignode Info-current-node)
1284 (rnode nil)
1285 (pattern (format "\n\\* \\([^\n:]*%s[^\n:]*\\):[ \t]*\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)"
1286 (regexp-quote topic)))
1287 node)
1288 (Info-goto-node "Top")
1289 (or (search-forward "\n* menu:" nil t)
1290 (error "No index"))
1291 (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
1292 (error "No index"))
1293 (goto-char (match-beginning 1))
1294 ;; Here, and subsequently in this function,
1295 ;; we bind Info-history to nil for internal node-switches
1296 ;; so that we don't put junk in the history.
1297 ;; In the first Info-goto-node call, above, we do update the history
1298 ;; because that is what the user's previous node choice into it.
1299 (let ((Info-history nil))
1300 (Info-goto-node (Info-extract-menu-node-name)))
1301 (or (equal topic "")
1302 (let ((matches nil)
1303 (exact nil)
1304 (Info-history nil)
1305 found)
1306 (while
1307 (progn
1308 (goto-char (point-min))
1309 (while (re-search-forward pattern nil t)
1310 (setq matches
1311 (cons (list (buffer-substring (match-beginning 1)
1312 (match-end 1))
1313 (buffer-substring (match-beginning 2)
1314 (match-end 2))
1315 Info-current-node
1316 (string-to-int (concat "0"
1317 (buffer-substring
1318 (match-beginning 3)
1319 (match-end 3)))))
1320 matches)))
1321 (and (setq node (Info-extract-pointer "next" t))
1322 (string-match "\\<Index\\>" node)))
1323 (Info-goto-node node))
1324 (or matches
1325 (progn
1326 (Info-last)
1327 (error "No \"%s\" in index" topic)))
1328 ;; Here it is a feature that assoc is case-sensitive.
1329 (while (setq found (assoc topic matches))
1330 (setq exact (cons found exact)
1331 matches (delq found matches)))
1332 (setq Info-index-alternatives (nconc exact (nreverse matches)))
1333 (Info-index-next 0)))))
1334
1335 (defun Info-index-next (num)
1336 "Go to the next matching index item from the last `i' command."
1337 (interactive "p")
1338 (or Info-index-alternatives
1339 (error "No previous `i' command in this file"))
1340 (while (< num 0)
1341 (setq num (+ num (length Info-index-alternatives))))
1342 (while (> num 0)
1343 (setq Info-index-alternatives
1344 (nconc (cdr Info-index-alternatives)
1345 (list (car Info-index-alternatives)))
1346 num (1- num)))
1347 (Info-goto-node (nth 1 (car Info-index-alternatives)))
1348 (if (> (nth 3 (car Info-index-alternatives)) 0)
1349 (forward-line (nth 3 (car Info-index-alternatives)))
1350 (forward-line 3) ; don't search in headers
1351 (let ((name (car (car Info-index-alternatives))))
1352 (if (or (re-search-forward (format
1353 "\\(Function\\|Command\\): %s\\( \\|$\\)"
1354 (regexp-quote name)) nil t)
1355 (search-forward (format "`%s'" name) nil t)
1356 (and (string-match "\\`.*\\( (.*)\\)\\'" name)
1357 (search-forward
1358 (format "`%s'" (substring name 0 (match-beginning 1)))
1359 nil t))
1360 (search-forward name nil t))
1361 (beginning-of-line)
1362 (goto-char (point-min)))))
1363 (message "Found \"%s\" in %s. %s"
1364 (car (car Info-index-alternatives))
1365 (nth 2 (car Info-index-alternatives))
1366 (if (cdr Info-index-alternatives)
1367 "(Press `,' for more)"
1368 "(Only match)")))
1369
1370 (defun Info-undefined ()
1371 "Make command be undefined in Info."
1372 (interactive)
1373 (ding))
1374
1375 (defun Info-help ()
1376 "Enter the Info tutorial."
1377 (interactive)
1378 (delete-other-windows)
1379 (Info-find-node "info"
1380 (if (< (window-height) 23)
1381 "Help-Small-Screen"
1382 "Help")))
1383
1384 (defun Info-summary ()
1385 "Display a brief summary of all Info commands."
1386 (interactive)
1387 (save-window-excursion
1388 (switch-to-buffer "*Help*")
1389 (erase-buffer)
1390 (insert (documentation 'Info-mode))
1391 (help-mode)
1392 (goto-char (point-min))
1393 (let (ch flag)
1394 (while (progn (setq flag (not (pos-visible-in-window-p (point-max))))
1395 (message (if flag "Type Space to see more"
1396 "Type Space to return to Info"))
1397 (if (not (eq ?\ (setq ch (read-event))))
1398 (progn (setq unread-command-events (list ch)) nil)
1399 flag))
1400 (scroll-up)))
1401 (bury-buffer "*Help*")))
1402 \f
1403 (defun Info-get-token (pos start all &optional errorstring)
1404 "Return the token around POS,
1405 POS must be somewhere inside the token
1406 START is a regular expression which will match the
1407 beginning of the tokens delimited string
1408 ALL is a regular expression with a single
1409 parenthesized subpattern which is the token to be
1410 returned. E.g. '{\(.*\)}' would return any string
1411 enclosed in braces around POS.
1412 SIG optional fourth argument, controls action on no match
1413 nil: return nil
1414 t: beep
1415 a string: signal an error, using that string."
1416 (save-excursion
1417 (goto-char pos)
1418 (re-search-backward start (max (point-min) (- pos 200)) 'yes)
1419 (let (found)
1420 (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes)
1421 (not (setq found (and (<= (match-beginning 0) pos)
1422 (> (match-end 0) pos))))))
1423 (if (and found (<= (match-beginning 0) pos)
1424 (> (match-end 0) pos))
1425 (buffer-substring (match-beginning 1) (match-end 1))
1426 (cond ((null errorstring)
1427 nil)
1428 ((eq errorstring t)
1429 (beep)
1430 nil)
1431 (t
1432 (error "No %s around position %d" errorstring pos)))))))
1433
1434 (defun Info-mouse-follow-nearest-node (click)
1435 "\\<Info-mode-map>Follow a node reference near point.
1436 Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where you click.
1437 At end of the node's text, moves to the next node, or up if none."
1438 (interactive "e")
1439 (let* ((start (event-start click))
1440 (window (car start))
1441 (pos (car (cdr start))))
1442 (select-window window)
1443 (goto-char pos))
1444 (and (not (Info-try-follow-nearest-node))
1445 (save-excursion (forward-line 1) (eobp))
1446 (Info-next-preorder)))
1447
1448 (defun Info-follow-nearest-node ()
1449 "\\<Info-mode-map>Follow a node reference near point.
1450 Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where point is.
1451 If no reference to follow, moves to the next node, or up if none."
1452 (interactive)
1453 (or (Info-try-follow-nearest-node)
1454 (Info-next-preorder)))
1455
1456 ;; Common subroutine.
1457 (defun Info-try-follow-nearest-node ()
1458 "Follow a node reference near point. Return non-nil if successful."
1459 (let (node)
1460 (cond
1461 ((setq node (Info-get-token (point) "\\*note[ \n]"
1462 "\\*note[ \n]\\([^:]*\\):"))
1463 (Info-follow-reference node))
1464 ((setq node (Info-get-token (point) "\\* " "\\* \\([^:]*\\)::"))
1465 (Info-goto-node node))
1466 ((setq node (Info-get-token (point) "\\* " "\\* \\([^:]*\\):"))
1467 (Info-menu node))
1468 ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))
1469 (Info-goto-node node))
1470 ((setq node (Info-get-token (point) "Next: " "Next: \\([^,\n\t]*\\)"))
1471 (Info-goto-node node))
1472 ((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)"))
1473 (Info-goto-node "Top"))
1474 ((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)"))
1475 (Info-goto-node node)))
1476 node))
1477 \f
1478 (defvar Info-mode-map nil
1479 "Keymap containing Info commands.")
1480 (if Info-mode-map
1481 nil
1482 (setq Info-mode-map (make-keymap))
1483 (suppress-keymap Info-mode-map)
1484 (define-key Info-mode-map "." 'beginning-of-buffer)
1485 (define-key Info-mode-map " " 'Info-scroll-up)
1486 (define-key Info-mode-map "\C-m" 'Info-follow-nearest-node)
1487 (define-key Info-mode-map "\t" 'Info-next-reference)
1488 (define-key Info-mode-map "\e\t" 'Info-prev-reference)
1489 (define-key Info-mode-map "1" 'Info-nth-menu-item)
1490 (define-key Info-mode-map "2" 'Info-nth-menu-item)
1491 (define-key Info-mode-map "3" 'Info-nth-menu-item)
1492 (define-key Info-mode-map "4" 'Info-nth-menu-item)
1493 (define-key Info-mode-map "5" 'Info-nth-menu-item)
1494 (define-key Info-mode-map "6" 'Info-nth-menu-item)
1495 (define-key Info-mode-map "7" 'Info-nth-menu-item)
1496 (define-key Info-mode-map "8" 'Info-nth-menu-item)
1497 (define-key Info-mode-map "9" 'Info-nth-menu-item)
1498 (define-key Info-mode-map "0" 'undefined)
1499 (define-key Info-mode-map "?" 'Info-summary)
1500 (define-key Info-mode-map "]" 'Info-forward-node)
1501 (define-key Info-mode-map "[" 'Info-backward-node)
1502 (define-key Info-mode-map "<" 'Info-top-node)
1503 (define-key Info-mode-map ">" 'Info-final-node)
1504 (define-key Info-mode-map "b" 'beginning-of-buffer)
1505 (define-key Info-mode-map "d" 'Info-directory)
1506 (define-key Info-mode-map "e" 'Info-edit)
1507 (define-key Info-mode-map "f" 'Info-follow-reference)
1508 (define-key Info-mode-map "g" 'Info-goto-node)
1509 (define-key Info-mode-map "h" 'Info-help)
1510 (define-key Info-mode-map "i" 'Info-index)
1511 (define-key Info-mode-map "l" 'Info-last)
1512 (define-key Info-mode-map "m" 'Info-menu)
1513 (define-key Info-mode-map "n" 'Info-next)
1514 (define-key Info-mode-map "p" 'Info-prev)
1515 (define-key Info-mode-map "q" 'Info-exit)
1516 (define-key Info-mode-map "s" 'Info-search)
1517 ;; For consistency with Rmail.
1518 (define-key Info-mode-map "\M-s" 'Info-search)
1519 (define-key Info-mode-map "t" 'Info-top-node)
1520 (define-key Info-mode-map "u" 'Info-up)
1521 (define-key Info-mode-map "," 'Info-index-next)
1522 (define-key Info-mode-map "\177" 'Info-scroll-down)
1523 (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node)
1524 )
1525 \f
1526 ;; Info mode is suitable only for specially formatted data.
1527 (put 'info-mode 'mode-class 'special)
1528
1529 (defun Info-mode ()
1530 "\\<Info-mode-map>
1531 Info mode provides commands for browsing through the Info documentation tree.
1532 Documentation in Info is divided into \"nodes\", each of which discusses
1533 one topic and contains references to other nodes which discuss related
1534 topics. Info has commands to follow the references and show you other nodes.
1535
1536 \\[Info-help] Invoke the Info tutorial.
1537
1538 Selecting other nodes:
1539 \\[Info-mouse-follow-nearest-node]
1540 Follow a node reference you click on.
1541 This works with menu items, cross references, and
1542 the \"next\", \"previous\" and \"up\", depending on where you click.
1543 \\[Info-next] Move to the \"next\" node of this node.
1544 \\[Info-prev] Move to the \"previous\" node of this node.
1545 \\[Info-up] Move \"up\" from this node.
1546 \\[Info-menu] Pick menu item specified by name (or abbreviation).
1547 Picking a menu item causes another node to be selected.
1548 \\[Info-directory] Go to the Info directory node.
1549 \\[Info-follow-reference] Follow a cross reference. Reads name of reference.
1550 \\[Info-last] Move to the last node you were at.
1551 \\[Info-index] Look up a topic in this file's Index and move to that node.
1552 \\[Info-index-next] (comma) Move to the next match from a previous `i' command.
1553
1554 Moving within a node:
1555 \\[Info-scroll-up] Normally, scroll forward a full screen. If the end of the buffer is
1556 already visible, try to go to the next menu entry, or up if there is none.
1557 \\[Info-scroll-down] Normally, scroll backward. If the beginning of the buffer is
1558 already visible, try to go to the previous menu entry, or up if there is none.
1559 \\[beginning-of-buffer] Go to beginning of node.
1560
1561 Advanced commands:
1562 \\[Info-exit] Quit Info: reselect previously selected buffer.
1563 \\[Info-edit] Edit contents of selected node.
1564 1 Pick first item in node's menu.
1565 2, 3, 4, 5 Pick second ... fifth item in node's menu.
1566 \\[Info-goto-node] Move to node specified by name.
1567 You may include a filename as well, as (FILENAME)NODENAME.
1568 \\[universal-argument] \\[info] Move to new Info file with completion.
1569 \\[Info-search] Search through this Info file for specified regexp,
1570 and select the node in which the next occurrence is found.
1571 \\[Info-next-reference] Move cursor to next cross-reference or menu item.
1572 \\[Info-prev-reference] Move cursor to previous cross-reference or menu item."
1573 (kill-all-local-variables)
1574 (setq major-mode 'Info-mode)
1575 (setq mode-name "Info")
1576 (use-local-map Info-mode-map)
1577 (set-syntax-table text-mode-syntax-table)
1578 (setq local-abbrev-table text-mode-abbrev-table)
1579 (setq case-fold-search t)
1580 (setq buffer-read-only t)
1581 (make-local-variable 'Info-current-file)
1582 (make-local-variable 'Info-current-subfile)
1583 (make-local-variable 'Info-current-node)
1584 (make-local-variable 'Info-tag-table-marker)
1585 (make-local-variable 'Info-history)
1586 (make-local-variable 'Info-index-alternatives)
1587 (if (memq (framep (selected-frame)) '(x pc))
1588 (progn
1589 (make-face 'info-node)
1590 (make-face 'info-menu-5)
1591 (make-face 'info-xref)
1592 (or (face-differs-from-default-p 'info-node)
1593 (if (face-differs-from-default-p 'bold-italic)
1594 (copy-face 'bold-italic 'info-node)
1595 (copy-face 'bold 'info-node)))
1596 (or (face-differs-from-default-p 'info-menu-5)
1597 (set-face-underline-p 'info-menu-5 t))
1598 (or (face-differs-from-default-p 'info-xref)
1599 (copy-face 'bold 'info-xref)))
1600 (setq Info-fontify nil))
1601 (Info-set-mode-line)
1602 (run-hooks 'Info-mode-hook))
1603
1604 (defvar Info-edit-map nil
1605 "Local keymap used within `e' command of Info.")
1606 (if Info-edit-map
1607 nil
1608 (setq Info-edit-map (nconc (make-sparse-keymap) text-mode-map))
1609 (define-key Info-edit-map "\C-c\C-c" 'Info-cease-edit))
1610
1611 ;; Info-edit mode is suitable only for specially formatted data.
1612 (put 'info-edit-mode 'mode-class 'special)
1613
1614 (defun Info-edit-mode ()
1615 "Major mode for editing the contents of an Info node.
1616 Like text mode with the addition of `Info-cease-edit'
1617 which returns to Info mode for browsing.
1618 \\{Info-edit-map}"
1619 (use-local-map Info-edit-map)
1620 (setq major-mode 'Info-edit-mode)
1621 (setq mode-name "Info Edit")
1622 (kill-local-variable 'mode-line-buffer-identification)
1623 (setq buffer-read-only nil)
1624 (force-mode-line-update)
1625 (buffer-enable-undo (current-buffer))
1626 (run-hooks 'Info-edit-mode-hook))
1627
1628 (defun Info-edit ()
1629 "Edit the contents of this Info node.
1630 Allowed only if variable `Info-enable-edit' is non-nil."
1631 (interactive)
1632 (or Info-enable-edit
1633 (error "Editing info nodes is not enabled"))
1634 (Info-edit-mode)
1635 (message (substitute-command-keys
1636 "Editing: Type \\<Info-edit-map>\\[Info-cease-edit] to return to info")))
1637
1638 (defun Info-cease-edit ()
1639 "Finish editing Info node; switch back to Info proper."
1640 (interactive)
1641 ;; Do this first, so nothing has changed if user C-g's at query.
1642 (and (buffer-modified-p)
1643 (y-or-n-p "Save the file? ")
1644 (save-buffer))
1645 (use-local-map Info-mode-map)
1646 (setq major-mode 'Info-mode)
1647 (setq mode-name "Info")
1648 (Info-set-mode-line)
1649 (setq buffer-read-only t)
1650 (force-mode-line-update)
1651 (and (marker-position Info-tag-table-marker)
1652 (buffer-modified-p)
1653 (message "Tags may have changed. Use Info-tagify if necessary")))
1654 \f
1655 (defvar Info-file-list-for-emacs
1656 '("ediff" "forms" "gnus" "info" ("mh" . "mh-e") "sc")
1657 "List of Info files that describe Emacs commands.
1658 An element can be a file name, or a list of the form (PREFIX . FILE)
1659 where PREFIX is a name prefix and FILE is the file to look in.
1660 If the element is just a file name, the file name also serves as the prefix.")
1661
1662 (defun Info-find-emacs-command-nodes (command)
1663 "Return a list of locations documenting COMMAND.
1664 The `info-file' property of COMMAND says which Info manual to search.
1665 If COMMAND has no property, the variable `Info-file-list-for-emacs'
1666 defines heuristics for which Info manual to try.
1667 The locations are of the format used in Info-history, i.e.
1668 \(FILENAME NODENAME BUFFERPOS\)."
1669 (let ((where '())
1670 (cmd-desc (concat "^\\* " (regexp-quote (symbol-name command))
1671 ":\\s *\\(.*\\)\\.$"))
1672 (info-file "emacs")) ;default
1673 ;; Determine which info file this command is documented in.
1674 (if (get command 'info-file)
1675 (setq info-file (get command 'info-file))
1676 ;; If it doesn't say explicitly, test its name against
1677 ;; various prefixes that we know.
1678 (let ((file-list Info-file-list-for-emacs))
1679 (while file-list
1680 (let* ((elt (car file-list))
1681 (name (if (consp elt)
1682 (car elt)
1683 elt))
1684 (file (if (consp elt) (cdr elt) elt))
1685 (regexp (concat "\\`" (regexp-quote name)
1686 "\\(\\'\\|-\\)")))
1687 (if (string-match regexp (symbol-name command))
1688 (setq info-file file file-list nil))
1689 (setq file-list (cdr file-list))))))
1690 (save-excursion
1691 (condition-case nil
1692 (Info-find-node info-file "Command Index")
1693 ;; Some manuals may not have a separate Command Index node,
1694 ;; so try just Index instead.
1695 (error
1696 (Info-find-node info-file "Index")))
1697 ;; Take the index node off the Info history.
1698 (setq Info-history (cdr Info-history))
1699 (goto-char (point-max))
1700 (while (re-search-backward cmd-desc nil t)
1701 (setq where (cons (list Info-current-file
1702 (buffer-substring
1703 (match-beginning 1)
1704 (match-end 1))
1705 0)
1706 where)))
1707 where)))
1708
1709 ;;;###autoload
1710 (defun Info-goto-emacs-command-node (command)
1711 "Go to the Info node in the Emacs manual for command COMMAND.
1712 The command is found by looking up in Emacs manual's Command Index
1713 or in another manual found via COMMAND's `info-file' property or
1714 the variable `Info-file-list-for-emacs'."
1715 (interactive "CFind documentation for command: ")
1716 (or (commandp command)
1717 (signal 'wrong-type-argument (list 'commandp command)))
1718 (let ((where (Info-find-emacs-command-nodes command)))
1719 (if where
1720 (let ((num-matches (length where)))
1721 ;; Get Info running, and pop to it in another window.
1722 (save-window-excursion
1723 (info))
1724 (pop-to-buffer "*info*")
1725 (Info-find-node (car (car where))
1726 (car (cdr (car where))))
1727 (if (> num-matches 1)
1728 (progn
1729 ;; Info-find-node already pushed (car where) onto
1730 ;; Info-history. Put the other nodes that were found on
1731 ;; the history.
1732 (setq Info-history (nconc (cdr where) Info-history))
1733 (message (substitute-command-keys
1734 "Found %d other entr%s. Use \\[Info-last] to see %s.")
1735 (1- num-matches)
1736 (if (> num-matches 2) "ies" "y")
1737 (if (> num-matches 2) "them" "it")))))
1738 (error "Couldn't find documentation for %s." command))))
1739
1740 ;;;###autoload
1741 (defun Info-goto-emacs-key-command-node (key)
1742 "Go to the Info node in the Emacs manual the command bound to KEY, a string.
1743 Interactively, if the binding is execute-extended-command, a command is read.
1744 The command is found by looking up in Emacs manual's Command Index
1745 or in another manual found via COMMAND's `info-file' property or
1746 the variable `Info-file-list-for-emacs'."
1747 (interactive "kFind documentation for key:")
1748 (let ((command (key-binding key)))
1749 (cond ((null command)
1750 (message "%s is undefined" (key-description key)))
1751 ((and (interactive-p)
1752 (eq command 'execute-extended-command))
1753 (Info-goto-emacs-command-node
1754 (read-command "Find documentation for command: ")))
1755 (t
1756 (Info-goto-emacs-command-node command)))))
1757 \f
1758 (defvar Info-title-face-alist
1759 '((?* bold underline)
1760 (?= bold-italic underline)
1761 (?- italic underline))
1762 "*Alist of face or list of faces to use for pseudo-underlined titles.
1763 The alist key is the character the title is underlined with (?*, ?= or ?-).")
1764
1765 (defun Info-fontify-node ()
1766 (save-excursion
1767 (let ((buffer-read-only nil))
1768 (goto-char (point-min))
1769 (if (looking-at "^File: [^,: \t]+,?[ \t]+")
1770 (progn
1771 (goto-char (match-end 0))
1772 (while
1773 (looking-at "[ \t]*[^:, \t\n]+:[ \t]+\\([^:,\t\n]+\\),?")
1774 (goto-char (match-end 0))
1775 (put-text-property (match-beginning 1) (match-end 1)
1776 'face 'info-xref)
1777 (put-text-property (match-beginning 1) (match-end 1)
1778 'mouse-face 'highlight))))
1779 (goto-char (point-min))
1780 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\)$"
1781 nil t)
1782 (put-text-property (match-beginning 1) (match-end 1)
1783 'face
1784 (cdr (assq (preceding-char) Info-title-face-alist)))
1785 (put-text-property (match-end 1) (match-end 2)
1786 'invisible t))
1787 (goto-char (point-min))
1788 (while (re-search-forward "\\*Note[ \n\t]+\\([^:]*\\):" nil t)
1789 (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
1790 nil
1791 (put-text-property (match-beginning 1) (match-end 1)
1792 'face 'info-xref)
1793 (put-text-property (match-beginning 1) (match-end 1)
1794 'mouse-face 'highlight)))
1795 (goto-char (point-min))
1796 (if (and (search-forward "\n* Menu:" nil t)
1797 (not (string-match "\\<Index\\>" Info-current-node))
1798 ;; Don't take time to annotate huge menus
1799 (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
1800 (let ((n 0))
1801 (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t)
1802 (setq n (1+ n))
1803 (if (memq n '(5 9)) ; visual aids to help with 1-9 keys
1804 (put-text-property (match-beginning 0)
1805 (1+ (match-beginning 0))
1806 'face 'info-menu-5))
1807 (put-text-property (match-beginning 1) (match-end 1)
1808 'face 'info-node)
1809 (put-text-property (match-beginning 1) (match-end 1)
1810 'mouse-face 'highlight))))
1811 (set-buffer-modified-p nil))))
1812
1813 (provide 'info)
1814
1815 ;;; info.el ends here