diff options
| author | Stefan Monnier | 2003-06-03 19:54:42 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-06-03 19:54:42 +0000 |
| commit | dde7f979b8cf83596c151c1394fe6bb07dcf1563 (patch) | |
| tree | a41c0cb733df95d41da03b3eb96c89de5883d7cc | |
| parent | 914a8c47284bfb819eb2ff44e5a4cca7f052d895 (diff) | |
| download | emacs-dde7f979b8cf83596c151c1394fe6bb07dcf1563.tar.gz emacs-dde7f979b8cf83596c151c1394fe6bb07dcf1563.zip | |
(Info-mode-hook): Obey obsolete `Info-fontify'.
(Info-find-in-tag-table-1): Remove unused vars.
(Info-display-images-node): Remove unused var paragraph-markers.
(Info-header-line): Remove.
(Info-select-node): Don't set it.
(Info-search): Remove unused var `current'.
(Info-follow-reference): Remove unused var `beg'.
(Info-extract-menu-node-name): Remove unused var `i'.
(Info-complete-menu-item): Use `with-current-buffer'.
(Info-index): Remove unused var `rnode'.
(Info-mode): Set header-line-format to check text-properties directly.
(Info-find-emacs-command-nodes): Remove unused var `found' and `exact'.
(Info-fontify-node): Use `push'.
(Info-speedbar-hierarchy-buttons): Use `dolist'.
(Info-speedbar-goto-node, Info-speedbar-fetch-file-nodes):
Check the return value of `string-match'.
(Info-speedbar-fetch-file-nodes): Factor out common code.
| -rw-r--r-- | lisp/info.el | 89 |
1 files changed, 41 insertions, 48 deletions
diff --git a/lisp/info.el b/lisp/info.el index 5ccd46dad58..5cf90a08b67 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -107,7 +107,8 @@ A header-line does not scroll with the rest of the buffer." | |||
| 107 | "List of directories to search for Info documentation files. | 107 | "List of directories to search for Info documentation files. |
| 108 | If nil, meaning not yet initialized, Info uses the environment | 108 | If nil, meaning not yet initialized, Info uses the environment |
| 109 | variable INFOPATH to initialize it, or `Info-default-directory-list' | 109 | variable INFOPATH to initialize it, or `Info-default-directory-list' |
| 110 | if there is no INFOPATH variable in the environment. | 110 | if there is no INFOPATH variable in the environment, or the |
| 111 | concatenation of the two if INFOPATH ends with a colon. | ||
| 111 | 112 | ||
| 112 | When `Info-directory-list' is initialized from the value of | 113 | When `Info-directory-list' is initialized from the value of |
| 113 | `Info-default-directory-list', and Emacs is installed in one of the | 114 | `Info-default-directory-list', and Emacs is installed in one of the |
| @@ -161,7 +162,10 @@ If value is non-nil but not t, the reference section is still shown." | |||
| 161 | (other :tag "Replace only tag" tag)) | 162 | (other :tag "Replace only tag" tag)) |
| 162 | :group 'info) | 163 | :group 'info) |
| 163 | 164 | ||
| 164 | (defcustom Info-mode-hook '(turn-on-font-lock) | 165 | (defcustom Info-mode-hook |
| 166 | ;; Try to obey obsolete Info-fontify settings. | ||
| 167 | (unless (and (boundp 'Info-fontify) (null Info-fontify)) | ||
| 168 | '(turn-on-font-lock)) | ||
| 165 | "Hooks run when `info-mode' is called." | 169 | "Hooks run when `info-mode' is called." |
| 166 | :type 'hook | 170 | :type 'hook |
| 167 | :group 'info) | 171 | :group 'info) |
| @@ -595,8 +599,7 @@ If a match was found, value is a list (FOUND-ANCHOR POS MODE), where | |||
| 595 | FOUND-ANCHOR is non-nil if a `Ref:' was matched, POS is the position | 599 | FOUND-ANCHOR is non-nil if a `Ref:' was matched, POS is the position |
| 596 | where the match was found, and MODE is `major-mode' of the buffer in | 600 | where the match was found, and MODE is `major-mode' of the buffer in |
| 597 | which the match was found." | 601 | which the match was found." |
| 598 | (let ((case-fold-search case-fold) | 602 | (let ((case-fold-search case-fold)) |
| 599 | found-mode guesspos found-anchor) | ||
| 600 | (save-excursion | 603 | (save-excursion |
| 601 | (set-buffer (marker-buffer marker)) | 604 | (set-buffer (marker-buffer marker)) |
| 602 | (goto-char marker) | 605 | (goto-char marker) |
| @@ -733,8 +736,7 @@ a case-insensitive match is tried." | |||
| 733 | (if (stringp nodename) | 736 | (if (stringp nodename) |
| 734 | (regexp-quote nodename) | 737 | (regexp-quote nodename) |
| 735 | "") | 738 | "") |
| 736 | "\\) *[,\t\n\177]")) | 739 | "\\) *[,\t\n\177]"))) |
| 737 | (nodepos nil)) | ||
| 738 | 740 | ||
| 739 | (catch 'foo | 741 | (catch 'foo |
| 740 | 742 | ||
| @@ -1107,8 +1109,7 @@ a case-insensitive match is tried." | |||
| 1107 | "Display images in current node." | 1109 | "Display images in current node." |
| 1108 | (save-excursion | 1110 | (save-excursion |
| 1109 | (let ((inhibit-read-only t) | 1111 | (let ((inhibit-read-only t) |
| 1110 | (case-fold-search t) | 1112 | (case-fold-search t)) |
| 1111 | paragraph-markers) | ||
| 1112 | (goto-char (point-min)) | 1113 | (goto-char (point-min)) |
| 1113 | (while (re-search-forward | 1114 | (while (re-search-forward |
| 1114 | "\\(\0\b[[]image\\(\\(?:[^\b]\\|[^\0]+\b\\)*\\)\0\b[]]\\)" | 1115 | "\\(\0\b[[]image\\(\\(?:[^\b]\\|[^\0]+\b\\)*\\)\0\b[]]\\)" |
| @@ -1128,10 +1129,6 @@ a case-insensitive match is tried." | |||
| 1128 | start (point) `(display ,image rear-nonsticky (display))))))) | 1129 | start (point) `(display ,image rear-nonsticky (display))))))) |
| 1129 | (set-buffer-modified-p nil))) | 1130 | (set-buffer-modified-p nil))) |
| 1130 | 1131 | ||
| 1131 | (defvar Info-header-line nil | ||
| 1132 | "If the info node header is hidden, the text of the header.") | ||
| 1133 | (put 'Info-header-line 'risky-local-variable t) | ||
| 1134 | |||
| 1135 | (defun Info-select-node () | 1132 | (defun Info-select-node () |
| 1136 | "Select the info node that point is in. | 1133 | "Select the info node that point is in. |
| 1137 | Bind this in case the user sets it to nil." | 1134 | Bind this in case the user sets it to nil." |
| @@ -1167,7 +1164,6 @@ Bind this in case the user sets it to nil." | |||
| 1167 | (point-max))) | 1164 | (point-max))) |
| 1168 | (if Info-enable-active-nodes (eval active-expression)) | 1165 | (if Info-enable-active-nodes (eval active-expression)) |
| 1169 | (Info-fontify-node) | 1166 | (Info-fontify-node) |
| 1170 | (setq Info-header-line (get-text-property (point-min) 'header-line)) | ||
| 1171 | (Info-display-images-node) | 1167 | (Info-display-images-node) |
| 1172 | (run-hooks 'Info-selection-hook))))) | 1168 | (run-hooks 'Info-selection-hook))))) |
| 1173 | 1169 | ||
| @@ -1321,7 +1317,7 @@ If FORK is a string, it is the name to use for the new buffer." | |||
| 1321 | (when (equal regexp "") | 1317 | (when (equal regexp "") |
| 1322 | (setq regexp (car Info-search-history))) | 1318 | (setq regexp (car Info-search-history))) |
| 1323 | (when regexp | 1319 | (when regexp |
| 1324 | (let ((found ()) current | 1320 | (let ((found ()) |
| 1325 | (onode Info-current-node) | 1321 | (onode Info-current-node) |
| 1326 | (ofile Info-current-file) | 1322 | (ofile Info-current-file) |
| 1327 | (opoint (point)) | 1323 | (opoint (point)) |
| @@ -1529,7 +1525,7 @@ FOOTNOTENAME may be an abbreviation of the reference name." | |||
| 1529 | (unless footnotename | 1525 | (unless footnotename |
| 1530 | (error "No reference was specified")) | 1526 | (error "No reference was specified")) |
| 1531 | 1527 | ||
| 1532 | (let (target beg i (str (concat "\\*note " (regexp-quote footnotename))) | 1528 | (let (target i (str (concat "\\*note " (regexp-quote footnotename))) |
| 1533 | (case-fold-search t)) | 1529 | (case-fold-search t)) |
| 1534 | (while (setq i (string-match " " str i)) | 1530 | (while (setq i (string-match " " str i)) |
| 1535 | (setq str (concat (substring str 0 i) "[ \t\n]+" (substring str (1+ i)))) | 1531 | (setq str (concat (substring str 0 i) "[ \t\n]+" (substring str (1+ i)))) |
| @@ -1550,7 +1546,7 @@ FOOTNOTENAME may be an abbreviation of the reference name." | |||
| 1550 | (defun Info-extract-menu-node-name (&optional errmessage multi-line) | 1546 | (defun Info-extract-menu-node-name (&optional errmessage multi-line) |
| 1551 | (skip-chars-forward " \t\n") | 1547 | (skip-chars-forward " \t\n") |
| 1552 | (let ((beg (point)) | 1548 | (let ((beg (point)) |
| 1553 | str i) | 1549 | str) |
| 1554 | (while (not (looking-at ":*[,.;() \t\n]")) | 1550 | (while (not (looking-at ":*[,.;() \t\n]")) |
| 1555 | (skip-chars-forward "^:") | 1551 | (skip-chars-forward "^:") |
| 1556 | (forward-char 1)) | 1552 | (forward-char 1)) |
| @@ -1579,8 +1575,7 @@ FOOTNOTENAME may be an abbreviation of the reference name." | |||
| 1579 | ;; also look for menu items in subsequent nodes as long as those | 1575 | ;; also look for menu items in subsequent nodes as long as those |
| 1580 | ;; nodes' names match `Info-complete-next-re'. This feature is currently | 1576 | ;; nodes' names match `Info-complete-next-re'. This feature is currently |
| 1581 | ;; only used for completion in Info-index. | 1577 | ;; only used for completion in Info-index. |
| 1582 | (save-excursion | 1578 | (with-current-buffer Info-complete-menu-buffer |
| 1583 | (set-buffer Info-complete-menu-buffer) | ||
| 1584 | (let ((completion-ignore-case t) | 1579 | (let ((completion-ignore-case t) |
| 1585 | (case-fold-search t) | 1580 | (case-fold-search t) |
| 1586 | (orignode Info-current-node) | 1581 | (orignode Info-current-node) |
| @@ -2010,7 +2005,6 @@ Give a blank topic name to go to the Index node itself." | |||
| 2010 | (if (equal Info-current-file "dir") | 2005 | (if (equal Info-current-file "dir") |
| 2011 | (error "The Info directory node has no index; use m to select a manual")) | 2006 | (error "The Info directory node has no index; use m to select a manual")) |
| 2012 | (let ((orignode Info-current-node) | 2007 | (let ((orignode Info-current-node) |
| 2013 | (rnode nil) | ||
| 2014 | (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)" | 2008 | (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)" |
| 2015 | (regexp-quote topic))) | 2009 | (regexp-quote topic))) |
| 2016 | node | 2010 | node |
| @@ -2495,8 +2489,10 @@ Advanced commands: | |||
| 2495 | (setq Info-tag-table-buffer nil) | 2489 | (setq Info-tag-table-buffer nil) |
| 2496 | (make-local-variable 'Info-history) | 2490 | (make-local-variable 'Info-history) |
| 2497 | (make-local-variable 'Info-index-alternatives) | 2491 | (make-local-variable 'Info-index-alternatives) |
| 2498 | (make-local-variable 'Info-header-line) | 2492 | (setq header-line-format |
| 2499 | (setq header-line-format (if Info-use-header-line 'Info-header-line)) | 2493 | (if Info-use-header-line |
| 2494 | '(:eval (get-text-property (point-min) 'header-line)) | ||
| 2495 | nil)) ; so the header line isn't displayed | ||
| 2500 | (set (make-local-variable 'tool-bar-map) info-tool-bar-map) | 2496 | (set (make-local-variable 'tool-bar-map) info-tool-bar-map) |
| 2501 | ;; This is for the sake of the invisible text we use handling titles. | 2497 | ;; This is for the sake of the invisible text we use handling titles. |
| 2502 | (make-local-variable 'line-move-ignore-invisible) | 2498 | (make-local-variable 'line-move-ignore-invisible) |
| @@ -2630,8 +2626,7 @@ The locations are of the format used in `Info-history', i.e. | |||
| 2630 | ;; Bind Info-history to nil, to prevent the index nodes from | 2626 | ;; Bind Info-history to nil, to prevent the index nodes from |
| 2631 | ;; getting into the node history. | 2627 | ;; getting into the node history. |
| 2632 | (let ((Info-history nil) | 2628 | (let ((Info-history nil) |
| 2633 | (exact nil) | 2629 | node) |
| 2634 | node found) | ||
| 2635 | (Info-goto-node (Info-extract-menu-node-name)) | 2630 | (Info-goto-node (Info-extract-menu-node-name)) |
| 2636 | (while | 2631 | (while |
| 2637 | (progn | 2632 | (progn |
| @@ -2893,8 +2888,8 @@ the variable `Info-file-list-for-emacs'." | |||
| 2893 | (goto-char (match-beginning 1)) | 2888 | (goto-char (match-beginning 1)) |
| 2894 | (insert other-tag))) | 2889 | (insert other-tag))) |
| 2895 | (when (or hide-tag (eq Info-hide-note-references t)) | 2890 | (when (or hide-tag (eq Info-hide-note-references t)) |
| 2896 | (setq paragraph-markers (cons (set-marker (make-marker) start) | 2891 | (push (set-marker (make-marker) start) |
| 2897 | paragraph-markers)))))) | 2892 | paragraph-markers))))) |
| 2898 | 2893 | ||
| 2899 | (let ((fill-nobreak-invisible t)) | 2894 | (let ((fill-nobreak-invisible t)) |
| 2900 | (goto-char (point-max)) | 2895 | (goto-char (point-max)) |
| @@ -3030,14 +3025,13 @@ specific node to expand." | |||
| 3030 | (select-frame cf) | 3025 | (select-frame cf) |
| 3031 | (if completions | 3026 | (if completions |
| 3032 | (speedbar-with-writable | 3027 | (speedbar-with-writable |
| 3033 | (while completions | 3028 | (dolist (completion completions) |
| 3034 | (speedbar-make-tag-line 'bracket ?+ 'Info-speedbar-expand-node | 3029 | (speedbar-make-tag-line 'bracket ?+ 'Info-speedbar-expand-node |
| 3035 | (cdr (car completions)) | 3030 | (cdr completion) |
| 3036 | (car (car completions)) | 3031 | (car completion) |
| 3037 | 'Info-speedbar-goto-node | 3032 | 'Info-speedbar-goto-node |
| 3038 | (cdr (car completions)) | 3033 | (cdr completion) |
| 3039 | 'info-xref depth) | 3034 | 'info-xref depth)) |
| 3040 | (setq completions (cdr completions))) | ||
| 3041 | t) | 3035 | t) |
| 3042 | nil)))) | 3036 | nil)))) |
| 3043 | 3037 | ||
| @@ -3056,10 +3050,9 @@ The INDENT level is ignored." | |||
| 3056 | (let ((pop-up-frames t)) (select-window (display-buffer buff))) | 3050 | (let ((pop-up-frames t)) (select-window (display-buffer buff))) |
| 3057 | (select-frame speedbar-attached-frame) | 3051 | (select-frame speedbar-attached-frame) |
| 3058 | (switch-to-buffer buff))) | 3052 | (switch-to-buffer buff))) |
| 3059 | (let ((junk (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node)) | 3053 | (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node)) |
| 3060 | (file (match-string 1 node)) | 3054 | (error "Invalid node %s" node) |
| 3061 | (node (match-string 2 node))) | 3055 | (Info-find-node (match-string 1 node) (match-string 2 node)) |
| 3062 | (Info-find-node file node) | ||
| 3063 | ;; If we do a find-node, and we were in info mode, restore | 3056 | ;; If we do a find-node, and we were in info mode, restore |
| 3064 | ;; the old default method. Once we are in info mode, it makes | 3057 | ;; the old default method. Once we are in info mode, it makes |
| 3065 | ;; sense to return to whatever method the user was using before. | 3058 | ;; sense to return to whatever method the user was using before. |
| @@ -3096,10 +3089,9 @@ Optional THISFILE represends the filename of" | |||
| 3096 | (if (not (equal major-mode 'Info-mode)) | 3089 | (if (not (equal major-mode 'Info-mode)) |
| 3097 | (Info-mode)) | 3090 | (Info-mode)) |
| 3098 | ;; Get the node into this buffer | 3091 | ;; Get the node into this buffer |
| 3099 | (let ((junk (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec)) | 3092 | (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec)) |
| 3100 | (file (match-string 1 nodespec)) | 3093 | (error "Invalid node specification %s" nodespec) |
| 3101 | (node (match-string 2 nodespec))) | 3094 | (Info-find-node (match-string 1 nodespec) (match-string 2 nodespec))) |
| 3102 | (Info-find-node file node)) | ||
| 3103 | ;; Scan the created buffer | 3095 | ;; Scan the created buffer |
| 3104 | (goto-char (point-min)) | 3096 | (goto-char (point-min)) |
| 3105 | (let ((completions nil) | 3097 | (let ((completions nil) |
| @@ -3110,15 +3102,16 @@ Optional THISFILE represends the filename of" | |||
| 3110 | (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) | 3102 | (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) |
| 3111 | (while (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) | 3103 | (while (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) |
| 3112 | (let ((name (match-string 1))) | 3104 | (let ((name (match-string 1))) |
| 3113 | (if (looking-at " *\\(([^)]+)[^.\n]+\\)\\.") | 3105 | (push (cons name |
| 3114 | (setq name (cons name (match-string 1))) | 3106 | (if (looking-at " *\\(([^)]+)[^.\n]+\\)\\.") |
| 3115 | (if (looking-at " *\\(([^)]+)\\)\\.") | 3107 | (match-string 1) |
| 3116 | (setq name (cons name (concat (match-string 1) "Top"))) | 3108 | (if (looking-at " *\\(([^)]+)\\)\\.") |
| 3117 | (if (looking-at " \\([^.]+\\).") | 3109 | (concat (match-string 1) "Top") |
| 3118 | (setq name | 3110 | (concat "(" thisfile ")" |
| 3119 | (cons name (concat "(" thisfile ")" (match-string 1)))) | 3111 | (if (looking-at " \\([^.]+\\).") |
| 3120 | (setq name (cons name (concat "(" thisfile ")" name)))))) | 3112 | (match-string 1) |
| 3121 | (setq completions (cons name completions)))) | 3113 | name))))) |
| 3114 | completions))) | ||
| 3122 | (nreverse completions)))) | 3115 | (nreverse completions)))) |
| 3123 | 3116 | ||
| 3124 | ;;; Info mode node listing | 3117 | ;;; Info mode node listing |