Mercurial > emacs
comparison lisp/info.el @ 21641:1174b1d6cbf6
(Info-menu): Allow extra spaces at start of menu item.
(Info-extract-menu-item): Likewise.
(Info-insert-dir, Info-complete-menu-item, Info-index): Likewise.
(Info-try-follow-nearest-node, Info-find-emacs-command-nodes): Likewise
(Info-fontify-node, Info-speedbar-buttons): Likewise.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 18 Apr 1998 01:57:45 +0000 |
parents | e4b99d1db55a |
children | e2283c4df334 |
comparison
equal
deleted
inserted
replaced
21640:50e05b0adf4a | 21641:1174b1d6cbf6 |
---|---|
582 (end (save-excursion (search-forward "\^_" nil t) (point)))) | 582 (end (save-excursion (search-forward "\^_" nil t) (point)))) |
583 (while nodes | 583 (while nodes |
584 (let ((nodename (car (car nodes)))) | 584 (let ((nodename (car (car nodes)))) |
585 (save-excursion | 585 (save-excursion |
586 (or (member (downcase nodename) menu-items) | 586 (or (member (downcase nodename) menu-items) |
587 (re-search-forward (concat "^\\* " | 587 (re-search-forward (concat "^\\* +" |
588 (regexp-quote nodename) | 588 (regexp-quote nodename) |
589 "::") | 589 "::") |
590 end t) | 590 end t) |
591 (progn | 591 (progn |
592 (insert "* " nodename "::" "\n") | 592 (insert "* " nodename "::" "\n") |
1040 | 1040 |
1041 (defun Info-complete-menu-item (string predicate action) | 1041 (defun Info-complete-menu-item (string predicate action) |
1042 (let ((case-fold-search t)) | 1042 (let ((case-fold-search t)) |
1043 (cond ((eq action nil) | 1043 (cond ((eq action nil) |
1044 (let (completions | 1044 (let (completions |
1045 (pattern (concat "\n\\* \\(" | 1045 (pattern (concat "\n\\* +\\(" |
1046 (regexp-quote string) | 1046 (regexp-quote string) |
1047 "[^:\t\n]*\\):"))) | 1047 "[^:\t\n]*\\):"))) |
1048 (save-excursion | 1048 (save-excursion |
1049 (set-buffer Info-complete-menu-buffer) | 1049 (set-buffer Info-complete-menu-buffer) |
1050 (goto-char (point-min)) | 1050 (goto-char (point-min)) |
1057 (match-beginning 1)) | 1057 (match-beginning 1)) |
1058 completions)))) | 1058 completions)))) |
1059 (try-completion string completions predicate))) | 1059 (try-completion string completions predicate))) |
1060 ((eq action t) | 1060 ((eq action t) |
1061 (let (completions | 1061 (let (completions |
1062 (pattern (concat "\n\\* \\(" | 1062 (pattern (concat "\n\\* +\\(" |
1063 (regexp-quote string) | 1063 (regexp-quote string) |
1064 "[^:\t\n]*\\):"))) | 1064 "[^:\t\n]*\\):"))) |
1065 (save-excursion | 1065 (save-excursion |
1066 (set-buffer Info-complete-menu-buffer) | 1066 (set-buffer Info-complete-menu-buffer) |
1067 (goto-char (point-min)) | 1067 (goto-char (point-min)) |
1077 (t | 1077 (t |
1078 (save-excursion | 1078 (save-excursion |
1079 (set-buffer Info-complete-menu-buffer) | 1079 (set-buffer Info-complete-menu-buffer) |
1080 (goto-char (point-min)) | 1080 (goto-char (point-min)) |
1081 (search-forward "\n* Menu:") | 1081 (search-forward "\n* Menu:") |
1082 (re-search-forward (concat "\n\\* " | 1082 (re-search-forward (concat "\n\\* +" |
1083 (regexp-quote string) | 1083 (regexp-quote string) |
1084 ":") | 1084 ":") |
1085 nil t)))))) | 1085 nil t)))))) |
1086 | 1086 |
1087 | 1087 |
1102 (setq beg (point)) | 1102 (setq beg (point)) |
1103 (and (< (point) p) | 1103 (and (< (point) p) |
1104 (save-excursion | 1104 (save-excursion |
1105 (goto-char p) | 1105 (goto-char p) |
1106 (end-of-line) | 1106 (end-of-line) |
1107 (re-search-backward "\n\\* \\([^:\t\n]*\\):" beg t) | 1107 (re-search-backward "\n\\* +\\([^:\t\n]*\\):" beg t) |
1108 (setq default (format "%s" (buffer-substring | 1108 (setq default (format "%s" (buffer-substring |
1109 (match-beginning 1) | 1109 (match-beginning 1) |
1110 (match-end 1))))))) | 1110 (match-end 1))))))) |
1111 (let ((item nil)) | 1111 (let ((item nil)) |
1112 (while (null item) | 1112 (while (null item) |
1134 (setq menu-item (regexp-quote menu-item)) | 1134 (setq menu-item (regexp-quote menu-item)) |
1135 (save-excursion | 1135 (save-excursion |
1136 (goto-char (point-min)) | 1136 (goto-char (point-min)) |
1137 (or (search-forward "\n* menu:" nil t) | 1137 (or (search-forward "\n* menu:" nil t) |
1138 (error "No menu in this node")) | 1138 (error "No menu in this node")) |
1139 (or (re-search-forward (concat "\n\\* " menu-item ":") nil t) | 1139 (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t) |
1140 (re-search-forward (concat "\n\\* " menu-item) nil t) | 1140 (re-search-forward (concat "\n\\* +" menu-item) nil t) |
1141 (error "No such item in menu")) | 1141 (error "No such item in menu")) |
1142 (beginning-of-line) | 1142 (beginning-of-line) |
1143 (forward-char 2) | 1143 (forward-char 2) |
1144 (Info-extract-menu-node-name))) | 1144 (Info-extract-menu-node-name))) |
1145 | 1145 |
1407 Use the `,' command to see the other matches. | 1407 Use the `,' command to see the other matches. |
1408 Give a blank topic name to go to the Index node itself." | 1408 Give a blank topic name to go to the Index node itself." |
1409 (interactive "sIndex topic: ") | 1409 (interactive "sIndex topic: ") |
1410 (let ((orignode Info-current-node) | 1410 (let ((orignode Info-current-node) |
1411 (rnode nil) | 1411 (rnode nil) |
1412 (pattern (format "\n\\* \\([^\n:]*%s[^\n:]*\\):[ \t]*\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)" | 1412 (pattern (format "\n\\* +\\([^\n:]*%s[^\n:]*\\):[ \t]*\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)" |
1413 (regexp-quote topic))) | 1413 (regexp-quote topic))) |
1414 node) | 1414 node) |
1415 (Info-goto-node "Top") | 1415 (Info-goto-node "Top") |
1416 (or (search-forward "\n* menu:" nil t) | 1416 (or (search-forward "\n* menu:" nil t) |
1417 (error "No index")) | 1417 (error "No index")) |
1600 (let (node) | 1600 (let (node) |
1601 (cond | 1601 (cond |
1602 ((setq node (Info-get-token (point) "\\*note[ \n]" | 1602 ((setq node (Info-get-token (point) "\\*note[ \n]" |
1603 "\\*note[ \n]\\([^:]*\\):")) | 1603 "\\*note[ \n]\\([^:]*\\):")) |
1604 (Info-follow-reference node)) | 1604 (Info-follow-reference node)) |
1605 ((setq node (Info-get-token (point) "\\* " "\\* \\([^:]*\\)::")) | 1605 ((setq node (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\)::")) |
1606 (Info-goto-node node)) | 1606 (Info-goto-node node)) |
1607 ((setq node (Info-get-token (point) "\\* " "\\* \\([^:]*\\):")) | 1607 ((setq node (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\):")) |
1608 (Info-menu node)) | 1608 (Info-menu node)) |
1609 ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)")) | 1609 ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)")) |
1610 (Info-goto-node node)) | 1610 (Info-goto-node node)) |
1611 ((setq node (Info-get-token (point) "Next: " "Next: \\([^,\n\t]*\\)")) | 1611 ((setq node (Info-get-token (point) "Next: " "Next: \\([^,\n\t]*\\)")) |
1612 (Info-goto-node node)) | 1612 (Info-goto-node node)) |
1892 If COMMAND has no property, the variable `Info-file-list-for-emacs' | 1892 If COMMAND has no property, the variable `Info-file-list-for-emacs' |
1893 defines heuristics for which Info manual to try. | 1893 defines heuristics for which Info manual to try. |
1894 The locations are of the format used in Info-history, i.e. | 1894 The locations are of the format used in Info-history, i.e. |
1895 \(FILENAME NODENAME BUFFERPOS\)." | 1895 \(FILENAME NODENAME BUFFERPOS\)." |
1896 (let ((where '()) | 1896 (let ((where '()) |
1897 (cmd-desc (concat "^\\* " (regexp-quote (symbol-name command)) | 1897 (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command)) |
1898 ":\\s *\\(.*\\)\\.$")) | 1898 ":\\s *\\(.*\\)\\.$")) |
1899 (info-file "emacs")) ;default | 1899 (info-file "emacs")) ;default |
1900 ;; Determine which info file this command is documented in. | 1900 ;; Determine which info file this command is documented in. |
1901 (if (get command 'info-file) | 1901 (if (get command 'info-file) |
1902 (setq info-file (get command 'info-file)) | 1902 (setq info-file (get command 'info-file)) |
2031 (if (and (search-forward "\n* Menu:" nil t) | 2031 (if (and (search-forward "\n* Menu:" nil t) |
2032 (not (string-match "\\<Index\\>" Info-current-node)) | 2032 (not (string-match "\\<Index\\>" Info-current-node)) |
2033 ;; Don't take time to annotate huge menus | 2033 ;; Don't take time to annotate huge menus |
2034 (< (- (point-max) (point)) Info-fontify-maximum-menu-size)) | 2034 (< (- (point-max) (point)) Info-fontify-maximum-menu-size)) |
2035 (let ((n 0)) | 2035 (let ((n 0)) |
2036 (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t) | 2036 (while (re-search-forward "^\\* +\\([^:\t\n]*\\):" nil t) |
2037 (setq n (1+ n)) | 2037 (setq n (1+ n)) |
2038 (if (memq n '(5 9)) ; visual aids to help with 1-9 keys | 2038 (if (memq n '(5 9)) ; visual aids to help with 1-9 keys |
2039 (put-text-property (match-beginning 0) | 2039 (put-text-property (match-beginning 0) |
2040 (1+ (match-beginning 0)) | 2040 (1+ (match-beginning 0)) |
2041 'face 'info-menu-5)) | 2041 'face 'info-menu-5)) |
2102 (set-buffer buffer) | 2102 (set-buffer buffer) |
2103 (setq Info-last-speedbar-node | 2103 (setq Info-last-speedbar-node |
2104 (cons Info-current-node Info-current-file)) | 2104 (cons Info-current-node Info-current-file)) |
2105 (goto-char (point-min)) | 2105 (goto-char (point-min)) |
2106 ;; Always skip the first one... | 2106 ;; Always skip the first one... |
2107 (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) | 2107 (re-search-forward "\n\\* +\\([^:\t\n]*\\):" nil t) |
2108 (while (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) | 2108 (while (re-search-forward "\n\\* +\\([^:\t\n]*\\):" nil t) |
2109 (setq completions (cons (buffer-substring (match-beginning 1) | 2109 (setq completions (cons (buffer-substring (match-beginning 1) |
2110 (match-end 1)) | 2110 (match-end 1)) |
2111 completions)))) | 2111 completions)))) |
2112 (setq completions (nreverse completions)) | 2112 (setq completions (nreverse completions)) |
2113 (while completions | 2113 (while completions |