diff options
Diffstat (limited to 'lisp/info.el')
| -rw-r--r-- | lisp/info.el | 628 |
1 files changed, 404 insertions, 224 deletions
diff --git a/lisp/info.el b/lisp/info.el index c67a1a5f0c7..43e1dafcc6f 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -66,29 +66,29 @@ The Lisp code is executed when the node is selected.") | |||
| 66 | (put 'Info-enable-active-nodes 'risky-local-variable t) | 66 | (put 'Info-enable-active-nodes 'risky-local-variable t) |
| 67 | 67 | ||
| 68 | (defface info-node | 68 | (defface info-node |
| 69 | '((((class color) (background light)) (:foreground "brown" :weight bold :slant italic)) | 69 | '((((class color) (background light)) :foreground "brown" :weight bold :slant italic) |
| 70 | (((class color) (background dark)) (:foreground "white" :weight bold :slant italic)) | 70 | (((class color) (background dark)) :foreground "white" :weight bold :slant italic) |
| 71 | (t (:weight bold :slant italic))) | 71 | (t :weight bold :slant italic)) |
| 72 | "Face for Info node names." | 72 | "Face for Info node names." |
| 73 | :group 'info) | 73 | :group 'info) |
| 74 | 74 | ||
| 75 | (defface info-menu-5 | 75 | (defface info-menu-5 |
| 76 | '((((class color)) (:foreground "red1")) | 76 | '((((class color)) :foreground "red1") |
| 77 | (t (:underline t))) | 77 | (t :underline t)) |
| 78 | "Face for every third `*' in an Info menu." | 78 | "Face for every third `*' in an Info menu." |
| 79 | :group 'info) | 79 | :group 'info) |
| 80 | 80 | ||
| 81 | (defface info-xref | 81 | (defface info-xref |
| 82 | '((((class color) (background light)) (:foreground "blue")) | 82 | '((((class color) (background light)) :foreground "blue") |
| 83 | (((class color) (background dark)) (:foreground "cyan")) | 83 | (((class color) (background dark)) :foreground "cyan") |
| 84 | (t (:underline t))) | 84 | (t :underline t)) |
| 85 | "Face for Info cross-references." | 85 | "Face for Info cross-references." |
| 86 | :group 'info) | 86 | :group 'info) |
| 87 | 87 | ||
| 88 | (defface info-xref-visited | 88 | (defface info-xref-visited |
| 89 | '((((class color) (background light)) (:foreground "magenta4")) | 89 | '((t :inherit info-xref) |
| 90 | (((class color) (background dark)) (:foreground "magenta4")) | 90 | (((class color) (background light)) :foreground "magenta4") |
| 91 | (t (:underline t))) | 91 | (((class color) (background dark)) :foreground "magenta3")) ;"violet"? |
| 92 | "Face for visited Info cross-references." | 92 | "Face for visited Info cross-references." |
| 93 | :group 'info) | 93 | :group 'info) |
| 94 | 94 | ||
| @@ -110,12 +110,12 @@ A header-line does not scroll with the rest of the buffer." | |||
| 110 | :group 'info) | 110 | :group 'info) |
| 111 | 111 | ||
| 112 | (defface info-header-xref | 112 | (defface info-header-xref |
| 113 | '((t (:inherit info-xref))) | 113 | '((t :inherit info-xref)) |
| 114 | "Face for Info cross-references in a node header." | 114 | "Face for Info cross-references in a node header." |
| 115 | :group 'info) | 115 | :group 'info) |
| 116 | 116 | ||
| 117 | (defface info-header-node | 117 | (defface info-header-node |
| 118 | '((t (:inherit info-node))) | 118 | '((t :inherit info-node)) |
| 119 | "Face for Info nodes in a node header." | 119 | "Face for Info nodes in a node header." |
| 120 | :group 'info) | 120 | :group 'info) |
| 121 | 121 | ||
| @@ -239,10 +239,11 @@ Marker points nowhere if file has no tag table.") | |||
| 239 | (defvar Info-index-alternatives nil | 239 | (defvar Info-index-alternatives nil |
| 240 | "List of possible matches for last `Info-index' command.") | 240 | "List of possible matches for last `Info-index' command.") |
| 241 | 241 | ||
| 242 | (defvar Info-reference-name nil | 242 | (defvar Info-point-loc nil |
| 243 | "Name of the selected cross-reference. | 243 | "Point location within a selected node. |
| 244 | Point is moved to the proper occurrence of this name within a node | 244 | If string, the point is moved to the proper occurrence of the |
| 245 | after selecting it.") | 245 | name of the followed cross reference within a selected node. |
| 246 | If number, the point is moved to the corresponding line.") | ||
| 246 | 247 | ||
| 247 | (defvar Info-standalone nil | 248 | (defvar Info-standalone nil |
| 248 | "Non-nil if Emacs was started solely as an Info browser.") | 249 | "Non-nil if Emacs was started solely as an Info browser.") |
| @@ -449,28 +450,39 @@ Do the right thing if the file has been compressed or zipped." | |||
| 449 | "Like `info' but show the Info buffer in another window." | 450 | "Like `info' but show the Info buffer in another window." |
| 450 | (interactive (if current-prefix-arg | 451 | (interactive (if current-prefix-arg |
| 451 | (list (read-file-name "Info file name: " nil nil t)))) | 452 | (list (read-file-name "Info file name: " nil nil t)))) |
| 452 | (let (same-window-buffer-names) | 453 | (let (same-window-buffer-names same-window-regexps) |
| 453 | (info file))) | 454 | (info file))) |
| 454 | 455 | ||
| 455 | ;;;###autoload (add-hook 'same-window-buffer-names "*info*") | 456 | ;;;###autoload (add-hook 'same-window-regexps "\\*info\\*\\(\\|<[0-9]+>\\)") |
| 456 | 457 | ||
| 457 | ;;;###autoload | 458 | ;;;###autoload |
| 458 | (defun info (&optional file) | 459 | (defun info (&optional file buffer) |
| 459 | "Enter Info, the documentation browser. | 460 | "Enter Info, the documentation browser. |
| 460 | Optional argument FILE specifies the file to examine; | 461 | Optional argument FILE specifies the file to examine; |
| 461 | the default is the top-level directory of Info. | 462 | the default is the top-level directory of Info. |
| 462 | Called from a program, FILE may specify an Info node of the form | 463 | Called from a program, FILE may specify an Info node of the form |
| 463 | `(FILENAME)NODENAME'. | 464 | `(FILENAME)NODENAME'. |
| 465 | Optional argument BUFFER specifies the Info buffer name; | ||
| 466 | the default buffer name is *info*. If BUFFER exists, | ||
| 467 | just switch to BUFFER. Otherwise, create a new buffer | ||
| 468 | with the top-level Info directory. | ||
| 464 | 469 | ||
| 465 | In interactive use, a prefix argument directs this command | 470 | In interactive use, a non-numeric prefix argument directs |
| 466 | to read a file name from the minibuffer. | 471 | this command to read a file name from the minibuffer. |
| 472 | A numeric prefix argument selects an Info buffer with the prefix number | ||
| 473 | appended to the Info buffer name. | ||
| 467 | 474 | ||
| 468 | The search path for Info files is in the variable `Info-directory-list'. | 475 | The search path for Info files is in the variable `Info-directory-list'. |
| 469 | The top-level Info directory is made by combining all the files named `dir' | 476 | The top-level Info directory is made by combining all the files named `dir' |
| 470 | in all the directories in that path." | 477 | in all the directories in that path." |
| 471 | (interactive (if current-prefix-arg | 478 | (interactive (list |
| 472 | (list (read-file-name "Info file name: " nil nil t)))) | 479 | (if (and current-prefix-arg (not (numberp current-prefix-arg))) |
| 473 | (pop-to-buffer "*info*") | 480 | (read-file-name "Info file name: " nil nil t)) |
| 481 | (if (numberp current-prefix-arg) | ||
| 482 | (format "*info*<%s>" current-prefix-arg)))) | ||
| 483 | (pop-to-buffer (or buffer "*info*")) | ||
| 484 | (if (and buffer (not (eq major-mode 'Info-mode))) | ||
| 485 | (Info-mode)) | ||
| 474 | (if file | 486 | (if file |
| 475 | ;; If argument already contains parentheses, don't add another set | 487 | ;; If argument already contains parentheses, don't add another set |
| 476 | ;; since the argument will then be parsed improperly. This also | 488 | ;; since the argument will then be parsed improperly. This also |
| @@ -480,7 +492,7 @@ in all the directories in that path." | |||
| 480 | (Info-goto-node file) | 492 | (Info-goto-node file) |
| 481 | (Info-goto-node (concat "(" file ")"))) | 493 | (Info-goto-node (concat "(" file ")"))) |
| 482 | (if (zerop (buffer-size)) | 494 | (if (zerop (buffer-size)) |
| 483 | (Info-directory)))) | 495 | (Info-directory)))) |
| 484 | 496 | ||
| 485 | ;;;###autoload | 497 | ;;;###autoload |
| 486 | (defun info-emacs-manual () | 498 | (defun info-emacs-manual () |
| @@ -535,11 +547,15 @@ just return nil (no error)." | |||
| 535 | (if (stringp filename) | 547 | (if (stringp filename) |
| 536 | (let (temp temp-downcase found) | 548 | (let (temp temp-downcase found) |
| 537 | (setq filename (substitute-in-file-name filename)) | 549 | (setq filename (substitute-in-file-name filename)) |
| 538 | (cond | 550 | (cond |
| 539 | ((string= (downcase filename) "dir") | 551 | ((string= (downcase filename) "dir") |
| 540 | (setq found t)) | 552 | (setq found t)) |
| 541 | ((string= filename "apropos") | 553 | ((string= filename "apropos") |
| 542 | (setq found 'apropos)) | 554 | (setq found 'apropos)) |
| 555 | ((string= filename "history") | ||
| 556 | (setq found 'history)) | ||
| 557 | ((string= filename "toc") | ||
| 558 | (setq found 'toc)) | ||
| 543 | (t | 559 | (t |
| 544 | (let ((dirs (if (string-match "^\\./" filename) | 560 | (let ((dirs (if (string-match "^\\./" filename) |
| 545 | ;; If specified name starts with `./' | 561 | ;; If specified name starts with `./' |
| @@ -742,6 +758,10 @@ a case-insensitive match is tried." | |||
| 742 | (Info-insert-dir)) | 758 | (Info-insert-dir)) |
| 743 | ((eq filename 'apropos) | 759 | ((eq filename 'apropos) |
| 744 | (insert-buffer-substring " *info-apropos*")) | 760 | (insert-buffer-substring " *info-apropos*")) |
| 761 | ((eq filename 'history) | ||
| 762 | (insert-buffer-substring " *info-history*")) | ||
| 763 | ((eq filename 'toc) | ||
| 764 | (insert-buffer-substring " *info-toc*")) | ||
| 745 | (t | 765 | (t |
| 746 | (info-insert-file-contents filename nil) | 766 | (info-insert-file-contents filename nil) |
| 747 | (setq default-directory (file-name-directory filename)))) | 767 | (setq default-directory (file-name-directory filename)))) |
| @@ -782,6 +802,8 @@ a case-insensitive match is tried." | |||
| 782 | (cond | 802 | (cond |
| 783 | ((eq filename t) "dir") | 803 | ((eq filename t) "dir") |
| 784 | ((eq filename 'apropos) "apropos") | 804 | ((eq filename 'apropos) "apropos") |
| 805 | ((eq filename 'history) "history") | ||
| 806 | ((eq filename 'toc) "toc") | ||
| 785 | (t filename))) | 807 | (t filename))) |
| 786 | )) | 808 | )) |
| 787 | ;; Use string-equal, not equal, to ignore text props. | 809 | ;; Use string-equal, not equal, to ignore text props. |
| @@ -842,9 +864,17 @@ a case-insensitive match is tried." | |||
| 842 | (let ((pos (Info-find-node-in-buffer regexp))) | 864 | (let ((pos (Info-find-node-in-buffer regexp))) |
| 843 | (when pos | 865 | (when pos |
| 844 | (goto-char pos) | 866 | (goto-char pos) |
| 845 | (throw 'foo t)) | 867 | (throw 'foo t))) |
| 846 | (error "No such anchor in tag table or node in tag table or file: %s" | 868 | |
| 847 | nodename))) | 869 | (when (string-match "\\([^.]+\\)\\." nodename) |
| 870 | (let (Info-point-loc) | ||
| 871 | (Info-find-node-2 | ||
| 872 | filename (match-string 1 nodename) no-going-back)) | ||
| 873 | (widen) | ||
| 874 | (throw 'foo t)) | ||
| 875 | |||
| 876 | ;; No such anchor in tag table or node in tag table or file | ||
| 877 | (error "No such node or anchor: %s" nodename)) | ||
| 848 | 878 | ||
| 849 | (Info-select-node) | 879 | (Info-select-node) |
| 850 | (goto-char (point-min)) | 880 | (goto-char (point-min)) |
| @@ -856,9 +886,12 @@ a case-insensitive match is tried." | |||
| 856 | (cons new-history | 886 | (cons new-history |
| 857 | (delete new-history Info-history-list)))) | 887 | (delete new-history Info-history-list)))) |
| 858 | (goto-char anchorpos)) | 888 | (goto-char anchorpos)) |
| 859 | (Info-reference-name | 889 | ((numberp Info-point-loc) |
| 860 | (Info-find-index-name Info-reference-name) | 890 | (forward-line (1- Info-point-loc)) |
| 861 | (setq Info-reference-name nil)))))) | 891 | (setq Info-point-loc nil)) |
| 892 | ((stringp Info-point-loc) | ||
| 893 | (Info-find-index-name Info-point-loc) | ||
| 894 | (setq Info-point-loc nil)))))) | ||
| 862 | ;; If we did not finish finding the specified node, | 895 | ;; If we did not finish finding the specified node, |
| 863 | ;; go back to the previous one. | 896 | ;; go back to the previous one. |
| 864 | (or Info-current-node no-going-back (null Info-history) | 897 | (or Info-current-node no-going-back (null Info-history) |
| @@ -982,9 +1015,7 @@ a case-insensitive match is tried." | |||
| 982 | nodename end) | 1015 | nodename end) |
| 983 | (re-search-backward "^\^_") | 1016 | (re-search-backward "^\^_") |
| 984 | (search-forward "Node: ") | 1017 | (search-forward "Node: ") |
| 985 | (setq nodename | 1018 | (setq nodename (Info-following-node-name)) |
| 986 | (and (looking-at (Info-following-node-name-re)) | ||
| 987 | (match-string 1))) | ||
| 988 | (search-forward "\n\^_" nil 'move) | 1019 | (search-forward "\n\^_" nil 'move) |
| 989 | (beginning-of-line) | 1020 | (beginning-of-line) |
| 990 | (setq end (point)) | 1021 | (setq end (point)) |
| @@ -1053,7 +1084,7 @@ a case-insensitive match is tried." | |||
| 1053 | (goto-char (point-min)) | 1084 | (goto-char (point-min)) |
| 1054 | ;; Remove duplicate headings in the same menu. | 1085 | ;; Remove duplicate headings in the same menu. |
| 1055 | (while (search-forward "\n* Menu:" nil t) | 1086 | (while (search-forward "\n* Menu:" nil t) |
| 1056 | (setq limit (save-excursion (search-forward "\n" nil t))) | 1087 | (setq limit (save-excursion (search-forward "\n\^_" nil t))) |
| 1057 | ;; Look for the next heading to unify. | 1088 | ;; Look for the next heading to unify. |
| 1058 | (while (re-search-forward "^\\(\\w.*\\)\n\\*" limit t) | 1089 | (while (re-search-forward "^\\(\\w.*\\)\n\\*" limit t) |
| 1059 | (let ((name (match-string 1)) | 1090 | (let ((name (match-string 1)) |
| @@ -1264,7 +1295,8 @@ any double quotes or backslashes must be escaped (\\\",\\\\)." | |||
| 1264 | (let ((new-history (list Info-current-file Info-current-node))) | 1295 | (let ((new-history (list Info-current-file Info-current-node))) |
| 1265 | (setq Info-history-list | 1296 | (setq Info-history-list |
| 1266 | (cons new-history (delete new-history Info-history-list)))) | 1297 | (cons new-history (delete new-history Info-history-list)))) |
| 1267 | (Info-fontify-node) | 1298 | (if (not (eq Info-fontify-maximum-menu-size nil)) |
| 1299 | (Info-fontify-node)) | ||
| 1268 | (Info-display-images-node) | 1300 | (Info-display-images-node) |
| 1269 | (Info-hide-cookies-node) | 1301 | (Info-hide-cookies-node) |
| 1270 | (run-hooks 'Info-selection-hook))))) | 1302 | (run-hooks 'Info-selection-hook))))) |
| @@ -1284,6 +1316,7 @@ any double quotes or backslashes must be escaped (\\\",\\\\)." | |||
| 1284 | ;; Go to an info node specified with a filename-and-nodename string | 1316 | ;; Go to an info node specified with a filename-and-nodename string |
| 1285 | ;; of the sort that is found in pointers in nodes. | 1317 | ;; of the sort that is found in pointers in nodes. |
| 1286 | 1318 | ||
| 1319 | ;;;###autoload | ||
| 1287 | (defun Info-goto-node (nodename &optional fork) | 1320 | (defun Info-goto-node (nodename &optional fork) |
| 1288 | "Go to info node named NODENAME. Give just NODENAME or (FILENAME)NODENAME. | 1321 | "Go to info node named NODENAME. Give just NODENAME or (FILENAME)NODENAME. |
| 1289 | If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file | 1322 | If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file |
| @@ -1298,8 +1331,6 @@ If FORK is a string, it is the name to use for the new buffer." | |||
| 1298 | (if fork | 1331 | (if fork |
| 1299 | (set-buffer | 1332 | (set-buffer |
| 1300 | (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t))) | 1333 | (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t))) |
| 1301 | (if (member (buffer-name) '("*info-history*" "*info-toc*")) | ||
| 1302 | (switch-to-buffer "*info*")) | ||
| 1303 | (let (filename) | 1334 | (let (filename) |
| 1304 | (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)" | 1335 | (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)" |
| 1305 | nodename) | 1336 | nodename) |
| @@ -1307,9 +1338,9 @@ If FORK is a string, it is the name to use for the new buffer." | |||
| 1307 | "" | 1338 | "" |
| 1308 | (match-string 2 nodename)) | 1339 | (match-string 2 nodename)) |
| 1309 | nodename (match-string 3 nodename)) | 1340 | nodename (match-string 3 nodename)) |
| 1310 | (let ((trim (string-match "\\s *\\'" filename))) | 1341 | (let ((trim (string-match "\\s +\\'" filename))) |
| 1311 | (if trim (setq filename (substring filename 0 trim)))) | 1342 | (if trim (setq filename (substring filename 0 trim)))) |
| 1312 | (let ((trim (string-match "\\s *\\'" nodename))) | 1343 | (let ((trim (string-match "\\s +\\'" nodename))) |
| 1313 | (if trim (setq nodename (substring nodename 0 trim)))) | 1344 | (if trim (setq nodename (substring nodename 0 trim)))) |
| 1314 | (if transient-mark-mode (deactivate-mark)) | 1345 | (if transient-mark-mode (deactivate-mark)) |
| 1315 | (Info-find-node (if (equal filename "") nil filename) | 1346 | (Info-find-node (if (equal filename "") nil filename) |
| @@ -1616,75 +1647,63 @@ If SAME-FILE is non-nil, do not move to a different Info file." | |||
| 1616 | (interactive) | 1647 | (interactive) |
| 1617 | (Info-find-node "dir" "top")) | 1648 | (Info-find-node "dir" "top")) |
| 1618 | 1649 | ||
| 1619 | ;;;###autoload (add-hook 'same-window-buffer-names "*info-history*") | ||
| 1620 | |||
| 1621 | (defun Info-history () | 1650 | (defun Info-history () |
| 1622 | "Create the buffer *info-history* with a menu of visited nodes." | 1651 | "Go to a node with a menu of visited nodes." |
| 1623 | (interactive) | 1652 | (interactive) |
| 1624 | (let ((curr-file Info-current-file) | 1653 | (let ((curr-file Info-current-file) |
| 1625 | (curr-node Info-current-node) | 1654 | (curr-node Info-current-node) |
| 1626 | p) | 1655 | p) |
| 1627 | (pop-to-buffer | 1656 | (with-current-buffer (get-buffer-create " *info-history*") |
| 1628 | (with-current-buffer (get-buffer-create "*info-history*") | 1657 | (let ((inhibit-read-only t)) |
| 1629 | (let ((inhibit-read-only t)) | 1658 | (erase-buffer) |
| 1630 | (erase-buffer) | 1659 | (goto-char (point-min)) |
| 1631 | (goto-char (point-min)) | 1660 | (insert "\n\^_\nFile: history Node: Top, Up: (dir)\n\n") |
| 1632 | (insert "Node: History\n\n") | 1661 | (insert "Recently Visited Nodes\n**********************\n\n") |
| 1633 | (insert "Recently Visited Nodes\n**********************\n\n") | 1662 | (insert "* Menu:\n\n") |
| 1634 | (insert "* Menu:\n\n") | 1663 | (let ((hl (delete '("history" "Top") Info-history-list))) |
| 1635 | (let ((hl Info-history-list)) | 1664 | (while hl |
| 1636 | (while hl | 1665 | (let ((file (nth 0 (car hl))) |
| 1637 | (let ((file (nth 0 (car hl))) | 1666 | (node (nth 1 (car hl)))) |
| 1638 | (node (nth 1 (car hl)))) | 1667 | (if (and (string-equal file curr-file) |
| 1639 | (if (and (string-equal file curr-file) | 1668 | (string-equal node curr-node)) |
| 1640 | (string-equal node curr-node)) | 1669 | (setq p (point))) |
| 1641 | (setq p (point))) | 1670 | (insert "* " node ": (" (file-name-nondirectory file) |
| 1642 | (insert "* " node ": (" (file-name-nondirectory file) | 1671 | ")" node ".\n")) |
| 1643 | ")" node ".\n")) | 1672 | (setq hl (cdr hl)))))) |
| 1644 | (setq hl (cdr hl)))) | 1673 | (Info-find-node "history" "Top") |
| 1645 | (or (eq major-mode 'Info-mode) (Info-mode)) | ||
| 1646 | (setq Info-current-file "info-history") | ||
| 1647 | (setq Info-current-node "Info History") | ||
| 1648 | (Info-set-mode-line) | ||
| 1649 | (if (not (bobp)) (Info-fontify-node)) | ||
| 1650 | (current-buffer)))) | ||
| 1651 | (goto-char (or p (point-min))))) | 1674 | (goto-char (or p (point-min))))) |
| 1652 | 1675 | ||
| 1653 | ;;;###autoload (add-hook 'same-window-buffer-names "*info-toc*") | ||
| 1654 | |||
| 1655 | (defun Info-toc () | 1676 | (defun Info-toc () |
| 1656 | "Create the buffer *info-toc* with Info file's table of contents." | 1677 | "Go to a node with table of contents of the current Info file. |
| 1678 | Table of contents is created from the tree structure of menus." | ||
| 1657 | (interactive) | 1679 | (interactive) |
| 1658 | (let ((curr-file Info-current-file) | 1680 | (let ((curr-file Info-current-file) |
| 1659 | (curr-node Info-current-node) | 1681 | (curr-node Info-current-node) |
| 1660 | p) | 1682 | p) |
| 1661 | (pop-to-buffer | 1683 | (with-current-buffer (get-buffer-create " *info-toc*") |
| 1662 | (with-current-buffer (get-buffer-create "*info-toc*") | 1684 | (let ((inhibit-read-only t) |
| 1663 | (if (not (equal Info-current-file curr-file)) | 1685 | (node-list (Info-build-toc curr-file))) |
| 1664 | (let ((inhibit-read-only t) | 1686 | (erase-buffer) |
| 1665 | (node-list (Info-build-toc curr-file))) | 1687 | (goto-char (point-min)) |
| 1666 | (erase-buffer) | 1688 | (insert "\n\^_\nFile: toc Node: Top, Up: (dir)\n\n") |
| 1667 | (goto-char (point-min)) | 1689 | (insert "Table of Contents\n*****************\n\n") |
| 1668 | (insert "Node: Contents\n\n") | 1690 | (insert "*Note Top::\n") |
| 1669 | (insert "Table of Contents\n*****************\n\n") | 1691 | (Info-insert-toc |
| 1670 | (insert "*Note Top::\n") | 1692 | (nth 2 (assoc "Top" node-list)) ; get Top nodes |
| 1671 | (Info-insert-toc | 1693 | node-list 0 (substring-no-properties curr-file))) |
| 1672 | (nth 2 (assoc "Top" node-list)) ; get Top nodes | 1694 | (if (not (bobp)) |
| 1673 | node-list 0) | 1695 | (let ((Info-hide-note-references 'hide) |
| 1674 | (or (eq major-mode 'Info-mode) (Info-mode)) | 1696 | (Info-fontify-visited-nodes nil)) |
| 1675 | (setq Info-current-file curr-file) | 1697 | (Info-mode) |
| 1676 | (setq Info-current-node "Contents") | 1698 | (setq Info-current-file "toc" Info-current-node "Top") |
| 1677 | (Info-set-mode-line))) | 1699 | (Info-fontify-node))) |
| 1678 | (if (not (bobp)) | 1700 | (goto-char (point-min)) |
| 1679 | (let ((Info-hide-note-references 'hide)) | 1701 | (if (setq p (search-forward (concat "*Note " curr-node ":") nil t)) |
| 1680 | (Info-fontify-node))) | 1702 | (setq p (- p (length curr-node) 2)))) |
| 1681 | (goto-char (point-min)) | 1703 | (Info-find-node "toc" "Top") |
| 1682 | (if (setq p (search-forward (concat "*Note " curr-node "::") nil t)) | ||
| 1683 | (setq p (- p (length curr-node) 2))) | ||
| 1684 | (current-buffer))) | ||
| 1685 | (goto-char (or p (point-min))))) | 1704 | (goto-char (or p (point-min))))) |
| 1686 | 1705 | ||
| 1687 | (defun Info-insert-toc (nodes node-list level) | 1706 | (defun Info-insert-toc (nodes node-list level curr-file) |
| 1688 | "Insert table of contents with references to nodes." | 1707 | "Insert table of contents with references to nodes." |
| 1689 | (let ((section "Top")) | 1708 | (let ((section "Top")) |
| 1690 | (while nodes | 1709 | (while nodes |
| @@ -1692,8 +1711,8 @@ If SAME-FILE is non-nil, do not move to a different Info file." | |||
| 1692 | (unless (member (nth 1 node) (list nil section)) | 1711 | (unless (member (nth 1 node) (list nil section)) |
| 1693 | (insert (setq section (nth 1 node)) "\n")) | 1712 | (insert (setq section (nth 1 node)) "\n")) |
| 1694 | (insert (make-string level ?\t)) | 1713 | (insert (make-string level ?\t)) |
| 1695 | (insert "*Note " (car nodes) "::\n") | 1714 | (insert "*Note " (car nodes) ": (" curr-file ")" (car nodes) ".\n") |
| 1696 | (Info-insert-toc (nth 2 node) node-list (1+ level)) | 1715 | (Info-insert-toc (nth 2 node) node-list (1+ level) curr-file) |
| 1697 | (setq nodes (cdr nodes)))))) | 1716 | (setq nodes (cdr nodes)))))) |
| 1698 | 1717 | ||
| 1699 | (defun Info-build-toc (file) | 1718 | (defun Info-build-toc (file) |
| @@ -1701,16 +1720,18 @@ If SAME-FILE is non-nil, do not move to a different Info file." | |||
| 1701 | (if (equal file "dir") | 1720 | (if (equal file "dir") |
| 1702 | (error "Table of contents for Info directory is not supported yet")) | 1721 | (error "Table of contents for Info directory is not supported yet")) |
| 1703 | (with-temp-buffer | 1722 | (with-temp-buffer |
| 1704 | (let ((default-directory (or (and (stringp file) | 1723 | (let* ((default-directory (or (and (stringp file) |
| 1705 | (file-name-directory | 1724 | (file-name-directory |
| 1706 | (setq file (Info-find-file file)))) | 1725 | (setq file (Info-find-file file)))) |
| 1707 | default-directory)) | 1726 | default-directory)) |
| 1708 | (sections '(("Top" "Top"))) | 1727 | (main-file file) |
| 1709 | nodes subfiles) | 1728 | (sections '(("Top" "Top"))) |
| 1710 | (while (or file subfiles) | 1729 | nodes subfiles) |
| 1711 | (or file (message "Searching subfile %s..." (car subfiles))) | 1730 | (while (or main-file subfiles) |
| 1731 | (or main-file (message "Searching subfile %s..." (car subfiles))) | ||
| 1712 | (erase-buffer) | 1732 | (erase-buffer) |
| 1713 | (info-insert-file-contents (or file (car subfiles))) | 1733 | (info-insert-file-contents (or main-file (car subfiles))) |
| 1734 | (goto-char (point-min)) | ||
| 1714 | (while (and (search-forward "\n\^_\nFile:" nil 'move) | 1735 | (while (and (search-forward "\n\^_\nFile:" nil 'move) |
| 1715 | (search-forward "Node: " nil 'move)) | 1736 | (search-forward "Node: " nil 'move)) |
| 1716 | (let ((nodename (substring-no-properties (Info-following-node-name))) | 1737 | (let ((nodename (substring-no-properties (Info-following-node-name))) |
| @@ -1718,7 +1739,7 @@ If SAME-FILE is non-nil, do not move to a different Info file." | |||
| 1718 | (point-max)) 2)) | 1739 | (point-max)) 2)) |
| 1719 | (section "Top") | 1740 | (section "Top") |
| 1720 | menu-items) | 1741 | menu-items) |
| 1721 | (when (and (not (string-match "\\<index\\>" nodename)) | 1742 | (when (and (not (Info-index-node nodename file)) |
| 1722 | (re-search-forward "^\\* Menu:" bound t)) | 1743 | (re-search-forward "^\\* Menu:" bound t)) |
| 1723 | (forward-line 1) | 1744 | (forward-line 1) |
| 1724 | (beginning-of-line) | 1745 | (beginning-of-line) |
| @@ -1750,7 +1771,7 @@ If SAME-FILE is non-nil, do not move to a different Info file." | |||
| 1750 | (nreverse menu-items)) | 1771 | (nreverse menu-items)) |
| 1751 | nodes)) | 1772 | nodes)) |
| 1752 | (goto-char bound))) | 1773 | (goto-char bound))) |
| 1753 | (if file | 1774 | (if main-file |
| 1754 | (save-excursion | 1775 | (save-excursion |
| 1755 | (goto-char (point-min)) | 1776 | (goto-char (point-min)) |
| 1756 | (if (search-forward "\n\^_\nIndirect:" nil t) | 1777 | (if (search-forward "\n\^_\nIndirect:" nil t) |
| @@ -1759,7 +1780,7 @@ If SAME-FILE is non-nil, do not move to a different Info file." | |||
| 1759 | (setq subfiles (cons (match-string-no-properties 1) | 1780 | (setq subfiles (cons (match-string-no-properties 1) |
| 1760 | subfiles))))) | 1781 | subfiles))))) |
| 1761 | (setq subfiles (nreverse subfiles) | 1782 | (setq subfiles (nreverse subfiles) |
| 1762 | file nil)) | 1783 | main-file nil)) |
| 1763 | (setq subfiles (cdr subfiles)))) | 1784 | (setq subfiles (cdr subfiles)))) |
| 1764 | (message "") | 1785 | (message "") |
| 1765 | (nreverse nodes)))) | 1786 | (nreverse nodes)))) |
| @@ -1838,8 +1859,7 @@ new buffer." | |||
| 1838 | (if (and (save-excursion | 1859 | (if (and (save-excursion |
| 1839 | (goto-char (+ (point) 5)) ; skip a possible *note | 1860 | (goto-char (+ (point) 5)) ; skip a possible *note |
| 1840 | (re-search-backward "\\*note[ \n\t]+" nil t) | 1861 | (re-search-backward "\\*note[ \n\t]+" nil t) |
| 1841 | (looking-at (concat "\\*note[ \n\t]+" | 1862 | (looking-at str)) |
| 1842 | (Info-following-node-name-re "^.,\t")))) | ||
| 1843 | (<= (point) (match-end 0))) | 1863 | (<= (point) (match-end 0))) |
| 1844 | (goto-char (match-beginning 0)))) | 1864 | (goto-char (match-beginning 0)))) |
| 1845 | ;; Go to the reference closest to point | 1865 | ;; Go to the reference closest to point |
| @@ -1867,11 +1887,27 @@ new buffer." | |||
| 1867 | Because of ambiguities, this should be concatenated with something like | 1887 | Because of ambiguities, this should be concatenated with something like |
| 1868 | `:' and `Info-following-node-name-re'.") | 1888 | `:' and `Info-following-node-name-re'.") |
| 1869 | 1889 | ||
| 1870 | (defun Info-extract-menu-node-name (&optional multi-line) | 1890 | (defun Info-extract-menu-node-name (&optional multi-line index-node) |
| 1871 | (skip-chars-forward " \t\n") | 1891 | (skip-chars-forward " \t\n") |
| 1872 | (when (looking-at (concat Info-menu-entry-name-re ":\\(:\\|" | 1892 | (when (looking-at (concat Info-menu-entry-name-re ":\\(:\\|" |
| 1873 | (Info-following-node-name-re | 1893 | (Info-following-node-name-re |
| 1874 | (if multi-line "^.,\t" "^.,\t\n")) "\\)")) | 1894 | (cond |
| 1895 | (index-node "^,\t\n") | ||
| 1896 | (multi-line "^.,\t") | ||
| 1897 | (t "^.,\t\n"))) | ||
| 1898 | "\\)" | ||
| 1899 | (if index-node | ||
| 1900 | "\\.\\(?:[ \t\n]+(line +\\([0-9]+\\))\\)?" | ||
| 1901 | ""))) | ||
| 1902 | (if index-node | ||
| 1903 | (setq Info-point-loc | ||
| 1904 | (if (match-beginning 5) | ||
| 1905 | (string-to-number (match-string 5)) | ||
| 1906 | (buffer-substring (match-beginning 0) (1- (match-beginning 1))))) | ||
| 1907 | ;;; Comment out the next line to use names of cross-references: | ||
| 1908 | ;;; (setq Info-point-loc | ||
| 1909 | ;;; (buffer-substring (match-beginning 0) (1- (match-beginning 1)))) | ||
| 1910 | ) | ||
| 1875 | (replace-regexp-in-string | 1911 | (replace-regexp-in-string |
| 1876 | "[ \n]+" " " | 1912 | "[ \n]+" " " |
| 1877 | (or (match-string 2) | 1913 | (or (match-string 2) |
| @@ -1886,6 +1922,7 @@ Because of ambiguities, this should be concatenated with something like | |||
| 1886 | 1922 | ||
| 1887 | (defvar Info-complete-menu-buffer) | 1923 | (defvar Info-complete-menu-buffer) |
| 1888 | (defvar Info-complete-next-re nil) | 1924 | (defvar Info-complete-next-re nil) |
| 1925 | (defvar Info-complete-nodes nil) | ||
| 1889 | (defvar Info-complete-cache nil) | 1926 | (defvar Info-complete-cache nil) |
| 1890 | 1927 | ||
| 1891 | (defconst Info-node-spec-re | 1928 | (defconst Info-node-spec-re |
| @@ -1899,6 +1936,9 @@ Because of ambiguities, this should be concatenated with something like | |||
| 1899 | ;; - `Info-complete-next-re' which, if non-nil, indicates that we should | 1936 | ;; - `Info-complete-next-re' which, if non-nil, indicates that we should |
| 1900 | ;; also look for menu items in subsequent nodes as long as those | 1937 | ;; also look for menu items in subsequent nodes as long as those |
| 1901 | ;; nodes' names match `Info-complete-next-re'. This feature is currently | 1938 | ;; nodes' names match `Info-complete-next-re'. This feature is currently |
| 1939 | ;; not used. | ||
| 1940 | ;; - `Info-complete-nodes' which, if non-nil, indicates that we should | ||
| 1941 | ;; also look for menu items in these nodes. This feature is currently | ||
| 1902 | ;; only used for completion in Info-index. | 1942 | ;; only used for completion in Info-index. |
| 1903 | 1943 | ||
| 1904 | ;; Note that `Info-complete-menu-buffer' could be current already, | 1944 | ;; Note that `Info-complete-menu-buffer' could be current already, |
| @@ -1922,6 +1962,7 @@ Because of ambiguities, this should be concatenated with something like | |||
| 1922 | (if (and (equal (nth 0 Info-complete-cache) Info-current-file) | 1962 | (if (and (equal (nth 0 Info-complete-cache) Info-current-file) |
| 1923 | (equal (nth 1 Info-complete-cache) Info-current-node) | 1963 | (equal (nth 1 Info-complete-cache) Info-current-node) |
| 1924 | (equal (nth 2 Info-complete-cache) Info-complete-next-re) | 1964 | (equal (nth 2 Info-complete-cache) Info-complete-next-re) |
| 1965 | (equal (nth 5 Info-complete-cache) Info-complete-nodes) | ||
| 1925 | (let ((prev (nth 3 Info-complete-cache))) | 1966 | (let ((prev (nth 3 Info-complete-cache))) |
| 1926 | (eq t (compare-strings string 0 (length prev) | 1967 | (eq t (compare-strings string 0 (length prev) |
| 1927 | prev 0 nil t)))) | 1968 | prev 0 nil t)))) |
| @@ -1934,9 +1975,12 @@ Because of ambiguities, this should be concatenated with something like | |||
| 1934 | (push (match-string-no-properties 1) | 1975 | (push (match-string-no-properties 1) |
| 1935 | completions)) | 1976 | completions)) |
| 1936 | ;; Check subsequent nodes if applicable. | 1977 | ;; Check subsequent nodes if applicable. |
| 1937 | (and Info-complete-next-re | 1978 | (or (and Info-complete-next-re |
| 1938 | (setq nextnode (Info-extract-pointer "next" t)) | 1979 | (setq nextnode (Info-extract-pointer "next" t)) |
| 1939 | (string-match Info-complete-next-re nextnode))) | 1980 | (string-match Info-complete-next-re nextnode)) |
| 1981 | (and Info-complete-nodes | ||
| 1982 | (setq Info-complete-nodes (cdr Info-complete-nodes) | ||
| 1983 | nextnode (car Info-complete-nodes))))) | ||
| 1940 | (Info-goto-node nextnode)) | 1984 | (Info-goto-node nextnode)) |
| 1941 | ;; Go back to the start node (for the next completion). | 1985 | ;; Go back to the start node (for the next completion). |
| 1942 | (unless (equal Info-current-node orignode) | 1986 | (unless (equal Info-current-node orignode) |
| @@ -1944,7 +1988,8 @@ Because of ambiguities, this should be concatenated with something like | |||
| 1944 | ;; Update the cache. | 1988 | ;; Update the cache. |
| 1945 | (set (make-local-variable 'Info-complete-cache) | 1989 | (set (make-local-variable 'Info-complete-cache) |
| 1946 | (list Info-current-file Info-current-node | 1990 | (list Info-current-file Info-current-node |
| 1947 | Info-complete-next-re string completions))) | 1991 | Info-complete-next-re string completions |
| 1992 | Info-complete-nodes))) | ||
| 1948 | (if action | 1993 | (if action |
| 1949 | (all-completions string completions predicate) | 1994 | (all-completions string completions predicate) |
| 1950 | (try-completion string completions predicate))))))) | 1995 | (try-completion string completions predicate))))))) |
| @@ -2013,7 +2058,7 @@ new buffer." | |||
| 2013 | (error "No such item in menu")) | 2058 | (error "No such item in menu")) |
| 2014 | (beginning-of-line) | 2059 | (beginning-of-line) |
| 2015 | (forward-char 2) | 2060 | (forward-char 2) |
| 2016 | (Info-extract-menu-node-name))))) | 2061 | (Info-extract-menu-node-name nil (Info-index-node)))))) |
| 2017 | 2062 | ||
| 2018 | ;; If COUNT is nil, use the last item in the menu. | 2063 | ;; If COUNT is nil, use the last item in the menu. |
| 2019 | (defun Info-extract-menu-counting (count) | 2064 | (defun Info-extract-menu-counting (count) |
| @@ -2028,7 +2073,7 @@ new buffer." | |||
| 2028 | (error "Too few items in menu")) | 2073 | (error "Too few items in menu")) |
| 2029 | (while (search-forward "\n* " nil t) | 2074 | (while (search-forward "\n* " nil t) |
| 2030 | nil)) | 2075 | nil)) |
| 2031 | (Info-extract-menu-node-name))))) | 2076 | (Info-extract-menu-node-name nil (Info-index-node)))))) |
| 2032 | 2077 | ||
| 2033 | (defun Info-nth-menu-item () | 2078 | (defun Info-nth-menu-item () |
| 2034 | "Go to the node of the Nth menu item. | 2079 | "Go to the node of the Nth menu item. |
| @@ -2055,7 +2100,7 @@ N is the digit argument used to invoke this command." | |||
| 2055 | ;; move forward until we can't go any farther. | 2100 | ;; move forward until we can't go any farther. |
| 2056 | (while (Info-forward-node t t) nil) | 2101 | (while (Info-forward-node t t) nil) |
| 2057 | ;; Then keep moving down to last subnode, unless we reach an index. | 2102 | ;; Then keep moving down to last subnode, unless we reach an index. |
| 2058 | (while (and (not (string-match "\\<index\\>" Info-current-node)) | 2103 | (while (and (not (Info-index-node)) |
| 2059 | (save-excursion (search-forward "\n* Menu:" nil t))) | 2104 | (save-excursion (search-forward "\n* Menu:" nil t))) |
| 2060 | (Info-goto-node (Info-extract-menu-counting nil))))) | 2105 | (Info-goto-node (Info-extract-menu-counting nil))))) |
| 2061 | 2106 | ||
| @@ -2071,7 +2116,7 @@ N is the digit argument used to invoke this command." | |||
| 2071 | ;; 3. next node is up and next | 2116 | ;; 3. next node is up and next |
| 2072 | (cond ((and (not not-down) | 2117 | (cond ((and (not not-down) |
| 2073 | (save-excursion (search-forward "\n* menu:" nil t)) | 2118 | (save-excursion (search-forward "\n* menu:" nil t)) |
| 2074 | (not (string-match "\\<index\\>" Info-current-node))) | 2119 | (not (Info-index-node))) |
| 2075 | (Info-goto-node (Info-extract-menu-counting 1)) | 2120 | (Info-goto-node (Info-extract-menu-counting 1)) |
| 2076 | t) | 2121 | t) |
| 2077 | ((save-excursion (search-backward "next:" nil t)) | 2122 | ((save-excursion (search-backward "next:" nil t)) |
| @@ -2109,7 +2154,7 @@ N is the digit argument used to invoke this command." | |||
| 2109 | ;; go down to find the last subnode*. | 2154 | ;; go down to find the last subnode*. |
| 2110 | (Info-prev) | 2155 | (Info-prev) |
| 2111 | (let (Info-history) | 2156 | (let (Info-history) |
| 2112 | (while (and (not (string-match "\\<index\\>" Info-current-node)) | 2157 | (while (and (not (Info-index-node)) |
| 2113 | (save-excursion (search-forward "\n* Menu:" nil t))) | 2158 | (save-excursion (search-forward "\n* Menu:" nil t))) |
| 2114 | (Info-goto-node (Info-extract-menu-counting nil))))) | 2159 | (Info-goto-node (Info-extract-menu-counting nil))))) |
| 2115 | (t | 2160 | (t |
| @@ -2300,32 +2345,124 @@ parent node." | |||
| 2300 | (if recur | 2345 | (if recur |
| 2301 | (error "No cross references in this node") | 2346 | (error "No cross references in this node") |
| 2302 | (Info-prev-reference t))))) | 2347 | (Info-prev-reference t))))) |
| 2348 | |||
| 2349 | (defvar Info-index-nodes nil | ||
| 2350 | "Alist of cached index node names of visited Info files. | ||
| 2351 | Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).") | ||
| 2352 | |||
| 2353 | (defun Info-index-nodes (&optional file) | ||
| 2354 | "Return a list of names of all index nodes in Info FILE. | ||
| 2355 | If FILE is omitted, it defaults to the current Info file. | ||
| 2356 | First look in a list of cached index node names. Then scan Info | ||
| 2357 | file and its subfiles for nodes with the index cookie. Then try | ||
| 2358 | to find index nodes starting from the first node in the top level | ||
| 2359 | menu whose name contains the word \"Index\", plus any immediately | ||
| 2360 | following nodes whose names also contain the word \"Index\"." | ||
| 2361 | (or file (setq file Info-current-file)) | ||
| 2362 | (or (assoc file Info-index-nodes) | ||
| 2363 | ;; Skip virtual Info files | ||
| 2364 | (and (member file '("dir" "history" "toc" "apropos")) | ||
| 2365 | (setq Info-index-nodes (cons (cons file nil) Info-index-nodes))) | ||
| 2366 | (not (stringp file)) | ||
| 2367 | ;; Find nodes with index cookie | ||
| 2368 | (let* ((default-directory (or (and (stringp file) | ||
| 2369 | (file-name-directory | ||
| 2370 | (setq file (Info-find-file file)))) | ||
| 2371 | default-directory)) | ||
| 2372 | Info-history Info-history-list Info-fontify-maximum-menu-size | ||
| 2373 | (main-file file) subfiles nodes node) | ||
| 2374 | (condition-case nil | ||
| 2375 | (with-temp-buffer | ||
| 2376 | (while (or main-file subfiles) | ||
| 2377 | (erase-buffer) | ||
| 2378 | (info-insert-file-contents (or main-file (car subfiles))) | ||
| 2379 | (goto-char (point-min)) | ||
| 2380 | (while (search-forward "\0\b[index\0\b]" nil 'move) | ||
| 2381 | (save-excursion | ||
| 2382 | (re-search-backward "^\^_") | ||
| 2383 | (search-forward "Node: ") | ||
| 2384 | (setq nodes (cons (Info-following-node-name) nodes)))) | ||
| 2385 | (if main-file | ||
| 2386 | (save-excursion | ||
| 2387 | (goto-char (point-min)) | ||
| 2388 | (if (search-forward "\n\^_\nIndirect:" nil t) | ||
| 2389 | (let ((bound (save-excursion (search-forward "\n\^_" nil t)))) | ||
| 2390 | (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t) | ||
| 2391 | (setq subfiles (cons (match-string-no-properties 1) | ||
| 2392 | subfiles))))) | ||
| 2393 | (setq subfiles (nreverse subfiles) | ||
| 2394 | main-file nil)) | ||
| 2395 | (setq subfiles (cdr subfiles))))) | ||
| 2396 | (error nil)) | ||
| 2397 | (if nodes | ||
| 2398 | (setq nodes (nreverse nodes) | ||
| 2399 | Info-index-nodes (cons (cons file nodes) Info-index-nodes))) | ||
| 2400 | nodes) | ||
| 2401 | ;; Find nodes with the word "Index" in the node name | ||
| 2402 | (let ((case-fold-search t) | ||
| 2403 | Info-history Info-history-list Info-fontify-maximum-menu-size | ||
| 2404 | nodes node) | ||
| 2405 | (condition-case nil | ||
| 2406 | (with-temp-buffer | ||
| 2407 | (Info-mode) | ||
| 2408 | (Info-find-node file "Top") | ||
| 2409 | (when (and (search-forward "\n* menu:" nil t) | ||
| 2410 | (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)) | ||
| 2411 | (goto-char (match-beginning 1)) | ||
| 2412 | (setq nodes (list (Info-extract-menu-node-name))) | ||
| 2413 | (Info-goto-node (car nodes)) | ||
| 2414 | (while (and (setq node (Info-extract-pointer "next" t)) | ||
| 2415 | (string-match "\\<Index\\>" node)) | ||
| 2416 | (setq nodes (cons node nodes)) | ||
| 2417 | (Info-goto-node node)))) | ||
| 2418 | (error nil)) | ||
| 2419 | (if nodes | ||
| 2420 | (setq nodes (nreverse nodes) | ||
| 2421 | Info-index-nodes (cons (cons file nodes) Info-index-nodes))) | ||
| 2422 | nodes) | ||
| 2423 | ;; If file has no index nodes, still add it to the cache | ||
| 2424 | (setq Info-index-nodes (cons (cons file nil) Info-index-nodes))) | ||
| 2425 | (cdr (assoc file Info-index-nodes))) | ||
| 2426 | |||
| 2427 | (defun Info-index-node (&optional node file) | ||
| 2428 | "Return non-nil value if NODE is an index node. | ||
| 2429 | If NODE is nil, check the current Info node. | ||
| 2430 | If FILE is nil, check the current Info file." | ||
| 2431 | (if (or (and node (not (equal node Info-current-node))) | ||
| 2432 | (assoc (or file Info-current-file) Info-index-nodes)) | ||
| 2433 | (member (or node Info-current-node) (Info-index-nodes file)) | ||
| 2434 | ;; Don't search all index nodes if request is only for the current node | ||
| 2435 | ;; and file is not in the cache of index nodes | ||
| 2436 | (or | ||
| 2437 | (save-match-data | ||
| 2438 | (string-match "\\<Index\\>" (or node Info-current-node ""))) | ||
| 2439 | (save-excursion | ||
| 2440 | (goto-char (+ (or (save-excursion | ||
| 2441 | (search-backward "\n\^_" nil t)) | ||
| 2442 | (point-min)) 2)) | ||
| 2443 | (search-forward "\0\b[index\0\b]" | ||
| 2444 | (or (save-excursion | ||
| 2445 | (search-forward "\n\^_" nil t)) | ||
| 2446 | (point-max)) t))))) | ||
| 2303 | 2447 | ||
| 2304 | (defun Info-goto-index () | 2448 | (defun Info-goto-index () |
| 2305 | (Info-goto-node "Top") | 2449 | "Go to the first index node." |
| 2306 | (or (search-forward "\n* menu:" nil t) | 2450 | (let ((node (car (Info-index-nodes)))) |
| 2307 | (error "No index")) | 2451 | (or node (error "No index")) |
| 2308 | (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t) | 2452 | (Info-goto-node node))) |
| 2309 | (error "No index")) | ||
| 2310 | (goto-char (match-beginning 1)) | ||
| 2311 | ;; Protect Info-history so that the current node (Top) is not added to it. | ||
| 2312 | (let ((Info-history nil)) | ||
| 2313 | (Info-goto-node (Info-extract-menu-node-name)))) | ||
| 2314 | 2453 | ||
| 2315 | ;;;###autoload | 2454 | ;;;###autoload |
| 2316 | (defun Info-index (topic) | 2455 | (defun Info-index (topic) |
| 2317 | "Look up a string TOPIC in the index for this file. | 2456 | "Look up a string TOPIC in the index for this file. |
| 2318 | The index is defined as the first node in the top level menu whose | ||
| 2319 | name contains the word \"Index\", plus any immediately following | ||
| 2320 | nodes whose names also contain the word \"Index\". | ||
| 2321 | If there are no exact matches to the specified topic, this chooses | 2457 | If there are no exact matches to the specified topic, this chooses |
| 2322 | the first match which is a case-insensitive substring of a topic. | 2458 | the first match which is a case-insensitive substring of a topic. |
| 2323 | Use the `,' command to see the other matches. | 2459 | Use the \\<Info-mode-map>\\[Info-index-next] command to see the other matches. |
| 2324 | Give a blank topic name to go to the Index node itself." | 2460 | Give a blank topic name to go to the Index node itself." |
| 2325 | (interactive | 2461 | (interactive |
| 2326 | (list | 2462 | (list |
| 2327 | (let ((Info-complete-menu-buffer (clone-buffer)) | 2463 | (let ((Info-complete-menu-buffer (clone-buffer)) |
| 2328 | (Info-complete-next-re "\\<Index\\>")) | 2464 | (Info-complete-nodes (Info-index-nodes)) |
| 2465 | (Info-history-list nil)) | ||
| 2329 | (if (equal Info-current-file "dir") | 2466 | (if (equal Info-current-file "dir") |
| 2330 | (error "The Info directory node has no index; use m to select a manual")) | 2467 | (error "The Info directory node has no index; use m to select a manual")) |
| 2331 | (unwind-protect | 2468 | (unwind-protect |
| @@ -2336,9 +2473,10 @@ Give a blank topic name to go to the Index node itself." | |||
| 2336 | (if (equal Info-current-file "dir") | 2473 | (if (equal Info-current-file "dir") |
| 2337 | (error "The Info directory node has no index; use m to select a manual")) | 2474 | (error "The Info directory node has no index; use m to select a manual")) |
| 2338 | (let ((orignode Info-current-node) | 2475 | (let ((orignode Info-current-node) |
| 2339 | (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)" | 2476 | (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" |
| 2340 | (regexp-quote topic))) | 2477 | (regexp-quote topic))) |
| 2341 | node | 2478 | node (nodes (Info-index-nodes)) |
| 2479 | (ohist-list Info-history-list) | ||
| 2342 | (case-fold-search t)) | 2480 | (case-fold-search t)) |
| 2343 | (Info-goto-index) | 2481 | (Info-goto-index) |
| 2344 | (or (equal topic "") | 2482 | (or (equal topic "") |
| @@ -2360,8 +2498,7 @@ Give a blank topic name to go to the Index node itself." | |||
| 2360 | (string-to-number (concat "0" | 2498 | (string-to-number (concat "0" |
| 2361 | (match-string 3)))) | 2499 | (match-string 3)))) |
| 2362 | matches)) | 2500 | matches)) |
| 2363 | (and (setq node (Info-extract-pointer "next" t)) | 2501 | (setq nodes (cdr nodes) node (car nodes))) |
| 2364 | (string-match "\\<Index\\>" node))) | ||
| 2365 | (Info-goto-node node)) | 2502 | (Info-goto-node node)) |
| 2366 | (or matches | 2503 | (or matches |
| 2367 | (progn | 2504 | (progn |
| @@ -2371,11 +2508,12 @@ Give a blank topic name to go to the Index node itself." | |||
| 2371 | (while (setq found (assoc topic matches)) | 2508 | (while (setq found (assoc topic matches)) |
| 2372 | (setq exact (cons found exact) | 2509 | (setq exact (cons found exact) |
| 2373 | matches (delq found matches))) | 2510 | matches (delq found matches))) |
| 2511 | (setq Info-history-list ohist-list) | ||
| 2374 | (setq Info-index-alternatives (nconc exact (nreverse matches))) | 2512 | (setq Info-index-alternatives (nconc exact (nreverse matches))) |
| 2375 | (Info-index-next 0))))) | 2513 | (Info-index-next 0))))) |
| 2376 | 2514 | ||
| 2377 | (defun Info-index-next (num) | 2515 | (defun Info-index-next (num) |
| 2378 | "Go to the next matching index item from the last `i' command." | 2516 | "Go to the next matching index item from the last \\<Info-mode-map>\\[Info-index] command." |
| 2379 | (interactive "p") | 2517 | (interactive "p") |
| 2380 | (or Info-index-alternatives | 2518 | (or Info-index-alternatives |
| 2381 | (error "No previous `i' command")) | 2519 | (error "No previous `i' command")) |
| @@ -2388,7 +2526,7 @@ Give a blank topic name to go to the Index node itself." | |||
| 2388 | num (1- num))) | 2526 | num (1- num))) |
| 2389 | (Info-goto-node (nth 1 (car Info-index-alternatives))) | 2527 | (Info-goto-node (nth 1 (car Info-index-alternatives))) |
| 2390 | (if (> (nth 3 (car Info-index-alternatives)) 0) | 2528 | (if (> (nth 3 (car Info-index-alternatives)) 0) |
| 2391 | (forward-line (nth 3 (car Info-index-alternatives))) | 2529 | (forward-line (1- (nth 3 (car Info-index-alternatives)))) |
| 2392 | (forward-line 3) ; don't search in headers | 2530 | (forward-line 3) ; don't search in headers |
| 2393 | (let ((name (car (car Info-index-alternatives)))) | 2531 | (let ((name (car (car Info-index-alternatives)))) |
| 2394 | (Info-find-index-name name))) | 2532 | (Info-find-index-name name))) |
| @@ -2427,16 +2565,14 @@ Give a blank topic name to go to the Index node itself." | |||
| 2427 | Build a menu of the possible matches." | 2565 | Build a menu of the possible matches." |
| 2428 | (interactive "sIndex apropos: ") | 2566 | (interactive "sIndex apropos: ") |
| 2429 | (unless (string= string "") | 2567 | (unless (string= string "") |
| 2430 | (let ((pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^.]+\\)." | 2568 | (let ((pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^\n]+\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" |
| 2431 | (regexp-quote string))) | 2569 | (regexp-quote string))) |
| 2432 | (ohist Info-history) | 2570 | (ohist Info-history) |
| 2433 | (ohist-list Info-history-list) | 2571 | (ohist-list Info-history-list) |
| 2434 | (current-node Info-current-node) | 2572 | (current-node Info-current-node) |
| 2435 | (current-file Info-current-file) | 2573 | (current-file Info-current-file) |
| 2436 | manuals matches temp-file node) | 2574 | manuals matches node nodes) |
| 2437 | (let ((Info-fontify-maximum-menu-size 0) | 2575 | (let ((Info-fontify-maximum-menu-size nil)) |
| 2438 | Info-use-header-lines | ||
| 2439 | Info-hide-note-references) | ||
| 2440 | (Info-directory) | 2576 | (Info-directory) |
| 2441 | (message "Searching indices...") | 2577 | (message "Searching indices...") |
| 2442 | (goto-char (point-min)) | 2578 | (goto-char (point-min)) |
| @@ -2445,24 +2581,22 @@ Build a menu of the possible matches." | |||
| 2445 | (add-to-list 'manuals (match-string 1))) | 2581 | (add-to-list 'manuals (match-string 1))) |
| 2446 | (dolist (manual manuals) | 2582 | (dolist (manual manuals) |
| 2447 | (message "Searching %s" manual) | 2583 | (message "Searching %s" manual) |
| 2448 | (condition-case nil | 2584 | (if (setq nodes (Info-index-nodes (Info-find-file manual))) |
| 2449 | (save-excursion | 2585 | (condition-case nil |
| 2450 | (Info-find-node manual "Top") | 2586 | (save-excursion |
| 2451 | (when (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t) | 2587 | (Info-find-node manual (car nodes)) |
| 2452 | (goto-char (match-beginning 1)) | 2588 | (while |
| 2453 | (Info-goto-node (Info-extract-menu-node-name)) | 2589 | (progn |
| 2454 | (while | 2590 | (goto-char (point-min)) |
| 2455 | (progn | 2591 | (while (re-search-forward pattern nil t) |
| 2456 | (goto-char (point-min)) | 2592 | (add-to-list 'matches |
| 2457 | (while (re-search-forward pattern nil t) | 2593 | (list manual |
| 2458 | (add-to-list 'matches | 2594 | (match-string-no-properties 1) |
| 2459 | (list (match-string 1) | 2595 | (match-string-no-properties 2) |
| 2460 | (match-string 2) | 2596 | (match-string-no-properties 3)))) |
| 2461 | manual))) | 2597 | (setq nodes (cdr nodes) node (car nodes))) |
| 2462 | (and (setq node (Info-extract-pointer "next" t)) | 2598 | (Info-goto-node node))) |
| 2463 | (string-match "\\<Index\\>" node))) | 2599 | (error nil))))) |
| 2464 | (Info-goto-node node)))) | ||
| 2465 | (error nil)))) | ||
| 2466 | (Info-goto-node (concat "(" current-file ")" current-node)) | 2600 | (Info-goto-node (concat "(" current-file ")" current-node)) |
| 2467 | (setq Info-history ohist | 2601 | (setq Info-history ohist |
| 2468 | Info-history-list ohist-list) | 2602 | Info-history-list ohist-list) |
| @@ -2471,12 +2605,19 @@ Build a menu of the possible matches." | |||
| 2471 | (message "No matches found") | 2605 | (message "No matches found") |
| 2472 | (with-current-buffer (get-buffer-create " *info-apropos*") | 2606 | (with-current-buffer (get-buffer-create " *info-apropos*") |
| 2473 | (erase-buffer) | 2607 | (erase-buffer) |
| 2474 | (insert "\n\nFile: apropos, Node: Top, Up: (dir)\n") | 2608 | (insert "\n\^_\nFile: apropos, Node: Index, Up: (dir)\n") |
| 2475 | (insert "* Menu: \nNodes whose indices contain \"" string "\"\n\n") | 2609 | (insert "* Menu: \nNodes whose indices contain \"" string "\"\n\n") |
| 2476 | (dolist (entry matches) | 2610 | (dolist (entry matches) |
| 2477 | (insert "* " (car entry) " [" (nth 2 entry) | 2611 | (insert |
| 2478 | "]: (" (nth 2 entry) ")" (nth 1 entry) ".\n"))) | 2612 | (format "* %-38s (%s)%s.%s\n" |
| 2479 | (Info-find-node "apropos" "top"))))) | 2613 | (concat (nth 1 entry) " [" (nth 0 entry) "]:") |
| 2614 | (nth 0 entry) | ||
| 2615 | (nth 2 entry) | ||
| 2616 | (if (nth 3 entry) | ||
| 2617 | (concat " (line " (nth 3 entry) ")") | ||
| 2618 | ""))))) | ||
| 2619 | (Info-find-node "apropos" "Index") | ||
| 2620 | (setq Info-complete-cache nil))))) | ||
| 2480 | 2621 | ||
| 2481 | (defun Info-undefined () | 2622 | (defun Info-undefined () |
| 2482 | "Make command be undefined in Info." | 2623 | "Make command be undefined in Info." |
| @@ -2592,21 +2733,15 @@ if point is in a menu item description, follow that menu item." | |||
| 2592 | (browse-url (browse-url-url-at-point))) | 2733 | (browse-url (browse-url-url-at-point))) |
| 2593 | ((setq node (Info-get-token (point) "\\*note[ \n\t]+" | 2734 | ((setq node (Info-get-token (point) "\\*note[ \n\t]+" |
| 2594 | "\\*note[ \n\t]+\\([^:]*\\):\\(:\\|[ \n\t]*(\\)?")) | 2735 | "\\*note[ \n\t]+\\([^:]*\\):\\(:\\|[ \n\t]*(\\)?")) |
| 2595 | ;;; (or (match-string 2) | ||
| 2596 | ;;; (setq Info-reference-name | ||
| 2597 | ;;; (replace-regexp-in-string | ||
| 2598 | ;;; "[ \n\t]+" " " (match-string-no-properties 1)))) | ||
| 2599 | (Info-follow-reference node fork)) | 2736 | (Info-follow-reference node fork)) |
| 2600 | ;; menu item: node name | 2737 | ;; menu item: node name |
| 2601 | ((setq node (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\)::")) | 2738 | ((setq node (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\)::")) |
| 2602 | (Info-goto-node node fork)) | 2739 | (Info-goto-node node fork)) |
| 2603 | ;; menu item: index entry | 2740 | ;; menu item: node name or index entry |
| 2604 | ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ") | 2741 | ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ") |
| 2605 | (if (save-match-data (string-match "\\<index\\>" Info-current-node)) | ||
| 2606 | (setq Info-reference-name (match-string-no-properties 1))) | ||
| 2607 | (beginning-of-line) | 2742 | (beginning-of-line) |
| 2608 | (forward-char 2) | 2743 | (forward-char 2) |
| 2609 | (setq node (Info-extract-menu-node-name)) | 2744 | (setq node (Info-extract-menu-node-name nil (Info-index-node))) |
| 2610 | (Info-goto-node node fork)) | 2745 | (Info-goto-node node fork)) |
| 2611 | ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)")) | 2746 | ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)")) |
| 2612 | (Info-goto-node node fork)) | 2747 | (Info-goto-node node fork)) |
| @@ -2654,16 +2789,21 @@ if point is in a menu item description, follow that menu item." | |||
| 2654 | (define-key Info-mode-map "h" 'Info-help) | 2789 | (define-key Info-mode-map "h" 'Info-help) |
| 2655 | (define-key Info-mode-map "i" 'Info-index) | 2790 | (define-key Info-mode-map "i" 'Info-index) |
| 2656 | (define-key Info-mode-map "l" 'Info-last) | 2791 | (define-key Info-mode-map "l" 'Info-last) |
| 2792 | (define-key Info-mode-map "L" 'Info-history) | ||
| 2657 | (define-key Info-mode-map "m" 'Info-menu) | 2793 | (define-key Info-mode-map "m" 'Info-menu) |
| 2658 | (define-key Info-mode-map "n" 'Info-next) | 2794 | (define-key Info-mode-map "n" 'Info-next) |
| 2659 | (define-key Info-mode-map "p" 'Info-prev) | 2795 | (define-key Info-mode-map "p" 'Info-prev) |
| 2660 | (define-key Info-mode-map "q" 'Info-exit) | 2796 | (define-key Info-mode-map "q" 'Info-exit) |
| 2661 | (define-key Info-mode-map "s" 'Info-search) | 2797 | (define-key Info-mode-map "s" 'Info-search) |
| 2798 | (define-key Info-mode-map "S" 'Info-search-case-sensitively) | ||
| 2662 | ;; For consistency with Rmail. | 2799 | ;; For consistency with Rmail. |
| 2663 | (define-key Info-mode-map "\M-s" 'Info-search) | 2800 | (define-key Info-mode-map "\M-s" 'Info-search) |
| 2664 | (define-key Info-mode-map "\M-n" 'clone-buffer) | 2801 | (define-key Info-mode-map "\M-n" 'clone-buffer) |
| 2665 | (define-key Info-mode-map "t" 'Info-top-node) | 2802 | (define-key Info-mode-map "t" 'Info-top-node) |
| 2803 | (define-key Info-mode-map "T" 'Info-toc) | ||
| 2666 | (define-key Info-mode-map "u" 'Info-up) | 2804 | (define-key Info-mode-map "u" 'Info-up) |
| 2805 | ;; For consistency with dired-copy-filename-as-kill. | ||
| 2806 | (define-key Info-mode-map "w" 'Info-copy-current-node-name) | ||
| 2667 | (define-key Info-mode-map "," 'Info-index-next) | 2807 | (define-key Info-mode-map "," 'Info-index-next) |
| 2668 | (define-key Info-mode-map "\177" 'Info-scroll-down) | 2808 | (define-key Info-mode-map "\177" 'Info-scroll-down) |
| 2669 | (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node) | 2809 | (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node) |
| @@ -2708,9 +2848,9 @@ if point is in a menu item description, follow that menu item." | |||
| 2708 | ["Last" Info-last :active Info-history | 2848 | ["Last" Info-last :active Info-history |
| 2709 | :help "Go to the last node you were at"] | 2849 | :help "Go to the last node you were at"] |
| 2710 | ["History" Info-history :active Info-history-list | 2850 | ["History" Info-history :active Info-history-list |
| 2711 | :help "Go to the history buffer"] | 2851 | :help "Go to menu of visited nodes"] |
| 2712 | ["Table of Contents" Info-toc | 2852 | ["Table of Contents" Info-toc |
| 2713 | :help "Go to the buffer with a table of contents"] | 2853 | :help "Go to table of contents"] |
| 2714 | ("Index..." | 2854 | ("Index..." |
| 2715 | ["Lookup a String" Info-index | 2855 | ["Lookup a String" Info-index |
| 2716 | :help "Look for a string in the index items"] | 2856 | :help "Look for a string in the index items"] |
| @@ -2808,20 +2948,23 @@ if point is in a menu item description, follow that menu item." | |||
| 2808 | (error (ding)))) | 2948 | (error (ding)))) |
| 2809 | 2949 | ||
| 2810 | 2950 | ||
| 2811 | (defun Info-copy-current-node-name () | 2951 | (defun Info-copy-current-node-name (&optional arg) |
| 2812 | "Put the name of the current info node into the kill ring. | 2952 | "Put the name of the current info node into the kill ring. |
| 2813 | The name of the info file is prepended to the node name in parentheses." | 2953 | The name of the info file is prepended to the node name in parentheses. |
| 2814 | (interactive) | 2954 | With a zero prefix arg, put the name inside a function call to `info'." |
| 2955 | (interactive "P") | ||
| 2815 | (unless Info-current-node | 2956 | (unless Info-current-node |
| 2816 | (error "No current info node")) | 2957 | (error "No current info node")) |
| 2817 | (kill-new | 2958 | (let ((node (concat "(" (file-name-nondirectory |
| 2818 | (concat "(" | 2959 | (or (and (stringp Info-current-file) |
| 2819 | (file-name-nondirectory | 2960 | Info-current-file) |
| 2820 | (if (stringp Info-current-file) | 2961 | buffer-file-name |
| 2821 | Info-current-file | 2962 | "")) |
| 2822 | (or buffer-file-name ""))) | 2963 | ")" Info-current-node))) |
| 2823 | ")" | 2964 | (if (zerop (prefix-numeric-value arg)) |
| 2824 | Info-current-node))) | 2965 | (setq node (concat "(info \"" node "\")"))) |
| 2966 | (kill-new node) | ||
| 2967 | (message "%s" node))) | ||
| 2825 | 2968 | ||
| 2826 | 2969 | ||
| 2827 | ;; Info mode is suitable only for specially formatted data. | 2970 | ;; Info mode is suitable only for specially formatted data. |
| @@ -2852,14 +2995,15 @@ Selecting other nodes: | |||
| 2852 | \\[Info-directory] Go to the Info directory node. | 2995 | \\[Info-directory] Go to the Info directory node. |
| 2853 | \\[Info-follow-reference] Follow a cross reference. Reads name of reference. | 2996 | \\[Info-follow-reference] Follow a cross reference. Reads name of reference. |
| 2854 | \\[Info-last] Move to the last node you were at. | 2997 | \\[Info-last] Move to the last node you were at. |
| 2855 | \\[Info-history] Go to the history buffer. | 2998 | \\[Info-history] Go to menu of visited nodes. |
| 2856 | \\[Info-toc] Go to the buffer with a table of contents. | 2999 | \\[Info-toc] Go to table of contents of the current Info file. |
| 2857 | \\[Info-index] Look up a topic in this file's Index and move to that node. | ||
| 2858 | \\[Info-index-next] (comma) Move to the next match from a previous `i' command. | ||
| 2859 | \\[Info-top-node] Go to the Top node of this file. | 3000 | \\[Info-top-node] Go to the Top node of this file. |
| 2860 | \\[Info-final-node] Go to the final node in this file. | 3001 | \\[Info-final-node] Go to the final node in this file. |
| 2861 | \\[Info-backward-node] Go backward one node, considering all nodes as forming one sequence. | 3002 | \\[Info-backward-node] Go backward one node, considering all nodes as forming one sequence. |
| 2862 | \\[Info-forward-node] Go forward one node, considering all nodes as forming one sequence. | 3003 | \\[Info-forward-node] Go forward one node, considering all nodes as forming one sequence. |
| 3004 | \\[Info-index] Look up a topic in this file's Index and move to that node. | ||
| 3005 | \\[Info-index-next] (comma) Move to the next match from a previous \\<Info-mode-map>\\[Info-index] command. | ||
| 3006 | \\[info-apropos] Look for a string in the indices of all manuals. | ||
| 2863 | 3007 | ||
| 2864 | Moving within a node: | 3008 | Moving within a node: |
| 2865 | \\[Info-scroll-up] Normally, scroll forward a full screen. | 3009 | \\[Info-scroll-up] Normally, scroll forward a full screen. |
| @@ -2876,17 +3020,17 @@ Advanced commands: | |||
| 2876 | \\[Info-copy-current-node-name] Put name of current info node in the kill ring. | 3020 | \\[Info-copy-current-node-name] Put name of current info node in the kill ring. |
| 2877 | \\[clone-buffer] Select a new cloned Info buffer in another window. | 3021 | \\[clone-buffer] Select a new cloned Info buffer in another window. |
| 2878 | \\[Info-edit] Edit contents of selected node. | 3022 | \\[Info-edit] Edit contents of selected node. |
| 2879 | 1 Pick first item in node's menu. | 3023 | 1 .. 9 Pick first ... ninth item in node's menu. |
| 2880 | 2, 3, 4, 5 Pick second ... fifth item in node's menu. | 3024 | Every third `*' is highlighted to help pick the right number. |
| 2881 | \\[Info-goto-node] Move to node specified by name. | 3025 | \\[Info-goto-node] Move to node specified by name. |
| 2882 | You may include a filename as well, as (FILENAME)NODENAME. | 3026 | You may include a filename as well, as (FILENAME)NODENAME. |
| 2883 | \\[universal-argument] \\[info] Move to new Info file with completion. | 3027 | \\[universal-argument] \\[info] Move to new Info file with completion. |
| 3028 | \\[universal-argument] N \\[info] Select Info buffer with prefix number in the name *info*<N>. | ||
| 2884 | \\[Info-search] Search through this Info file for specified regexp, | 3029 | \\[Info-search] Search through this Info file for specified regexp, |
| 2885 | and select the node in which the next occurrence is found. | 3030 | and select the node in which the next occurrence is found. |
| 2886 | \\[Info-search-case-sensitively] Search through this Info file | 3031 | \\[Info-search-case-sensitively] Search through this Info file for specified regexp case-sensitively. |
| 2887 | for specified regexp case-sensitively. | ||
| 2888 | \\[Info-search-next] Search for another occurrence of regexp | 3032 | \\[Info-search-next] Search for another occurrence of regexp |
| 2889 | from a previous `Info-search' command. | 3033 | from a previous \\<Info-mode-map>\\[Info-search] command. |
| 2890 | \\[Info-next-reference] Move cursor to next cross-reference or menu item. | 3034 | \\[Info-next-reference] Move cursor to next cross-reference or menu item. |
| 2891 | \\[Info-prev-reference] Move cursor to previous cross-reference or menu item." | 3035 | \\[Info-prev-reference] Move cursor to previous cross-reference or menu item." |
| 2892 | (kill-all-local-variables) | 3036 | (kill-all-local-variables) |
| @@ -2916,6 +3060,8 @@ Advanced commands: | |||
| 2916 | ;; This is for the sake of the invisible text we use handling titles. | 3060 | ;; This is for the sake of the invisible text we use handling titles. |
| 2917 | (make-local-variable 'line-move-ignore-invisible) | 3061 | (make-local-variable 'line-move-ignore-invisible) |
| 2918 | (setq line-move-ignore-invisible t) | 3062 | (setq line-move-ignore-invisible t) |
| 3063 | (make-local-variable 'desktop-save-buffer) | ||
| 3064 | (setq desktop-save-buffer 'Info-desktop-buffer-misc-data) | ||
| 2919 | (add-hook 'clone-buffer-hook 'Info-clone-buffer-hook nil t) | 3065 | (add-hook 'clone-buffer-hook 'Info-clone-buffer-hook nil t) |
| 2920 | (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) | 3066 | (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) |
| 2921 | (Info-set-mode-line) | 3067 | (Info-set-mode-line) |
| @@ -3045,8 +3191,9 @@ The locations are of the format used in `Info-history', i.e. | |||
| 3045 | ;; Bind Info-history to nil, to prevent the index nodes from | 3191 | ;; Bind Info-history to nil, to prevent the index nodes from |
| 3046 | ;; getting into the node history. | 3192 | ;; getting into the node history. |
| 3047 | (let ((Info-history nil) | 3193 | (let ((Info-history nil) |
| 3048 | node) | 3194 | (Info-history-list nil) |
| 3049 | (Info-goto-node (Info-extract-menu-node-name)) | 3195 | node (nodes (Info-index-nodes))) |
| 3196 | (Info-goto-node (car nodes)) | ||
| 3050 | (while | 3197 | (while |
| 3051 | (progn | 3198 | (progn |
| 3052 | (goto-char (point-min)) | 3199 | (goto-char (point-min)) |
| @@ -3056,8 +3203,7 @@ The locations are of the format used in `Info-history', i.e. | |||
| 3056 | (match-string-no-properties 2) | 3203 | (match-string-no-properties 2) |
| 3057 | 0) | 3204 | 0) |
| 3058 | where))) | 3205 | where))) |
| 3059 | (and (setq node (Info-extract-pointer "next" t)) | 3206 | (and (setq nodes (cdr nodes) node (car nodes)))) |
| 3060 | (string-match "\\<Index\\>" node))) | ||
| 3061 | (Info-goto-node node))) | 3207 | (Info-goto-node node))) |
| 3062 | where)) | 3208 | where)) |
| 3063 | 3209 | ||
| @@ -3080,13 +3226,11 @@ COMMAND must be a symbol or string." | |||
| 3080 | ;; Get Info running, and pop to it in another window. | 3226 | ;; Get Info running, and pop to it in another window. |
| 3081 | (save-window-excursion | 3227 | (save-window-excursion |
| 3082 | (info)) | 3228 | (info)) |
| 3083 | ;; FIXME It would be cool if this could use a buffer other | 3229 | (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) |
| 3084 | ;; than *info*. | ||
| 3085 | (pop-to-buffer "*info*") | ||
| 3086 | ;; Bind Info-history to nil, to prevent the last Index node | 3230 | ;; Bind Info-history to nil, to prevent the last Index node |
| 3087 | ;; visited by Info-find-emacs-command-nodes from being | 3231 | ;; visited by Info-find-emacs-command-nodes from being |
| 3088 | ;; pushed onto the history. | 3232 | ;; pushed onto the history. |
| 3089 | (let ((Info-history nil)) | 3233 | (let ((Info-history nil) (Info-history-list nil)) |
| 3090 | (Info-find-node (car (car where)) | 3234 | (Info-find-node (car (car where)) |
| 3091 | (car (cdr (car where))))) | 3235 | (car (cdr (car where))))) |
| 3092 | (if (> num-matches 1) | 3236 | (if (> num-matches 1) |
| @@ -3122,26 +3266,26 @@ the variable `Info-file-list-for-emacs'." | |||
| 3122 | (Info-goto-emacs-command-node command))))) | 3266 | (Info-goto-emacs-command-node command))))) |
| 3123 | 3267 | ||
| 3124 | (defface Info-title-1-face | 3268 | (defface Info-title-1-face |
| 3125 | '((((type tty pc) (class color)) (:foreground "yellow" :weight bold)) | 3269 | '((((type tty pc) (class color)) :foreground "yellow" :weight bold) |
| 3126 | (t (:height 1.2 :inherit Info-title-2-face))) | 3270 | (t :height 1.2 :inherit Info-title-2-face)) |
| 3127 | "Face for Info titles at level 1." | 3271 | "Face for Info titles at level 1." |
| 3128 | :group 'info) | 3272 | :group 'info) |
| 3129 | 3273 | ||
| 3130 | (defface Info-title-2-face | 3274 | (defface Info-title-2-face |
| 3131 | '((((type tty pc) (class color)) (:foreground "lightblue" :weight bold)) | 3275 | '((((type tty pc) (class color)) :foreground "lightblue" :weight bold) |
| 3132 | (t (:height 1.2 :inherit Info-title-3-face))) | 3276 | (t :height 1.2 :inherit Info-title-3-face)) |
| 3133 | "Face for Info titles at level 2." | 3277 | "Face for Info titles at level 2." |
| 3134 | :group 'info) | 3278 | :group 'info) |
| 3135 | 3279 | ||
| 3136 | (defface Info-title-3-face | 3280 | (defface Info-title-3-face |
| 3137 | '((((type tty pc) (class color)) (:weight bold)) | 3281 | '((((type tty pc) (class color)) :weight bold) |
| 3138 | (t (:height 1.2 :inherit Info-title-4-face))) | 3282 | (t :height 1.2 :inherit Info-title-4-face)) |
| 3139 | "Face for Info titles at level 3." | 3283 | "Face for Info titles at level 3." |
| 3140 | :group 'info) | 3284 | :group 'info) |
| 3141 | 3285 | ||
| 3142 | (defface Info-title-4-face | 3286 | (defface Info-title-4-face |
| 3143 | '((((type tty pc) (class color)) (:weight bold)) | 3287 | '((((type tty pc) (class color)) :weight bold) |
| 3144 | (t (:weight bold :inherit variable-pitch))) | 3288 | (t :weight bold :inherit variable-pitch)) |
| 3145 | "Face for Info titles at level 4." | 3289 | "Face for Info titles at level 4." |
| 3146 | :group 'info) | 3290 | :group 'info) |
| 3147 | 3291 | ||
| @@ -3360,7 +3504,8 @@ Preserve text properties." | |||
| 3360 | (hl Info-history-list) | 3504 | (hl Info-history-list) |
| 3361 | res) | 3505 | res) |
| 3362 | (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) | 3506 | (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) |
| 3363 | (setq file (match-string 1 node) | 3507 | (setq file (file-name-nondirectory |
| 3508 | (match-string 1 node)) | ||
| 3364 | node (if (equal (match-string 2 node) "") | 3509 | node (if (equal (match-string 2 node) "") |
| 3365 | "Top" | 3510 | "Top" |
| 3366 | (match-string 2 node)))) | 3511 | (match-string 2 node)))) |
| @@ -3377,14 +3522,20 @@ Preserve text properties." | |||
| 3377 | (add-text-properties (match-beginning 3) (match-end 3) | 3522 | (add-text-properties (match-beginning 3) (match-end 3) |
| 3378 | '(invisible t front-sticky nil rear-nonsticky t)) | 3523 | '(invisible t front-sticky nil rear-nonsticky t)) |
| 3379 | ;; Unhide the file name of the external reference in parens | 3524 | ;; Unhide the file name of the external reference in parens |
| 3380 | (if (match-string 6) | 3525 | (if (and (match-string 6) (not (eq Info-hide-note-references 'hide))) |
| 3381 | (remove-text-properties (match-beginning 6) (match-end 6) | 3526 | (remove-text-properties (match-beginning 6) (match-end 6) |
| 3382 | '(invisible t front-sticky nil rear-nonsticky t))) | 3527 | '(invisible t front-sticky nil rear-nonsticky t))) |
| 3383 | ;; Unhide newline because hidden newlines cause too long lines | 3528 | ;; Unhide newline because hidden newlines cause too long lines |
| 3384 | (save-match-data | 3529 | (save-match-data |
| 3385 | (let ((start3 (match-beginning 3))) | 3530 | (let ((beg3 (match-beginning 3)) |
| 3386 | (if (string-match "\n[ \t]*" (match-string 3)) | 3531 | (end3 (match-end 3))) |
| 3387 | (remove-text-properties (+ start3 (match-beginning 0)) (+ start3 (match-end 0)) | 3532 | (if (and (string-match "\n[ \t]*" (match-string 3)) |
| 3533 | (not (save-match-data | ||
| 3534 | (save-excursion | ||
| 3535 | (goto-char (1+ end3)) | ||
| 3536 | (looking-at "[.)]*$"))))) | ||
| 3537 | (remove-text-properties (+ beg3 (match-beginning 0)) | ||
| 3538 | (+ beg3 (match-end 0)) | ||
| 3388 | '(invisible t front-sticky nil rear-nonsticky t)))))) | 3539 | '(invisible t front-sticky nil rear-nonsticky t)))))) |
| 3389 | (when (and Info-refill-paragraphs Info-hide-note-references) | 3540 | (when (and Info-refill-paragraphs Info-hide-note-references) |
| 3390 | (push (set-marker (make-marker) start) | 3541 | (push (set-marker (make-marker) start) |
| @@ -3416,7 +3567,7 @@ Preserve text properties." | |||
| 3416 | (goto-char (point-min)) | 3567 | (goto-char (point-min)) |
| 3417 | (when (and (or not-fontified-p fontify-visited-p) | 3568 | (when (and (or not-fontified-p fontify-visited-p) |
| 3418 | (search-forward "\n* Menu:" nil t) | 3569 | (search-forward "\n* Menu:" nil t) |
| 3419 | (not (string-match "\\<Index\\>" Info-current-node)) | 3570 | (not (Info-index-node)) |
| 3420 | ;; Don't take time to annotate huge menus | 3571 | ;; Don't take time to annotate huge menus |
| 3421 | (< (- (point-max) (point)) Info-fontify-maximum-menu-size)) | 3572 | (< (- (point-max) (point)) Info-fontify-maximum-menu-size)) |
| 3422 | (let ((n 0) | 3573 | (let ((n 0) |
| @@ -3454,7 +3605,8 @@ Preserve text properties." | |||
| 3454 | (hl Info-history-list) | 3605 | (hl Info-history-list) |
| 3455 | res) | 3606 | res) |
| 3456 | (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) | 3607 | (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) |
| 3457 | (setq file (match-string 1 node) | 3608 | (setq file (file-name-nondirectory |
| 3609 | (match-string 1 node)) | ||
| 3458 | node (if (equal (match-string 2 node) "") | 3610 | node (if (equal (match-string 2 node) "") |
| 3459 | "Top" | 3611 | "Top" |
| 3460 | (match-string 2 node)))) | 3612 | (match-string 2 node)))) |
| @@ -3502,6 +3654,13 @@ Preserve text properties." | |||
| 3502 | (put-text-property (match-beginning 1) (match-end 1) | 3654 | (put-text-property (match-beginning 1) (match-end 1) |
| 3503 | 'font-lock-face 'info-menu-header))) | 3655 | 'font-lock-face 'info-menu-header))) |
| 3504 | 3656 | ||
| 3657 | ;; Hide index line numbers | ||
| 3658 | (goto-char (point-min)) | ||
| 3659 | (when (and not-fontified-p (Info-index-node)) | ||
| 3660 | (while (re-search-forward "[ \t\n]*(line +[0-9]+)" nil t) | ||
| 3661 | (put-text-property (match-beginning 0) (match-end 0) | ||
| 3662 | 'invisible t))) | ||
| 3663 | |||
| 3505 | ;; Fontify http and ftp references | 3664 | ;; Fontify http and ftp references |
| 3506 | (goto-char (point-min)) | 3665 | (goto-char (point-min)) |
| 3507 | (when not-fontified-p | 3666 | (when not-fontified-p |
| @@ -3713,6 +3872,27 @@ BUFFER is the buffer speedbar is requesting buttons for." | |||
| 3713 | "^No \".*\" in index$")) | 3872 | "^No \".*\" in index$")) |
| 3714 | (add-to-list 'debug-ignored-errors mess)) | 3873 | (add-to-list 'debug-ignored-errors mess)) |
| 3715 | 3874 | ||
| 3875 | ;;;; Desktop support | ||
| 3876 | |||
| 3877 | (defun Info-desktop-buffer-misc-data (desktop-dirname) | ||
| 3878 | "Auxiliary information to be saved in desktop file." | ||
| 3879 | (if (not (member Info-current-file '("apropos" "history" "toc"))) | ||
| 3880 | (list Info-current-file Info-current-node))) | ||
| 3881 | |||
| 3882 | ;;;###autoload | ||
| 3883 | (defun Info-restore-desktop-buffer (desktop-buffer-file-name | ||
| 3884 | desktop-buffer-name | ||
| 3885 | desktop-buffer-misc) | ||
| 3886 | "Restore an info buffer specified in a desktop file." | ||
| 3887 | (let ((first (nth 0 desktop-buffer-misc)) | ||
| 3888 | (second (nth 1 desktop-buffer-misc))) | ||
| 3889 | (when (and first second) | ||
| 3890 | (when desktop-buffer-name | ||
| 3891 | (set-buffer (get-buffer-create desktop-buffer-name)) | ||
| 3892 | (Info-mode)) | ||
| 3893 | (Info-find-node first second) | ||
| 3894 | (current-buffer)))) | ||
| 3895 | |||
| 3716 | (provide 'info) | 3896 | (provide 'info) |
| 3717 | 3897 | ||
| 3718 | ;;; arch-tag: f2480fe2-2139-40c1-a49b-6314991164ac | 3898 | ;;; arch-tag: f2480fe2-2139-40c1-a49b-6314991164ac |