• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching +defs:Info +defs:index +defs:nodes

28 ;; Note that nowadays we expect Info files to be made using makeinfo.
31 ;; - a menu item ending with ": " (but not ":: ") is an index entry
41 "Info subsystem."
46 (defvar Info-history nil
47 "Stack of Info nodes user has visited.
50 (defvar Info-history-forward nil
51 "Stack of Info nodes user has visited with `Info-history-back' command.
54 (defvar Info-history-list nil
55 "List of all Info nodes user has visited.
58 (defcustom Info-enable-edit nil
59 "*Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info can edit the current node.
60 This is convenient if you want to write Info files by hand.
62 It is better to write a Texinfo file and generate the Info file from that,
67 (defvar Info-enable-active-nodes nil
68 "Non-nil allows Info to execute Lisp code associated with nodes.
70 (put 'Info-enable-active-nodes 'risky-local-variable t)
76 "Face for Info node names."
88 (put 'Info-title-1-face 'face-alias 'info-title-1)
96 (put 'Info-title-2-face 'face-alias 'info-title-2)
104 (put 'Info-title-3-face 'face-alias 'info-title-3)
112 (put 'Info-title-4-face 'face-alias 'info-title-4)
121 "Face for headers in Info menus."
127 "Face for every third `*' in an Info menu."
133 "Face for unvisited Info cross-references."
138 "Face for visited Info cross-references."
142 (defcustom Info-fontify-visited-nodes t
143 "*Non-nil to fontify references to visited nodes in `info-xref-visited' face."
148 (defcustom Info-fontify-maximum-menu-size 100000
154 (defcustom Info-use-header-line t
162 "Face for Info cross-references in a node header."
167 "Face for Info nodes in a node header."
170 (defvar Info-directory-list nil
171 "List of directories to search for Info documentation files.
172 If nil, meaning not yet initialized, Info uses the environment
173 variable INFOPATH to initialize it, or `Info-default-directory-list'
177 When `Info-directory-list' is initialized from the value of
178 `Info-default-directory-list', and Emacs is installed in one of the
179 standard directories, the directory of Info files that come with Emacs
180 is put last (so that local Info files override standard ones).
182 When `Info-directory-list' is initialized from the value of
183 `Info-default-directory-list', and Emacs is not installed in one
185 list is the directory where Emacs installs the Info files that
192 `Info-default-directory-list', set INFOPATH in the environment.
196 source tree is used as the first element of `Info-directory-list', in
197 place of the installation Info directory. This is useful when you run
200 (defcustom Info-additional-directory-list nil
201 "List of additional directories to search for Info documentation files.
202 These directories are searched after those in `Info-directory-list'."
206 (defcustom Info-scroll-prefer-subnodes nil
207 "*If non-nil, \\<Info-mode-map>\\[Info-scroll-up] in a menu visits subnodes.
210 appears on the screen, the next \\<Info-mode-map>\\[Info-scroll-up]
215 Info reader program, which visits the first subnode from the menu only
221 (defcustom Info-hide-note-references t
233 (defcustom Info-refill-paragraphs nil
235 This refilling may accidentally remove explicit line breaks in the Info
241 (defcustom Info-search-whitespace-regexp "\\s-+"
243 This applies to Info search for regular expressions.
250 (defcustom Info-isearch-search t
251 "*If non-nil, isearch in Info searches through multiple nodes.
252 Before leaving the initial Info node, where isearch was started,
254 subsequent C-s/C-r continues through other nodes without failing
255 with this error message in other nodes. When isearch fails for
261 with wrapping around the current Info node."
266 (defvar Info-isearch-initial-node nil)
268 (defcustom Info-mode-hook
269 ;; Try to obey obsolete Info-fontify settings.
270 (unless (and (boundp 'Info-fontify) (null Info-fontify))
272 "Hooks run when `Info-mode' is called."
276 (defcustom Info-selection-hook nil
277 "Hooks run when `Info-select-node' is called."
281 (defvar Info-edit-mode-hook nil
282 "Hooks run when `Info-edit-mode' is called.")
284 (defvar Info-current-file nil
285 "Info file that Info is now looking at, or nil.
286 This is the name that was specified in Info, not the actual file name.
287 It doesn't contain directory names or file name extensions added by Info.")
289 (defvar Info-current-subfile nil
290 "Info subfile that is actually in the *info* buffer now.
291 It is nil if current Info file is not split into subfiles.")
293 (defvar Info-current-node nil
294 "Name of node that Info is now looking at, or nil.")
296 (defvar Info-tag-table-marker nil
297 "Marker pointing at beginning of current Info file's tag table.
300 (defvar Info-tag-table-buffer nil
303 (defvar Info-current-file-completions nil
304 "Cached completion list for current Info file.")
306 (defvar Info-file-supports-index-cookies nil
307 "Non-nil if current Info file supports index cookies.")
309 (defvar Info-index-alternatives nil
310 "List of possible matches for last `Info-index' command.")
312 (defvar Info-point-loc nil
318 (defvar Info-standalone nil
319 "Non-nil if Emacs was started solely as an Info browser.")
322 (defvar Info-suffix-list
335 ("/index.gz". "gunzip")
336 ("/index.z" . "gunzip")
340 ("/index" . nil)
354 ("/index.Z". "uncompress")
355 ("/index.Y". "unyabba")
356 ("/index.gz". "gunzip")
357 ("/index.z". "gunzip")
358 ("/index.bz2". ("bzip2" "-dc"))
359 ("/index". nil)
405 "Insert the contents of an Info file in the current buffer.
407 (let* ((tail Info-suffix-list)
463 (defun Info-default-dirs ()
485 (if (or (member alternative Info-default-directory-list)
487 ;; and we must always find the Info dir at run time.
490 ;; Use invocation-directory for Info
496 Info-default-directory-list
497 ;; `alternative' contains the Info files that came with this
498 ;; version, so we should look there first. `Info-insert-dir'
503 Info-default-directory-list)))) ;; )))
506 "Initialize `Info-directory-list', if that hasn't been done yet."
507 (unless Info-directory-list
509 (setq Info-directory-list
515 (Info-default-dirs))
517 (Info-default-dirs)))))))
521 "Like `info' but show the Info buffer in another window."
523 (list (read-file-name "Info file name: " nil nil t))))
532 "Enter Info, the documentation browser.
534 the default is the top-level directory of Info.
535 Called from a program, FILE-OR-NODE may specify an Info node of the form
537 Optional argument BUFFER specifies the Info buffer name;
540 with the top-level Info directory.
544 A numeric prefix argument selects an Info buffer with the prefix number
545 appended to the Info buffer name.
547 The search path for Info files is in the variable `Info-directory-list'.
548 The top-level Info directory is made by combining all the files named `dir'
552 (read-file-name "Info file name: " nil nil t))
556 (if (and buffer (not (eq major-mode 'Info-mode)))
557 (Info-mode))
563 (Info-goto-node
568 (null Info-history))
569 ;; If we just created the Info buffer, go to the directory.
570 (Info-directory))))
574 "Display the Emacs manual in Info mode."
580 "Run Emacs as a standalone Info reader.
582 In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
583 (setq Info-standalone t)
608 (defun Info-node-at-bob-matching (regexp)
617 (defun Info-find-file (filename &optional noerror)
638 (if Info-additional-directory-list
639 (append Info-directory-list
640 Info-additional-directory-list)
641 Info-directory-list)))))
648 (let ((suffix-list Info-suffix-list)
673 (error "Info file %s does not exist" filename)))
677 (defun Info-find-node (filename nodename &optional no-going-back)
678 "Go to an Info node specified as separate FILENAME and NODENAME.
682 (setq filename (Info-find-file filename))
683 ;; Go into Info buffer.
684 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
687 Info-current-file
688 (setq Info-history
689 (cons (list Info-current-file Info-current-node (point))
690 Info-history)))
691 (Info-find-node-2 filename nodename no-going-back))
694 (defun Info-on-current-buffer (&optional nodename)
695 "Use Info mode to browse the current Info buffer.
700 (completing-read "Node name: " (Info-build-node-completions)
704 (Info-mode)
705 (set (make-local-variable 'Info-current-file)
709 (Info-find-node-2 nil nodename))
715 (defun Info-revert-find-node (filename nodename)
716 "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
720 (let ((old-filename Info-current-file)
721 (old-nodename Info-current-node)
725 (old-history Info-history)
726 (new-history (and Info-current-file
727 (list Info-current-file Info-current-node (point)))))
729 (Info-find-node filename nodename)
730 (setq Info-history old-history)
731 (if (and (equal old-filename Info-current-file)
732 (equal old-nodename Info-current-node))
743 (setq Info-history (cons new-history Info-history))))))
745 (defun Info-find-in-tag-table-1 (marker regexp case-fold)
748 REGEXP is a regular expression matching nodes or references. Its first
767 (defun Info-find-in-tag-table (marker regexp)
770 REGEXP is a regular expression matching nodes or references. Its first
778 (let ((result (Info-find-in-tag-table-1 marker regexp nil)))
780 (setq result (Info-find-in-tag-table-1 marker regexp t)))
783 (defun Info-find-node-in-buffer-1 (regexp case-fold)
785 REGEXP is a regular expression matching nodes or references. Its first
792 (when (Info-node-at-bob-matching regexp)
804 (defun Info-find-node-in-buffer (regexp)
806 REGEXP is a regular expression matching nodes or references. Its first
811 (or (Info-find-node-in-buffer-1 regexp nil)
812 (Info-find-node-in-buffer-1 regexp t)))
814 (defun Info-find-node-2 (filename nodename &optional no-going-back)
816 (or (eq major-mode 'Info-mode)
817 (Info-mode))
819 (setq Info-current-node nil)
825 (equal Info-current-file filename)
827 (setq Info-current-file nil
828 Info-current-subfile nil
829 Info-current-file-completions nil
834 (Info-insert-dir))
846 ;; Check makeinfo version for index cookie support
856 (set (make-local-variable 'Info-file-supports-index-cookies) found))
877 (or Info-tag-table-buffer
879 (setq Info-tag-table-buffer tagbuf)
886 (set-marker Info-tag-table-marker
888 (set-marker Info-tag-table-marker pos)))
889 (set-marker Info-tag-table-marker nil))
890 (setq Info-current-file
897 (progn (setq Info-current-node nodename)
898 (Info-set-mode-line))
921 (when (marker-position Info-tag-table-marker)
922 (let* ((m Info-tag-table-marker)
923 (found (Info-find-in-tag-table m regexp)))
931 (unless (eq (nth 2 found) 'Info-mode)
934 ;; Info-read-subfile. Thus the hackery above.
935 (setq guesspos (Info-read-subfile guesspos)))
950 (let ((pos (Info-find-node-in-buffer regexp)))
956 (let (Info-point-loc)
957 (Info-find-node-2
965 (Info-select-node)
968 (let ((new-history (list Info-current-file
971 (setq Info-history-list
973 (delete new-history Info-history-list))))
975 ((numberp Info-point-loc)
976 (forward-line (1- Info-point-loc))
977 (setq Info-point-loc nil))
978 ((stringp Info-point-loc)
979 (Info-find-index-name Info-point-loc)
980 (setq Info-point-loc nil))))))
983 (or Info-current-node no-going-back (null Info-history)
984 (let ((hist (car Info-history)))
985 (setq Info-history (cdr Info-history))
986 (Info-find-node (nth 0 hist) (nth 1 hist) t)
991 (defvar Info-dir-contents nil)
995 (defvar Info-dir-contents-directory nil)
998 ;; constructed Info-dir-contents.
999 (defvar Info-dir-file-attributes nil)
1001 (defvar Info-dir-file-name nil)
1003 ;; Construct the Info directory node by merging the files named `dir'
1007 (defun Info-insert-dir ()
1008 (if (and Info-dir-contents Info-dir-file-attributes
1021 Info-dir-file-attributes))))
1023 (insert Info-dir-contents)
1025 (let ((dirs (if Info-additional-directory-list
1026 (append Info-directory-list
1027 Info-additional-directory-list)
1028 Info-directory-list))
1034 buffers buffer others nodes dirs-done)
1061 (message "Composing main Info directory..."))
1066 (set (make-local-variable 'Info-dir-file-name)
1072 (set (make-local-variable 'Info-dir-contents-directory)
1077 (error "Can't find the Info directory node"))
1081 ;; The definition of `Info-directory-list' puts it first on that
1093 (let (this-buffer-nodes)
1104 (setq nodename (Info-following-node-name))
1108 (push (list nodename other beg end) this-buffer-nodes)))
1109 (if (assoc-string "top" this-buffer-nodes t)
1110 (setq nodes (nconc this-buffer-nodes nodes))
1112 (message "No `top' node in %s" Info-dir-file-name)))))
1118 (dolist (node nodes)
1131 (dolist (node nodes)
1150 (Info-dir-remove-duplicates)
1155 (message "Composing main Info directory...problems encountered, see `*Messages*'")
1156 (message "Composing main Info directory...done"))
1157 (set (make-local-variable 'Info-dir-contents) (buffer-string))
1158 (set (make-local-variable 'Info-dir-file-attributes) dir-file-attrs)))
1159 (setq default-directory Info-dir-contents-directory))
1161 (defvar Info-streamline-headings
1168 (defun Info-dir-remove-duplicates ()
1181 (dolist (x Info-streamline-headings)
1231 (defun Info-read-subfile (nodepos)
1232 ;; NODEPOS is either a position (in the Info file as a whole,
1238 (set-buffer (marker-buffer Info-tag-table-marker))
1261 ;; Assume previous buffer is in Info-mode.
1263 (or (equal Info-current-subfile lastfilename)
1270 (setq Info-current-subfile lastfilename)))
1280 (defun Info-unescape-quotes (value)
1291 ;; into the Info file for handling images.
1292 (defun Info-split-parameter-string (parameter-string)
1305 (Info-unescape-quotes
1310 (defun Info-display-images-node ()
1320 (parameter-alist (Info-split-parameter-string (match-string 2)))
1345 (defun Info-hide-cookies-node ()
1359 (defun Info-select-node ()
1360 "Select the Info node that point is in."
1372 (setq Info-current-node
1377 (Info-set-mode-line)
1392 (if Info-enable-active-nodes (eval active-expression))
1394 (let ((new-history (list Info-current-file Info-current-node)))
1395 (setq Info-history-list
1396 (cons new-history (delete new-history Info-history-list)))
1397 (setq Info-history-forward nil))
1398 (if (not (eq Info-fontify-maximum-menu-size nil))
1399 (Info-fontify-node))
1400 (Info-display-images-node)
1401 (Info-hide-cookies-node)
1402 (run-hooks 'Info-selection-hook)))))
1404 (defvar Info-mode-line-node-keymap
1406 (define-key map [mode-line mouse-1] 'Info-mouse-scroll-up)
1407 (define-key map [mode-line mouse-3] 'Info-mouse-scroll-down)
1409 "Keymap to put on the Info node name in the mode line.")
1411 (defun Info-set-mode-line ()
1417 (if (stringp Info-current-file)
1419 "%" "%%" (file-name-nondirectory Info-current-file))
1420 (format "*%S*" Info-current-file))
1422 (if Info-current-node
1424 "%" "%%" Info-current-node)
1429 'local-map Info-mode-line-node-keymap)
1433 ;; Go to an Info node specified with a filename-and-nodename string
1434 ;; of the sort that is found in pointers in nodes.
1439 (defun Info-goto-node (nodename &optional fork)
1440 "Go to Info node named NODENAME. Give just NODENAME or (FILENAME)NODENAME.
1441 If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file
1442 FILENAME; otherwise, NODENAME should be in the current Info file (or one of
1444 Completion is available, but only for node names in the current Info file.
1446 a new Info buffer.
1448 (interactive (list (Info-read-node-name "Go to node: ") current-prefix-arg))
1465 (Info-find-node (if (equal filename "") nil filename)
1468 (defvar Info-read-node-completion-table)
1470 (defun Info-read-node-name-2 (string path-and-suffixes action)
1471 "Virtual completion table for file names input in Info node names.
1492 ;; But exclude subfiles of split Info files.
1508 ;; It does completion using the alist in Info-read-node-completion-table
1510 (defun Info-read-node-name-1 (string predicate code)
1517 (let ((comp (try-completion file 'Info-read-node-name-2
1518 (cons Info-directory-list
1519 (mapcar 'car Info-suffix-list)))))
1524 (all-completions file 'Info-read-node-name-2
1525 (cons Info-directory-list
1526 (mapcar 'car Info-suffix-list))))
1534 ;; Otherwise use Info-read-node-completion-table.
1536 (try-completion string Info-read-node-completion-table predicate))
1538 (all-completions string Info-read-node-completion-table predicate))
1540 (test-completion string Info-read-node-completion-table predicate))))
1543 (put 'Info-read-node-name-1 'completion-base-size-function
1551 (defun Info-read-node-name (prompt &optional default)
1553 (Info-read-node-completion-table (Info-build-node-completions))
1554 (nodename (completing-read prompt 'Info-read-node-name-1 nil t)))
1557 (Info-read-node-name prompt))
1560 (defun Info-build-node-completions ()
1561 (or Info-current-file-completions
1568 (or Info-tag-table-marker
1569 (error "No Info tags found"))
1570 (if (marker-buffer Info-tag-table-marker)
1571 (let ((marker Info-tag-table-marker))
1582 (if (Info-node-at-bob-matching node-regexp)
1584 ;; Now for the rest of the nodes.
1594 (set (make-local-variable 'Info-current-file-completions) compl))))
1597 (defun Info-restore-point (hl)
1600 (if (and (equal (nth 0 (car hl)) Info-current-file)
1602 (string-equal (nth 1 (car hl)) Info-current-node))
1609 (defvar Info-search-history nil
1610 "The history list for `Info-search'.")
1612 (defvar Info-search-case-fold nil
1613 "The value of `case-fold-search' from previous `Info-search' command.")
1615 (defun Info-search (regexp &optional bound noerror count direction)
1619 (if Info-search-history
1622 (car Info-search-history))
1625 nil 'Info-search-history)))
1629 (setq regexp (car Info-search-history)))
1633 (onode Info-current-node)
1634 (ofile Info-current-file)
1639 (osubfile Info-current-subfile))
1640 (setq Info-search-case-fold case-fold-search)
1645 ;; Hide Info file header for backward search
1668 Info-search-whitespace-regexp)))
1676 (when (and isearch-mode Info-isearch-search
1677 (not Info-isearch-initial-node)
1685 (if (null Info-current-subfile)
1688 Info-search-whitespace-regexp)))
1702 (set-buffer (marker-buffer Info-tag-table-marker))
1733 (Info-read-subfile (car (car list)))
1735 ;; Hide Info file header for backward search
1761 Info-search-whitespace-regexp)))
1776 (progn (Info-read-subfile osubfile)
1778 (Info-select-node)
1781 (if (and (string= osubfile Info-current-subfile)
1788 (save-match-data (Info-select-node)))
1791 (or (and (string-equal onode Info-current-node)
1792 (equal ofile Info-current-file))
1795 (setq Info-history (cons (list ofile onode opoint)
1796 Info-history))))))
1798 (defun Info-search-case-sensitively ()
1802 (call-interactively 'Info-search)))
1804 (defun Info-search-next ()
1805 "Search for next regexp from a previous `Info-search' command."
1807 (let ((case-fold-search Info-search-case-fold))
1808 (if Info-search-history
1809 (Info-search (car Info-search-history))
1810 (call-interactively 'Info-search))))
1812 (defun Info-search-backward (regexp &optional bound noerror count)
1815 (if Info-search-history
1818 (car Info-search-history))
1821 nil 'Info-search-history)))
1822 (Info-search regexp bound noerror count 'backward))
1824 (defun Info-isearch-search ()
1825 (if Info-isearch-search
1828 (Info-search (concat "\\b" (replace-regexp-in-string
1836 (Info-search (if isearch-regexp string (regexp-quote string))
1843 (defun Info-isearch-wrap ()
1844 (if Info-isearch-search
1845 (if Info-isearch-initial-node
1847 (if isearch-forward (Info-top-node) (Info-final-node))
1849 (setq Info-isearch-initial-node Info-current-node)
1853 (defun Info-isearch-push-state ()
1855 (Info-isearch-pop-state cmd ',Info-current-file ',Info-current-node)))
1857 (defun Info-isearch-pop-state (cmd file node)
1858 (or (and (equal Info-current-file file)
1859 (equal Info-current-node node))
1860 (progn (Info-find-node file node) (sit-for 0))))
1862 (defun Info-isearch-start ()
1863 (setq Info-isearch-initial-node nil))
1866 (defun Info-extract-pointer (name &optional errorname)
1877 (concat name ":" (Info-following-node-name-re)) bound t)
1883 (defun Info-following-node-name-re (&optional allowedchars)
1898 (defun Info-following-node-name ()
1899 (and (looking-at (Info-following-node-name-re))
1902 (defun Info-next ()
1907 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
1908 (Info-goto-node (Info-extract-pointer "next"))))
1910 (defun Info-prev ()
1915 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
1916 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous"))))
1918 (defun Info-up (&optional same-file)
1920 If SAME-FILE is non-nil, do not move to a different Info file."
1924 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
1925 (let ((old-node Info-current-node)
1926 (old-file Info-current-file)
1927 (node (Info-extract-pointer "up")) p)
1930 (error "Up node is in another Info file"))
1931 (Info-goto-node node)
1944 (Info-restore-point Info-history)))))
1946 (defun Info-history-back ()
1949 (or Info-history
1950 (error "This is the first Info node you looked at"))
1952 (cons (list Info-current-file Info-current-node (point))
1953 Info-history-forward))
1955 (setq filename (car (car Info-history)))
1956 (setq nodename (car (cdr (car Info-history))))
1957 (setq opoint (car (cdr (cdr (car Info-history)))))
1958 (setq Info-history (cdr Info-history))
1959 (Info-find-node filename nodename)
1960 (setq Info-history (cdr Info-history))
1961 (setq Info-history-forward history-forward)
1964 (defalias 'Info-last 'Info-history-back)
1966 (defun Info-history-forward ()
1967 "Go forward in the history of visited nodes."
1969 (or Info-history-forward
1970 (error "This is the last Info node you looked at"))
1971 (let ((history-forward (cdr Info-history-forward))
1973 (setq filename (car (car Info-history-forward)))
1974 (setq nodename (car (cdr (car Info-history-forward))))
1975 (setq opoint (car (cdr (cdr (car Info-history-forward)))))
1976 (Info-find-node filename nodename)
1977 (setq Info-history-forward history-forward)
1981 (defun Info-directory ()
1982 "Go to the Info directory node."
1984 (Info-find-node "dir" "top"))
1987 (defun Info-history ()
1988 "Go to a node with a menu of visited nodes."
1990 (let ((curr-file Info-current-file)
1991 (curr-node Info-current-node)
2000 (let ((hl (delete '("history" "Top") Info-history-list)))
2013 (Info-find-node 'history "Top")
2016 (defun Info-toc ()
2017 "Go to a node with table of contents of the current Info file.
2020 (if (stringp Info-current-file)
2021 (let ((curr-file (substring-no-properties Info-current-file))
2022 (curr-node (substring-no-properties Info-current-node))
2026 (node-list (Info-build-toc curr-file)))
2032 (Info-insert-toc
2033 (nth 2 (assoc "Top" node-list)) ; get Top nodes
2036 (let ((Info-hide-note-references 'hide)
2037 (Info-fontify-visited-nodes nil))
2038 (Info-mode)
2039 (setq Info-current-file 'toc Info-current-node "Top")
2044 (Info-fontify-node)
2049 (Info-find-node 'toc "Top")
2052 (defun Info-insert-toc (nodes node-list level curr-file)
2053 "Insert table of contents with references to nodes."
2055 (while nodes
2056 (let ((node (assoc (car nodes) node-list)))
2060 (insert "*Note " (car nodes) ": (" curr-file ")" (car nodes) ".\n")
2061 (Info-insert-toc (nth 2 node) node-list (1+ level) curr-file)
2062 (setq nodes (cdr nodes))))))
2064 (defun Info-build-toc (file)
2065 "Build table of contents from menus of Info FILE and its subfiles."
2067 (let* ((file (and (stringp file) (Info-find-file file)))
2073 nodes subfiles)
2081 (let ((nodename (substring-no-properties (Info-following-node-name)))
2086 (when (and (not (Info-index-node nodename file))
2102 (Info-extract-menu-node-name))))
2113 (setq nodes (cons (list nodename
2116 nodes))
2130 (nreverse nodes))))
2133 (defun Info-follow-reference (footnotename &optional fork)
2137 a new Info buffer. If FORK is a string, it is the name to use for the
2221 (setq target (Info-extract-menu-node-name t))))
2226 (Info-goto-node target fork)))
2228 (defconst Info-menu-entry-name-re "\\(?:[^:]\\|:[^:,.;() \t\n]\\)*"
2229 ;; We allow newline because this is also used in Info-follow-reference,
2233 `:' and `Info-following-node-name-re'.")
2235 (defun Info-extract-menu-node-name (&optional multi-line index-node)
2237 (when (looking-at (concat Info-menu-entry-name-re ":\\(:\\|"
2238 (Info-following-node-name-re
2240 (index-node "^,\t\n")
2244 (if index-node
2247 (if index-node
2248 (setq Info-point-loc
2253 ;;; Uncomment next line to use names of cross-references in non-index nodes:
2254 ;;; (setq Info-point-loc
2265 ;;(defun Info-menu-item-sequence (list)
2267 ;; (Info-menu (car list))
2270 (defvar Info-complete-menu-buffer)
2271 (defvar Info-complete-next-re nil)
2272 (defvar Info-complete-nodes nil)
2273 (defvar Info-complete-cache nil)
2275 (defconst Info-node-spec-re
2276 (concat (Info-following-node-name-re "^.,:") "[,:.]")
2279 (defun Info-complete-menu-item (string predicate action)
2281 ;; - `Info-complete-menu-buffer' which contains the buffer in which
2283 ;; - `Info-complete-next-re' which, if non-nil, indicates that we should
2284 ;; also look for menu items in subsequent nodes as long as those
2285 ;; nodes' names match `Info-complete-next-re'. This feature is currently
2287 ;; - `Info-complete-nodes' which, if non-nil, indicates that we should
2288 ;; also look for menu items in these nodes. This feature is currently
2289 ;; only used for completion in Info-index.
2291 ;; Note that `Info-complete-menu-buffer' could be current already,
2294 (set-buffer Info-complete-menu-buffer)
2297 (orignode Info-current-node)
2306 Info-menu-entry-name-re "\\):" Info-node-spec-re))
2308 (complete-nodes Info-complete-nodes))
2310 (if (and (equal (nth 0 Info-complete-cache) Info-current-file)
2311 (equal (nth 1 Info-complete-cache) Info-current-node)
2312 (equal (nth 2 Info-complete-cache) Info-complete-next-re)
2313 (equal (nth 5 Info-complete-cache) Info-complete-nodes)
2314 (let ((prev (nth 3 Info-complete-cache)))
2318 (setq completions (nth 4 Info-complete-cache))
2325 ;; Check subsequent nodes if applicable.
2326 (or (and Info-complete-next-re
2327 (setq nextnode (Info-extract-pointer "next" t))
2328 (string-match Info-complete-next-re nextnode))
2329 (and complete-nodes
2330 (setq complete-nodes (cdr complete-nodes)
2331 nextnode (car complete-nodes)))))
2332 (Info-goto-node nextnode))
2334 (unless (equal Info-current-node orignode)
2335 (Info-goto-node orignode))
2337 (set (make-local-variable 'Info-complete-cache)
2338 (list Info-current-file Info-current-node
2339 Info-complete-next-re string completions
2340 Info-complete-nodes)))
2346 (defun Info-menu (menu-item &optional fork)
2351 a new Info buffer. If FORK is a string, it is the name to use for the
2371 Info-menu-entry-name-re
2377 (Info-complete-menu-buffer (current-buffer)))
2382 'Info-complete-menu-item nil t)))
2394 (Info-goto-node (Info-extract-menu-item menu-item) (if fork menu-item)))
2396 (defun Info-extract-menu-item (menu-item)
2409 (Info-extract-menu-node-name nil (Info-index-node))))))
2412 (defun Info-extract-menu-counting (count)
2424 (Info-extract-menu-node-name nil (Info-index-node))))))
2426 (defun Info-nth-menu-item ()
2430 (Info-goto-node
2431 (Info-extract-menu-counting
2434 (defun Info-top-node ()
2437 (Info-goto-node "Top"))
2439 (defun Info-final-node ()
2442 (Info-goto-node "Top")
2443 (let ((Info-history nil)
2446 (Info-goto-node (Info-extract-menu-counting nil))
2449 (while (Info-forward-node t t) nil)
2450 ;; Then keep moving down to last subnode, unless we reach an index.
2451 (while (and (not (Info-index-node))
2453 (Info-goto-node (Info-extract-menu-counting nil)))))
2455 (defun Info-forward-node (&optional not-down no-error)
2456 "Go forward one node, considering all nodes as forming one sequence."
2462 ;; 1. next node is in a menu in this node (but not in an index)
2467 (not (Info-index-node)))
2468 (Info-goto-node (Info-extract-menu-counting 1))
2471 (Info-next)
2475 (not (string-equal (downcase (Info-extract-pointer "up"))
2477 (let ((old-node Info-current-node))
2478 (Info-up)
2479 (let (Info-history success)
2481 (setq success (Info-forward-node t no-error))
2482 (or success (Info-goto-node old-node))))))
2486 (defun Info-backward-node ()
2487 "Go backward one node, considering all nodes as forming one sequence."
2489 (let ((prevnode (Info-extract-pointer "prev[ious]*" t))
2490 (upnode (Info-extract-pointer "up" t))
2499 (Info-up))
2503 (Info-prev)
2504 (let (Info-history)
2505 (while (and (not (Info-index-node))
2507 (Info-goto-node (Info-extract-menu-counting nil)))))
2511 (defun Info-exit ()
2512 "Exit Info by selecting some other buffer."
2514 (if Info-standalone
2518 (defun Info-next-menu-item ()
2528 (Info-extract-menu-node-name)))))
2529 (if node (Info-goto-node node)
2532 (defun Info-last-menu-item ()
2544 (Info-goto-node (save-excursion
2546 (Info-extract-menu-node-name)))))
2548 (defmacro Info-no-error (&rest body)
2551 (defun Info-next-preorder ()
2554 (cond ((Info-no-error (Info-next-menu-item)))
2555 ((Info-no-error (Info-next)))
2556 ((Info-no-error (Info-up t))
2562 (Info-next-preorder))
2564 (error "No more nodes"))))
2566 (defun Info-last-preorder ()
2569 (cond ((Info-no-error
2570 (Info-last-menu-item)
2574 ;; Keep going down, as long as there are nested menu nodes.
2575 (while (Info-no-error
2576 (Info-last-menu-item)
2581 ((and (Info-no-error (Info-extract-pointer "prev"))
2582 (not (equal (Info-extract-pointer "up")
2583 (Info-extract-pointer "prev"))))
2584 (Info-no-error (Info-prev))
2586 (while (Info-no-error
2587 (Info-last-menu-item)
2592 ((Info-no-error (Info-up t))
2597 (t (error "No previous nodes"))))
2599 (defun Info-scroll-up ()
2600 "Scroll one screenful forward in Info, considering all nodes as one sequence.
2603 `Info-scroll-prefer-subnodes' is nil.
2606 `Info-scroll-prefer-subnodes' is non-nil and to the first subnode otherwise;
2608 and so on. If `Info-scroll-prefer-subnodes' is non-nil and point is inside
2620 (if (and Info-scroll-prefer-subnodes
2627 (Info-scroll-prefer-subnodes (Info-next-preorder))
2628 ((Info-no-error (Info-goto-node (Info-extract-menu-counting 1))))
2629 (t (Info-next-preorder)))
2632 (defun Info-mouse-scroll-up (e)
2633 "Scroll one screenful forward in Info, using the mouse.
2634 See `Info-scroll-up'."
2639 (Info-scroll-up)))
2641 (defun Info-scroll-down ()
2642 "Scroll one screenful back in Info, considering all nodes as one sequence.
2643 If point is within the menu of a node, and `Info-scroll-prefer-subnodes'
2654 (and Info-scroll-prefer-subnodes
2664 (Info-last-preorder)
2667 (defun Info-mouse-scroll-down (e)
2668 "Scroll one screenful backward in Info, using the mouse.
2669 See `Info-scroll-down'."
2674 (Info-scroll-down)))
2676 (defun Info-next-reference (&optional recur)
2694 (Info-next-reference t))
2698 (defun Info-prev-reference (&optional recur)
2715 (Info-prev-reference t))
2720 (defvar Info-index-nodes nil
2721 "Alist of cached index node names of visited Info files.
2724 (defun Info-index-nodes (&optional file)
2725 "Return a list of names of all index nodes in Info FILE.
2726 If FILE is omitted, it defaults to the current Info file.
2727 First look in a list of cached index node names. Then scan Info
2728 file and its subfiles for nodes with the index cookie. Then try
2729 to find index nodes starting from the first node in the top level
2731 following nodes whose names also contain the word \"Index\"."
2732 (or file (setq file Info-current-file))
2733 (or (assoc file Info-index-nodes)
2734 ;; Skip virtual Info files
2736 (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2738 (if Info-file-supports-index-cookies
2739 ;; Find nodes with index cookie
2742 (setq file (Info-find-file file))))
2744 Info-history Info-history-list Info-fontify-maximum-menu-size
2745 (main-file file) subfiles nodes node)
2752 (while (search-forward "\0\b[index\0\b]" nil 'move)
2756 (setq nodes (cons (Info-following-node-name) nodes))))
2769 (if nodes
2770 (setq nodes (nreverse nodes)
2771 Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2772 nodes)
2773 ;; Else find nodes with the word "Index" in the node name
2775 Info-history Info-history-list Info-fontify-maximum-menu-size
2776 nodes node)
2779 (Info-mode)
2780 (Info-find-node file "Top")
2784 (setq nodes (list (Info-extract-menu-node-name)))
2785 (Info-goto-node (car nodes))
2786 (while (and (setq node (Info-extract-pointer "next" t))
2788 (setq nodes (cons node nodes))
2789 (Info-goto-node node))))
2791 (if nodes
2792 (setq nodes (nreverse nodes)
2793 Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2794 nodes))
2795 ;; If file has no index nodes, still add it to the cache
2796 (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2797 (cdr (assoc file Info-index-nodes)))
2799 (defun Info-index-node (&optional node file)
2800 "Return non-nil value if NODE is an index node.
2801 If NODE is nil, check the current Info node.
2802 If FILE is nil, check the current Info file."
2803 (if (or (and node (not (equal node Info-current-node)))
2804 (assoc (or file Info-current-file) Info-index-nodes))
2805 (member (or node Info-current-node) (Info-index-nodes file))
2806 ;; Don't search all index nodes if request is only for the current node
2807 ;; and file is not in the cache of index nodes
2808 (if Info-file-supports-index-cookies
2813 (search-forward "\0\b[index\0\b]"
2818 (string-match "\\<Index\\>" (or node Info-current-node ""))))))
2820 (defun Info-goto-index ()
2821 "Go to the first index node."
2822 (let ((node (car (Info-index-nodes))))
2823 (or node (error "No index"))
2824 (Info-goto-node node)))
2827 (defun Info-index (topic)
2828 "Look up a string TOPIC in the index for this manual and go to that entry.
2831 Use the \\<Info-mode-map>\\[Info-index-next] command to see the other matches.
2836 (Info-complete-menu-buffer (clone-buffer))
2837 (Info-complete-nodes (Info-index-nodes))
2838 (Info-history-list nil))
2839 (if (equal Info-current-file "dir")
2840 (error "The Info directory node has no index; use m to select a manual"))
2842 (with-current-buffer Info-complete-menu-buffer
2843 (Info-goto-index)
2844 (completing-read "Index topic: " 'Info-complete-menu-item))
2845 (kill-buffer Info-complete-menu-buffer)))))
2846 (if (equal Info-current-file "dir")
2847 (error "The Info directory node has no index; use m to select a manual"))
2848 ;; Strip leading colon in topic; index format does not allow them.
2853 (let ((orignode Info-current-node)
2856 node (nodes (Info-index-nodes))
2857 (ohist-list Info-history-list)
2859 (Info-goto-index)
2863 ;; We bind Info-history to nil for internal node-switches so
2865 ;; Info-goto-index call, above, we do update the history
2867 (Info-history nil)
2875 Info-current-node
2879 (setq nodes (cdr nodes) node (car nodes)))
2880 (Info-goto-node node))
2883 (Info-goto-node orignode)
2884 (error "No `%s' in index" topic)))
2889 (setq Info-history-list ohist-list)
2890 (setq Info-index-alternatives (nconc exact (nreverse matches)))
2891 (Info-index-next 0)))))
2893 (defun Info-index-next (num)
2894 "Go to the next matching index item from the last \\<Info-mode-map>\\[Info-index] command."
2896 (or Info-index-alternatives
2899 (setq num (+ num (length Info-index-alternatives))))
2901 (setq Info-index-alternatives
2902 (nconc (cdr Info-index-alternatives)
2903 (list (car Info-index-alternatives)))
2905 (Info-goto-node (nth 1 (car Info-index-alternatives)))
2906 (if (> (nth 3 (car Info-index-alternatives)) 0)
2907 (forward-line (1- (nth 3 (car Info-index-alternatives))))
2909 (let ((name (car (car Info-index-alternatives))))
2910 (Info-find-index-name name)))
2912 (car (car Info-index-alternatives))
2913 (nth 2 (car Info-index-alternatives))
2914 (if (cdr Info-index-alternatives)
2916 (length Info-index-alternatives)
2918 'Info-index-next overriding-local-map
2922 (defun Info-find-index-name (name)
2940 (Info-find-index-name (match-string 1 name))))
2946 "Grovel indices of all known Info files on your system for STRING.
2952 (ohist Info-history)
2953 (ohist-list Info-history-list)
2954 (current-node Info-current-node)
2955 (current-file Info-current-file)
2956 manuals matches node nodes)
2957 (let ((Info-fontify-maximum-menu-size nil))
2958 (Info-directory)
2960 ;; as the first Info command, i.e. info-apropos loads info.el. In that
2964 (setq current-file Info-current-file)
2965 (setq current-node Info-current-node))
2976 (if (setq nodes (Info-index-nodes (Info-find-file manual)))
2978 (Info-find-node manual (car nodes))
2989 (setq nodes (cdr nodes) node (car nodes)))
2990 (Info-goto-node node))))
2995 (Info-find-node current-file current-node)
2996 (setq Info-history ohist
2997 Info-history-list ohist-list)
3014 (Info-find-node 'apropos "Index")
3015 (setq Info-complete-cache nil)))))
3017 (defun Info-undefined ()
3018 "Make command be undefined in Info."
3022 (defun Info-help ()
3023 "Enter the Info tutorial."
3026 (Info-find-node "info"
3031 (defun Info-summary ()
3032 "Display a brief summary of all Info commands."
3038 (insert (documentation 'Info-mode))
3044 "Type Space to return to Info"))
3052 (defun Info-get-token (pos start all &optional errorstring)
3093 (defun Info-mouse-follow-nearest-node (click)
3094 "\\<Info-mode-map>Follow a node reference near point.
3095 Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where you click.
3099 (and (not (Info-try-follow-nearest-node))
3101 (Info-next-preorder)))
3103 (defun Info-follow-nearest-node (&optional fork)
3109 a new Info buffer.
3112 (or (Info-try-follow-nearest-node fork)
3120 (Info-goto-node
3121 (Info-extract-menu-item (match-string-no-properties 1)) fork)
3126 (defun Info-try-follow-nearest-node (&optional fork)
3128 If FORK is non-nil, it i spassed to `Info-goto-node'."
3131 ((Info-get-token (point) "[hf]t?tp://" "[hf]t?tp://\\([^ \t\n\"`({<>})']+\\)")
3134 ((setq node (Info-get-token (point) "\\*note[ \n\t]+"
3136 (Info-follow-reference node fork))
3138 ((setq node (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\)::"))
3139 (Info-goto-node node fork))
3140 ;; menu item: node name or index entry
3141 ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ")
3144 (setq node (Info-extract-menu-node-name nil (Info-index-node)))
3145 (Info-goto-node node fork))
3146 ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))
3147 (Info-goto-node node fork))
3148 ((setq node (Info-get-token (point) "Next: " "Next: \\([^,\n\t]*\\)"))
3149 (Info-goto-node node fork))
3150 ((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)"))
3151 (Info-goto-node "Top" fork))
3152 ((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)"))
3153 (Info-goto-node node fork)))
3157 (defvar Info-mode-map nil
3158 "Keymap containing Info commands.")
3159 (if Info-mode-map
3161 (setq Info-mode-map (make-keymap))
3162 (suppress-keymap Info-mode-map)
3163 (define-key Info-mode-map "." 'beginning-of-buffer)
3164 (define-key Info-mode-map " " 'Info-scroll-up)
3165 (define-key Info-mode-map "\C-m" 'Info-follow-nearest-node)
3166 (define-key Info-mode-map "\t" 'Info-next-reference)
3167 (define-key Info-mode-map "\e\t" 'Info-prev-reference)
3168 (define-key Info-mode-map [(shift tab)] 'Info-prev-reference)
3169 (define-key Info-mode-map [backtab] 'Info-prev-reference)
3170 (define-key Info-mode-map "1" 'Info-nth-menu-item)
3171 (define-key Info-mode-map "2" 'Info-nth-menu-item)
3172 (define-key Info-mode-map "3" 'Info-nth-menu-item)
3173 (define-key Info-mode-map "4" 'Info-nth-menu-item)
3174 (define-key Info-mode-map "5" 'Info-nth-menu-item)
3175 (define-key Info-mode-map "6" 'Info-nth-menu-item)
3176 (define-key Info-mode-map "7" 'Info-nth-menu-item)
3177 (define-key Info-mode-map "8" 'Info-nth-menu-item)
3178 (define-key Info-mode-map "9" 'Info-nth-menu-item)
3179 (define-key Info-mode-map "0" 'undefined)
3180 (define-key Info-mode-map "?" 'Info-summary)
3181 (define-key Info-mode-map "]" 'Info-forward-node)
3182 (define-key Info-mode-map "[" 'Info-backward-node)
3183 (define-key Info-mode-map "<" 'Info-top-node)
3184 (define-key Info-mode-map ">" 'Info-final-node)
3185 (define-key Info-mode-map "b" 'beginning-of-buffer)
3186 (define-key Info-mode-map "d" 'Info-directory)
3187 (define-key Info-mode-map "e" 'Info-edit)
3188 (define-key Info-mode-map "f" 'Info-follow-reference)
3189 (define-key Info-mode-map "g" 'Info-goto-node)
3190 (define-key Info-mode-map "h" 'Info-help)
3191 (define-key Info-mode-map "i" 'Info-index)
3192 (define-key Info-mode-map "l" 'Info-history-back)
3193 (define-key Info-mode-map "L" 'Info-history)
3194 (define-key Info-mode-map "m" 'Info-menu)
3195 (define-key Info-mode-map "n" 'Info-next)
3196 (define-key Info-mode-map "p" 'Info-prev)
3197 (define-key Info-mode-map "q" 'Info-exit)
3198 (define-key Info-mode-map "r" 'Info-history-forward)
3199 (define-key Info-mode-map "s" 'Info-search)
3200 (define-key Info-mode-map "S" 'Info-search-case-sensitively)
3202 (define-key Info-mode-map "\M-s" 'Info-search)
3203 (define-key Info-mode-map "\M-n" 'clone-buffer)
3204 (define-key Info-mode-map "t" 'Info-top-node)
3205 (define-key Info-mode-map "T" 'Info-toc)
3206 (define-key Info-mode-map "u" 'Info-up)
3208 (define-key Info-mode-map "w" 'Info-copy-current-node-name)
3209 (define-key Info-mode-map "c" 'Info-copy-current-node-name)
3211 (define-key Info-mode-map "^" 'Info-up)
3212 (define-key Info-mode-map "," 'Info-index-next)
3213 (define-key Info-mode-map "\177" 'Info-scroll-down)
3214 (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node)
3215 (define-key Info-mode-map [follow-link] 'mouse-face)
3218 (defun Info-check-pointer (item)
3221 (Info-extract-pointer item)
3225 Info-mode-menu Info-mode-map
3226 "Menu for Info files."
3227 '("Info"
3228 ["Up" Info-up :active (Info-check-pointer "up")
3229 :help "Go up in the Info tree"]
3230 ["Next" Info-next :active (Info-check-pointer "next")
3232 ["Previous" Info-prev :active (Info-check-pointer "prev[ious]*")
3234 ["Backward" Info-backward-node
3236 ["Forward" Info-forward-node
3240 ["Top" Info-top-node
3242 ["Final Node" Info-final-node
3246 ["Search..." Info-search
3247 :help "Search for regular expression in this Info file"]
3248 ["Search Next" Info-search-next
3250 ["Go to Node..." Info-goto-node
3252 ["Back in history" Info-history-back :active Info-history
3254 ["Forward in history" Info-history-forward :active Info-history-forward
3256 ["History" Info-history :active Info-history-list
3257 :help "Go to menu of visited nodes"]
3258 ["Table of Contents" Info-toc
3261 ["Lookup a String..." Info-index
3262 :help "Look for a string in the index items"]
3263 ["Next Matching Item" Info-index-next :active Info-index-alternatives
3267 ["Copy Node Name" Info-copy-current-node-name
3269 ["Clone Info buffer" clone-buffer
3270 :help "Create a twin copy of the current Info buffer."]
3271 ["Exit" Info-exit :help "Stop reading Info"]))
3277 (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map)
3278 (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map)
3279 (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map)
3280 (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map)
3281 (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
3282 (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
3283 (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
3284 (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map)
3285 (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map)
3286 (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map)
3289 (defvar Info-menu-last-node nil)
3293 (defun Info-menu-update ()
3294 "Update the Info menu for the current node."
3296 (if (or (not (eq major-mode 'Info-mode))
3297 (equal (list Info-current-file Info-current-node)
3298 Info-menu-last-node))
3301 (let* ((Info-complete-menu-buffer (current-buffer))
3303 (Info-complete-menu-item "" nil t)
3312 (Info-menu ,current)
3316 (setq entries (cons ["Other..." Info-menu t] entries)))
3319 (easy-menu-change '("Info") "Menu Item" (nreverse entries)))
3320 ;; Update reference menu. Code stolen from `Info-follow-reference'.
3341 (Info-follow-reference ,current)
3345 (setq entries (cons ["Other..." Info-follow-reference t]
3349 (easy-menu-change '("Info") "Reference" (nreverse entries)))
3351 (setq Info-menu-last-node (list Info-current-file Info-current-node)))
3357 (defun Info-copy-current-node-name (&optional arg)
3358 "Put the name of the current Info node into the kill ring.
3359 The name of the Info file is prepended to the node name in parentheses.
3362 (unless Info-current-node
3363 (error "No current Info node"))
3364 (let ((node (if (stringp Info-current-file)
3365 (concat "(" (file-name-nondirectory Info-current-file) ")"
3366 Info-current-node))))
3369 (unless (stringp Info-current-file)
3370 (setq node (format "(Info-find-node '%S '%S)"
3371 Info-current-file Info-current-node)))
3377 ;; Info mode is suitable only for specially formatted data.
3378 (put 'Info-mode 'mode-class 'special)
3379 (put 'Info-mode 'no-clone-indirect t)
3385 (defun Info-mode ()
3386 "Info mode provides commands for browsing through the Info documentation tree.
3387 Documentation in Info is divided into \"nodes\", each of which discusses
3388 one topic and contains references to other nodes which discuss related
3389 topics. Info has commands to follow the references and show you other nodes.
3391 \\<Info-mode-map>\
3392 \\[Info-help] Invoke the Info tutorial.
3393 \\[Info-exit] Quit Info: reselect previously selected buffer.
3395 Selecting other nodes:
3396 \\[Info-mouse-follow-nearest-node]
3400 \\[Info-follow-nearest-node] Follow a node reference near point, like \\[Info-mouse-follow-nearest-node].
3401 \\[Info-next] Move to the \"next\" node of this node.
3402 \\[Info-prev] Move to the \"previous\" node of this node.
3403 \\[Info-up] Move \"up\" from this node.
3404 \\[Info-menu] Pick menu item specified by name (or abbreviation).
3406 \\[Info-directory] Go to the Info directory node.
3407 \\[Info-top-node] Go to the Top node of this file.
3408 \\[Info-final-node] Go to the final node in this file.
3409 \\[Info-backward-node] Go backward one node, considering all nodes as forming one sequence.
3410 \\[Info-forward-node] Go forward one node, considering all nodes as forming one sequence.
3411 \\[Info-next-reference] Move cursor to next cross-reference or menu item.
3412 \\[Info-prev-reference] Move cursor to previous cross-reference or menu item.
3413 \\[Info-follow-reference] Follow a cross reference. Reads name of reference.
3414 \\[Info-history-back] Move back in history to the last node you were at.
3415 \\[Info-history-forward] Move forward in history to the node you returned from after using \\[Info-history-back].
3416 \\[Info-history] Go to menu of visited nodes.
3417 \\[Info-toc] Go to table of contents of the current Info file.
3420 \\[Info-scroll-up] Normally, scroll forward a full screen.
3425 \\[Info-scroll-down] Normally, scroll backward. If the beginning of the buffer is
3431 \\[Info-search] Search through this Info file for specified regexp,
3433 \\[Info-search-case-sensitively] Search through this Info file for specified regexp case-sensitively.
3434 \\[Info-search-next] Search for another occurrence of regexp
3435 from a previous \\<Info-mode-map>\\[Info-search] command.
3436 \\[Info-index] Search for a topic in this manual's Index and go to index entry.
3437 \\[Info-index-next] (comma) Move to the next match from a previous \\<Info-mode-map>\\[Info-index] command.
3439 \\[Info-goto-node] Move to node specified by name.
3443 \\[Info-copy-current-node-name] Put name of current Info node in the kill ring.
3444 \\[clone-buffer] Select a new cloned Info buffer in another window.
3445 \\[universal-argument] \\[info] Move to new Info file with completion.
3446 \\[universal-argument] N \\[info] Select Info buffer with prefix number in the name *info*<N>."
3448 (setq major-mode 'Info-mode)
3449 (setq mode-name "Info")
3451 (use-local-map Info-mode-map)
3452 (add-hook 'activate-menubar-hook 'Info-menu-update nil t)
3457 (make-local-variable 'Info-current-file)
3458 (make-local-variable 'Info-current-subfile)
3459 (make-local-variable 'Info-current-node)
3460 (make-local-variable 'Info-tag-table-marker)
3461 (setq Info-tag-table-marker (make-marker))
3462 (make-local-variable 'Info-tag-table-buffer)
3463 (setq Info-tag-table-buffer nil)
3464 (make-local-variable 'Info-history)
3465 (make-local-variable 'Info-history-forward)
3466 (make-local-variable 'Info-index-alternatives)
3468 (if Info-use-header-line
3478 (setq desktop-save-buffer 'Info-desktop-buffer-misc-data)
3479 (add-hook 'kill-buffer-hook 'Info-kill-buffer nil t)
3480 (add-hook 'clone-buffer-hook 'Info-clone-buffer-hook nil t)
3482 (add-hook 'isearch-mode-hook 'Info-isearch-start nil t)
3484 'Info-isearch-search)
3486 'Info-isearch-wrap)
3488 'Info-isearch-push-state)
3490 Info-search-whitespace-regexp)
3491 (Info-set-mode-line)
3492 (run-mode-hooks 'Info-mode-hook))
3494 ;; When an Info buffer is killed, make sure the associated tags buffer
3496 (defun Info-kill-buffer ()
3497 (and (eq major-mode 'Info-mode)
3498 Info-tag-table-buffer
3499 (kill-buffer Info-tag-table-buffer)))
3501 (defun Info-clone-buffer-hook ()
3502 (when (bufferp Info-tag-table-buffer)
3503 (setq Info-tag-table-buffer
3504 (with-current-buffer Info-tag-table-buffer (clone-buffer))))
3505 (let ((m Info-tag-table-marker))
3507 (setq Info-tag-table-marker
3508 (if (and (marker-position m) (bufferp Info-tag-table-buffer))
3509 (with-current-buffer Info-tag-table-buffer
3513 (defvar Info-edit-map (let ((map (make-sparse-keymap)))
3515 (define-key map "\C-c\C-c" 'Info-cease-edit)
3517 "Local keymap used within `e' command of Info.")
3519 ;; Info-edit mode is suitable only for specially formatted data.
3520 (put 'Info-edit-mode 'mode-class 'special)
3522 (defun Info-edit-mode ()
3523 "Major mode for editing the contents of an Info node.
3524 Like text mode with the addition of `Info-cease-edit'
3525 which returns to Info mode for browsing.
3526 \\{Info-edit-map}"
3527 (use-local-map Info-edit-map)
3528 (setq major-mode 'Info-edit-mode)
3529 (setq mode-name "Info Edit")
3534 (run-mode-hooks 'Info-edit-mode-hook))
3536 (defun Info-edit ()
3537 "Edit the contents of this Info node.
3538 Allowed only if variable `Info-enable-edit' is non-nil."
3540 (or Info-enable-edit
3541 (error "Editing Info nodes is not enabled"))
3542 (Info-edit-mode)
3544 "Editing: Type \\<Info-edit-map>\\[Info-cease-edit] to return to info")))
3546 (defun Info-cease-edit ()
3547 "Finish editing Info node; switch back to Info proper."
3553 (use-local-map Info-mode-map)
3554 (setq major-mode 'Info-mode)
3555 (setq mode-name "Info")
3556 (Info-set-mode-line)
3559 (and (marker-position Info-tag-table-marker)
3561 (message "Tags may have changed. Use Info-tagify if necessary")))
3564 (defvar Info-file-list-for-emacs
3565 '("ediff" "eudc" "forms" "gnus" "info" ("Info" . "info") ("mh" . "mh-e")
3585 "List of Info files that describe Emacs commands.
3590 (defun Info-find-emacs-command-nodes (command)
3592 The `info-file' property of COMMAND says which Info manual to search.
3593 If COMMAND has no property, the variable `Info-file-list-for-emacs'
3594 defines heuristics for which Info manual to try.
3595 The locations are of the format used in `Info-history', i.e.
3598 `Info-goto-emacs-command-node'), and 0 for the rest elements of a list."
3604 ;; Determine which Info file this command is documented in.
3609 (let ((file-list Info-file-list-for-emacs))
3622 (Info-find-node info-file "Top")
3623 ;; Bind Info-history to nil, to prevent the index nodes from
3625 (let ((Info-history nil)
3626 (Info-history-list nil)
3627 node (nodes (Info-index-nodes)))
3628 (Info-goto-node (car nodes))
3634 (cons (list Info-current-file
3640 (and (setq nodes (cdr nodes) node (car nodes))))
3641 (Info-goto-node node)))
3647 ;;;###autoload (put 'Info-goto-emacs-command-node 'info-file "emacs")
3649 (defun Info-goto-emacs-command-node (command)
3650 "Go to the Info node in the Emacs manual for command COMMAND.
3653 the variable `Info-file-list-for-emacs'.
3661 (let ((where (Info-find-emacs-command-nodes command)))
3664 ;; Get Info running, and pop to it in another window.
3667 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
3668 ;; Bind Info-history to nil, to prevent the last Index node
3669 ;; visited by Info-find-emacs-command-nodes from being
3671 (let ((Info-history nil) (Info-history-list nil)
3673 (Info-find-node (nth 0 (car where)) (nth 1 (car where)))
3678 ;; (car where) will be pushed onto Info-history
3680 ;; nodes that were found on the history.
3681 (setq Info-history (nconc (cdr where) Info-history))
3685 (substitute-command-keys "\\[Info-history-back]")
3689 ;;;###autoload (put 'Info-goto-emacs-key-command-node 'info-file "emacs")
3691 (defun Info-goto-emacs-key-command-node (key)
3697 the variable `Info-file-list-for-emacs'."
3704 (Info-goto-emacs-command-node
3707 (Info-goto-emacs-command-node command)))))
3710 (defvar Info-next-link-keymap
3712 (define-key keymap [header-line mouse-1] 'Info-next)
3713 (define-key keymap [header-line mouse-2] 'Info-next)
3715 (define-key keymap [mouse-2] 'Info-next)
3720 (defvar Info-prev-link-keymap
3722 (define-key keymap [header-line mouse-1] 'Info-prev)
3723 (define-key keymap [header-line mouse-2] 'Info-prev)
3725 (define-key keymap [mouse-2] 'Info-prev)
3730 (defvar Info-up-link-keymap
3732 (define-key keymap [header-line mouse-1] 'Info-up)
3733 (define-key keymap [header-line mouse-2] 'Info-up)
3735 (define-key keymap [mouse-2] 'Info-up)
3740 (defun Info-fontify-node ()
3749 (fontify-visited-p ; visited nodes need to be re-fontified
3750 (and Info-fontify-visited-nodes
3751 ;; Don't take time to refontify visited nodes in huge nodes
3752 Info-fontify-maximum-menu-size
3753 (< (- (point-max) (point-min)) Info-fontify-maximum-menu-size)))
3780 ((string-equal (downcase tag) "prev") Info-prev-link-keymap)
3781 ((string-equal (downcase tag) "next") Info-next-link-keymap)
3782 ((string-equal (downcase tag) "up" ) Info-up-link-keymap))))))
3783 (when Info-use-header-line
3849 (when Info-hide-note-references
3850 (when (not (eq Info-hide-note-references 'hide))
3897 ;; Display visited nodes in a different face
3898 (if (and Info-fontify-visited-nodes
3913 Info-current-file))
3914 (hl Info-history-list)
3940 (when (memq Info-hide-note-references '(t hide))
3944 (if (and (match-string 6) (not (eq Info-hide-note-references 'hide)))
3959 (when (and Info-refill-paragraphs Info-hide-note-references)
3965 Info-refill-paragraphs
3988 Info-fontify-maximum-menu-size
3989 (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
3993 (concat "^\\* Menu:\\|\\(?:^\\* +\\(" Info-menu-entry-name-re "\\)\\(:"
3994 Info-node-spec-re "\\([ \t]*\\)\\)\\)")
4017 (if (and Info-fontify-visited-nodes
4027 Info-current-file))
4028 (hl Info-history-list)
4046 (memq Info-hide-note-references '(t hide))
4047 (not (Info-index-node)))
4083 ;; Hide index line numbers
4085 (when (and not-fontified-p (Info-index-node))
4104 ;; current Info node.
4107 (defvar Info-speedbar-key-map nil
4110 (defun Info-install-speedbar-variables ()
4111 "Install those variables used by speedbar to enhance Info."
4112 (if Info-speedbar-key-map
4114 (setq Info-speedbar-key-map (speedbar-make-specialized-keymap))
4117 (define-key Info-speedbar-key-map "e" 'speedbar-edit-line)
4118 (define-key Info-speedbar-key-map "\C-m" 'speedbar-edit-line)
4119 (define-key Info-speedbar-key-map "+" 'speedbar-expand-line)
4120 (define-key Info-speedbar-key-map "-" 'speedbar-contract-line)
4123 (speedbar-add-expansion-list '("Info" Info-speedbar-menu-items
4124 Info-speedbar-key-map
4125 Info-speedbar-hierarchy-buttons)))
4127 (defvar Info-speedbar-menu-items
4140 (Info-install-speedbar-variables)
4141 (add-hook 'speedbar-load-hook 'Info-install-speedbar-variables))
4143 ;;; Info hierarchy display method
4145 (defun Info-speedbar-browser ()
4146 "Initialize speedbar to display an Info node browser.
4152 ;; Now, throw us into Info mode on speedbar.
4153 (speedbar-change-initial-expansion-list "Info")
4156 (defun Info-speedbar-hierarchy-buttons (directory depth &optional node)
4157 "Display an Info directory hierarchy in speedbar.
4165 (looking-at "Info Nodes:"))))
4171 (speedbar-with-writable (insert "Info Nodes:\n")))
4176 (Info-speedbar-fetch-file-nodes (or node '"(dir)top"))))
4181 (speedbar-make-tag-line 'bracket ?+ 'Info-speedbar-expand-node
4184 'Info-speedbar-goto-node
4190 (defun Info-speedbar-goto-node (text node indent)
4207 (Info-find-node (match-string 1 node) (match-string 2 node))
4211 (if (string= speedbar-initial-expansion-list-name "Info")
4215 (defun Info-speedbar-expand-node (text token indent)
4225 (Info-speedbar-hierarchy-buttons nil (1+ indent) token)))
4234 (defun Info-speedbar-fetch-file-nodes (nodespec)
4238 ;; Set up a buffer we can use to fake-out Info.
4240 (if (not (equal major-mode 'Info-mode))
4241 (Info-mode))
4245 (Info-find-node (match-string 1 nodespec) (match-string 2 nodespec)))
4268 ;;; Info mode node listing
4270 (defun Info-speedbar-buttons (buffer)
4271 "Create a speedbar display to help navigation in an Info file.
4275 (not (looking-at "Info Nodes:"))))
4277 (Info-speedbar-hierarchy-buttons nil 0))
4280 "^No `.*' in index$"
4283 "^No current Info node$"
4286 "^No more nodes$"
4290 "^No previous nodes$"
4295 "^This is the \\(?:first\\|last\\) Info node you looked at$"
4301 (defun Info-desktop-buffer-misc-data (desktop-dirname)
4303 (unless (member Info-current-file '(apropos history toc nil))
4304 (list Info-current-file Info-current-node)))
4306 (defun Info-restore-desktop-buffer (desktop-buffer-file-name
4309 "Restore an Info buffer specified in a desktop file."
4315 (Info-mode))
4316 (Info-find-node first second)
4320 '(Info-mode . Info-restore-desktop-buffer))