Mercurial > emacs
changeset 51434:4c85e6a5a9d2
(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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 03 Jun 2003 19:54:42 +0000 |
parents | 6bc01726e133 |
children | 13588bcc615a |
files | lisp/info.el |
diffstat | 1 files changed, 41 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/info.el Tue Jun 03 19:15:59 2003 +0000 +++ b/lisp/info.el Tue Jun 03 19:54:42 2003 +0000 @@ -107,7 +107,8 @@ "List of directories to search for Info documentation files. If nil, meaning not yet initialized, Info uses the environment variable INFOPATH to initialize it, or `Info-default-directory-list' -if there is no INFOPATH variable in the environment. +if there is no INFOPATH variable in the environment, or the +concatenation of the two if INFOPATH ends with a colon. When `Info-directory-list' is initialized from the value of `Info-default-directory-list', and Emacs is installed in one of the @@ -161,7 +162,10 @@ (other :tag "Replace only tag" tag)) :group 'info) -(defcustom Info-mode-hook '(turn-on-font-lock) +(defcustom Info-mode-hook + ;; Try to obey obsolete Info-fontify settings. + (unless (and (boundp 'Info-fontify) (null Info-fontify)) + '(turn-on-font-lock)) "Hooks run when `info-mode' is called." :type 'hook :group 'info) @@ -595,8 +599,7 @@ FOUND-ANCHOR is non-nil if a `Ref:' was matched, POS is the position where the match was found, and MODE is `major-mode' of the buffer in which the match was found." - (let ((case-fold-search case-fold) - found-mode guesspos found-anchor) + (let ((case-fold-search case-fold)) (save-excursion (set-buffer (marker-buffer marker)) (goto-char marker) @@ -733,8 +736,7 @@ (if (stringp nodename) (regexp-quote nodename) "") - "\\) *[,\t\n\177]")) - (nodepos nil)) + "\\) *[,\t\n\177]"))) (catch 'foo @@ -1107,8 +1109,7 @@ "Display images in current node." (save-excursion (let ((inhibit-read-only t) - (case-fold-search t) - paragraph-markers) + (case-fold-search t)) (goto-char (point-min)) (while (re-search-forward "\\(\0\b[[]image\\(\\(?:[^\b]\\|[^\0]+\b\\)*\\)\0\b[]]\\)" @@ -1128,10 +1129,6 @@ start (point) `(display ,image rear-nonsticky (display))))))) (set-buffer-modified-p nil))) -(defvar Info-header-line nil - "If the info node header is hidden, the text of the header.") -(put 'Info-header-line 'risky-local-variable t) - (defun Info-select-node () "Select the info node that point is in. Bind this in case the user sets it to nil." @@ -1167,7 +1164,6 @@ (point-max))) (if Info-enable-active-nodes (eval active-expression)) (Info-fontify-node) - (setq Info-header-line (get-text-property (point-min) 'header-line)) (Info-display-images-node) (run-hooks 'Info-selection-hook))))) @@ -1321,7 +1317,7 @@ (when (equal regexp "") (setq regexp (car Info-search-history))) (when regexp - (let ((found ()) current + (let ((found ()) (onode Info-current-node) (ofile Info-current-file) (opoint (point)) @@ -1529,7 +1525,7 @@ (unless footnotename (error "No reference was specified")) - (let (target beg i (str (concat "\\*note " (regexp-quote footnotename))) + (let (target i (str (concat "\\*note " (regexp-quote footnotename))) (case-fold-search t)) (while (setq i (string-match " " str i)) (setq str (concat (substring str 0 i) "[ \t\n]+" (substring str (1+ i)))) @@ -1550,7 +1546,7 @@ (defun Info-extract-menu-node-name (&optional errmessage multi-line) (skip-chars-forward " \t\n") (let ((beg (point)) - str i) + str) (while (not (looking-at ":*[,.;() \t\n]")) (skip-chars-forward "^:") (forward-char 1)) @@ -1579,8 +1575,7 @@ ;; also look for menu items in subsequent nodes as long as those ;; nodes' names match `Info-complete-next-re'. This feature is currently ;; only used for completion in Info-index. - (save-excursion - (set-buffer Info-complete-menu-buffer) + (with-current-buffer Info-complete-menu-buffer (let ((completion-ignore-case t) (case-fold-search t) (orignode Info-current-node) @@ -2010,7 +2005,6 @@ (if (equal Info-current-file "dir") (error "The Info directory node has no index; use m to select a manual")) (let ((orignode Info-current-node) - (rnode nil) (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)" (regexp-quote topic))) node @@ -2495,8 +2489,10 @@ (setq Info-tag-table-buffer nil) (make-local-variable 'Info-history) (make-local-variable 'Info-index-alternatives) - (make-local-variable 'Info-header-line) - (setq header-line-format (if Info-use-header-line 'Info-header-line)) + (setq header-line-format + (if Info-use-header-line + '(:eval (get-text-property (point-min) 'header-line)) + nil)) ; so the header line isn't displayed (set (make-local-variable 'tool-bar-map) info-tool-bar-map) ;; This is for the sake of the invisible text we use handling titles. (make-local-variable 'line-move-ignore-invisible) @@ -2630,8 +2626,7 @@ ;; Bind Info-history to nil, to prevent the index nodes from ;; getting into the node history. (let ((Info-history nil) - (exact nil) - node found) + node) (Info-goto-node (Info-extract-menu-node-name)) (while (progn @@ -2893,8 +2888,8 @@ (goto-char (match-beginning 1)) (insert other-tag))) (when (or hide-tag (eq Info-hide-note-references t)) - (setq paragraph-markers (cons (set-marker (make-marker) start) - paragraph-markers)))))) + (push (set-marker (make-marker) start) + paragraph-markers))))) (let ((fill-nobreak-invisible t)) (goto-char (point-max)) @@ -3030,14 +3025,13 @@ (select-frame cf) (if completions (speedbar-with-writable - (while completions + (dolist (completion completions) (speedbar-make-tag-line 'bracket ?+ 'Info-speedbar-expand-node - (cdr (car completions)) - (car (car completions)) + (cdr completion) + (car completion) 'Info-speedbar-goto-node - (cdr (car completions)) - 'info-xref depth) - (setq completions (cdr completions))) + (cdr completion) + 'info-xref depth)) t) nil)))) @@ -3056,10 +3050,9 @@ (let ((pop-up-frames t)) (select-window (display-buffer buff))) (select-frame speedbar-attached-frame) (switch-to-buffer buff))) - (let ((junk (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node)) - (file (match-string 1 node)) - (node (match-string 2 node))) - (Info-find-node file node) + (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node)) + (error "Invalid node %s" node) + (Info-find-node (match-string 1 node) (match-string 2 node)) ;; If we do a find-node, and we were in info mode, restore ;; the old default method. Once we are in info mode, it makes ;; sense to return to whatever method the user was using before. @@ -3096,10 +3089,9 @@ (if (not (equal major-mode 'Info-mode)) (Info-mode)) ;; Get the node into this buffer - (let ((junk (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec)) - (file (match-string 1 nodespec)) - (node (match-string 2 nodespec))) - (Info-find-node file node)) + (if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" nodespec)) + (error "Invalid node specification %s" nodespec) + (Info-find-node (match-string 1 nodespec) (match-string 2 nodespec))) ;; Scan the created buffer (goto-char (point-min)) (let ((completions nil) @@ -3110,15 +3102,16 @@ (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) (while (re-search-forward "\n\\* \\([^:\t\n]*\\):" nil t) (let ((name (match-string 1))) - (if (looking-at " *\\(([^)]+)[^.\n]+\\)\\.") - (setq name (cons name (match-string 1))) - (if (looking-at " *\\(([^)]+)\\)\\.") - (setq name (cons name (concat (match-string 1) "Top"))) - (if (looking-at " \\([^.]+\\).") - (setq name - (cons name (concat "(" thisfile ")" (match-string 1)))) - (setq name (cons name (concat "(" thisfile ")" name)))))) - (setq completions (cons name completions)))) + (push (cons name + (if (looking-at " *\\(([^)]+)[^.\n]+\\)\\.") + (match-string 1) + (if (looking-at " *\\(([^)]+)\\)\\.") + (concat (match-string 1) "Top") + (concat "(" thisfile ")" + (if (looking-at " \\([^.]+\\).") + (match-string 1) + name))))) + completions))) (nreverse completions)))) ;;; Info mode node listing