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