comparison lisp/info.el @ 28943:36fd90774cf7

(debug-ignored-errors): more errors to ignore.
author Sam Steingold <sds@gnu.org>
date Tue, 16 May 2000 16:24:25 +0000
parents 934ebbe70162
children 05c01c4206d8
comparison
equal deleted inserted replaced
28942:7ba4cf5748e8 28943:36fd90774cf7
289 "Like `info' but show the Info buffer in another window." 289 "Like `info' but show the Info buffer in another window."
290 (interactive (if current-prefix-arg 290 (interactive (if current-prefix-arg
291 (list (read-file-name "Info file name: " nil nil t)))) 291 (list (read-file-name "Info file name: " nil nil t))))
292 (let (same-window-buffer-names) 292 (let (same-window-buffer-names)
293 (info file))) 293 (info file)))
294 294
295 ;;;###autoload (add-hook 'same-window-buffer-names "*info*") 295 ;;;###autoload (add-hook 'same-window-buffer-names "*info*")
296 296
297 ;;;###autoload 297 ;;;###autoload
298 (defun info (&optional file) 298 (defun info (&optional file)
299 "Enter Info, the documentation browser. 299 "Enter Info, the documentation browser.
304 304
305 In interactive use, a prefix argument directs this command 305 In interactive use, a prefix argument directs this command
306 to read a file name from the minibuffer. 306 to read a file name from the minibuffer.
307 307
308 The search path for Info files is in the variable `Info-directory-list'. 308 The search path for Info files is in the variable `Info-directory-list'.
309 The top-level Info directory is made by combining all the files named `dir' 309 The top-level Info directory is made by combining all the files named `dir'
310 in all the directories in that path." 310 in all the directories in that path."
311 (interactive (if current-prefix-arg 311 (interactive (if current-prefix-arg
312 (list (read-file-name "Info file name: " nil nil t)))) 312 (list (read-file-name "Info file name: " nil nil t))))
313 (if file 313 (if file
314 (progn 314 (progn
640 (if (and Info-dir-contents Info-dir-file-attributes 640 (if (and Info-dir-contents Info-dir-file-attributes
641 ;; Verify that none of the files we used has changed 641 ;; Verify that none of the files we used has changed
642 ;; since we used it. 642 ;; since we used it.
643 (eval (cons 'and 643 (eval (cons 'and
644 (mapcar '(lambda (elt) 644 (mapcar '(lambda (elt)
645 (let ((curr (file-attributes 645 (let ((curr (file-attributes
646 ;; Handle symlinks 646 ;; Handle symlinks
647 (file-truename (car elt))))) 647 (file-truename (car elt)))))
648 648
649 ;; Don't compare the access time. 649 ;; Don't compare the access time.
650 (if curr (setcar (nthcdr 4 curr) 0)) 650 (if curr (setcar (nthcdr 4 curr) 0))
651 (setcar (nthcdr 4 (cdr elt)) 0) 651 (setcar (nthcdr 4 (cdr elt)) 0)
652 (equal (cdr elt) curr))) 652 (equal (cdr elt) curr)))
653 Info-dir-file-attributes)))) 653 Info-dir-file-attributes))))
701 Info-dir-file-attributes))) 701 Info-dir-file-attributes)))
702 (error (kill-buffer (current-buffer)))))))) 702 (error (kill-buffer (current-buffer))))))))
703 (or (cdr dirs) (setq Info-dir-contents-directory 703 (or (cdr dirs) (setq Info-dir-contents-directory
704 (file-name-as-directory (car dirs)))) 704 (file-name-as-directory (car dirs))))
705 (setq dirs (cdr dirs)))) 705 (setq dirs (cdr dirs))))
706 706
707 (or buffers 707 (or buffers
708 (error "Can't find the Info directory node")) 708 (error "Can't find the Info directory node"))
709 ;; Distinguish the dir file that comes with Emacs from all the 709 ;; Distinguish the dir file that comes with Emacs from all the
710 ;; others. Yes, that is really what this is supposed to do. 710 ;; others. Yes, that is really what this is supposed to do.
711 ;; The definition of `Info-directory-list' puts it first on that 711 ;; The definition of `Info-directory-list' puts it first on that
977 (while (search-forward "\n\^_" nil t) 977 (while (search-forward "\n\^_" nil t)
978 (forward-line 1) 978 (forward-line 1)
979 (let ((beg (point))) 979 (let ((beg (point)))
980 (forward-line 1) 980 (forward-line 1)
981 (if (re-search-backward node-regexp beg t) 981 (if (re-search-backward node-regexp beg t)
982 (setq compl 982 (setq compl
983 (cons (list (match-string-no-properties 1)) 983 (cons (list (match-string-no-properties 1))
984 compl)))))))) 984 compl))))))))
985 (setq compl (cons '("*") compl)) 985 (setq compl (cons '("*") compl))
986 (setq Info-current-file-completions compl)))) 986 (setq Info-current-file-completions compl))))
987 987
1068 (equal ofile Info-current-file)) 1068 (equal ofile Info-current-file))
1069 (setq Info-history (cons (list ofile onode opoint) 1069 (setq Info-history (cons (list ofile onode opoint)
1070 Info-history)))))) 1070 Info-history))))))
1071 1071
1072 ;; Extract the value of the node-pointer named NAME. 1072 ;; Extract the value of the node-pointer named NAME.
1073 ;; If there is none, use ERRORNAME in the error message; 1073 ;; If there is none, use ERRORNAME in the error message;
1074 ;; if ERRORNAME is nil, just return nil. 1074 ;; if ERRORNAME is nil, just return nil.
1075 (defun Info-extract-pointer (name &optional errorname) 1075 (defun Info-extract-pointer (name &optional errorname)
1076 ;; Bind this in case the user sets it to nil. 1076 ;; Bind this in case the user sets it to nil.
1077 (let ((case-fold-search t)) 1077 (let ((case-fold-search t))
1078 (save-excursion 1078 (save-excursion
1337 (setq item nil)))) 1337 (setq item nil))))
1338 (list item current-prefix-arg)))) 1338 (list item current-prefix-arg))))
1339 ;; there is a problem here in that if several menu items have the same 1339 ;; there is a problem here in that if several menu items have the same
1340 ;; name you can only go to the node of the first with this command. 1340 ;; name you can only go to the node of the first with this command.
1341 (Info-goto-node (Info-extract-menu-item menu-item) (if fork menu-item))) 1341 (Info-goto-node (Info-extract-menu-item menu-item) (if fork menu-item)))
1342 1342
1343 (defun Info-extract-menu-item (menu-item) 1343 (defun Info-extract-menu-item (menu-item)
1344 (setq menu-item (regexp-quote menu-item)) 1344 (setq menu-item (regexp-quote menu-item))
1345 (let ((case-fold-search t)) 1345 (let ((case-fold-search t))
1346 (save-excursion 1346 (save-excursion
1347 (goto-char (point-min)) 1347 (goto-char (point-min))
1387 (Info-goto-node "Top") 1387 (Info-goto-node "Top")
1388 (let (Info-history) 1388 (let (Info-history)
1389 ;; Go to the last node in the menu of Top. 1389 ;; Go to the last node in the menu of Top.
1390 (Info-goto-node (Info-extract-menu-counting nil)) 1390 (Info-goto-node (Info-extract-menu-counting nil))
1391 ;; If the last node in the menu is not last in pointer structure, 1391 ;; If the last node in the menu is not last in pointer structure,
1392 ;; move forward until we can't go any farther. 1392 ;; move forward until we can't go any farther.
1393 (while (Info-forward-node t t) nil) 1393 (while (Info-forward-node t t) nil)
1394 ;; Then keep moving down to last subnode, unless we reach an index. 1394 ;; Then keep moving down to last subnode, unless we reach an index.
1395 (while (and (not (string-match "\\<index\\>" Info-current-node)) 1395 (while (and (not (string-match "\\<index\\>" Info-current-node))
1396 (save-excursion (search-forward "\n* Menu:" nil t))) 1396 (save-excursion (search-forward "\n* Menu:" nil t)))
1397 (Info-goto-node (Info-extract-menu-counting nil))))) 1397 (Info-goto-node (Info-extract-menu-counting nil)))))
1938 (let* ((Info-complete-menu-buffer (current-buffer)) 1938 (let* ((Info-complete-menu-buffer (current-buffer))
1939 (items (nreverse (condition-case nil 1939 (items (nreverse (condition-case nil
1940 (Info-complete-menu-item 1940 (Info-complete-menu-item
1941 "" (lambda (e) t) t) 1941 "" (lambda (e) t) t)
1942 (error nil)))) 1942 (error nil))))
1943 entries current 1943 entries current
1944 (number 0)) 1944 (number 0))
1945 (while (and items (< number 9)) 1945 (while (and items (< number 9))
1946 (setq current (car items) 1946 (setq current (car items)
1947 items (cdr items) 1947 items (cdr items)
1948 number (1+ number)) 1948 number (1+ number))
1949 (setq entries (cons `[,current 1949 (setq entries (cons `[,current
1950 (Info-menu ,current) 1950 (Info-menu ,current)
1951 :keys ,(format "%d" number)] 1951 :keys ,(format "%d" number)]
1952 entries))) 1952 entries)))
1953 (if items 1953 (if items
1954 (setq entries (cons ["Other..." Info-menu t] entries))) 1954 (setq entries (cons ["Other..." Info-menu t] entries)))
1955 (or entries 1955 (or entries
1956 (setq entries (list ["No menu" nil nil]))) 1956 (setq entries (list ["No menu" nil nil])))
1957 (easy-menu-change '("Info") "Menu item" (nreverse entries))) 1957 (easy-menu-change '("Info") "Menu item" (nreverse entries)))
1958 ;; Update reference menu. Code stolen from `Info-follow-reference'. 1958 ;; Update reference menu. Code stolen from `Info-follow-reference'.
1959 (let ((items nil) 1959 (let ((items nil)
1960 str i entries current 1960 str i entries current
1961 (number 0) 1961 (number 0)
1962 (case-fold-search t)) 1962 (case-fold-search t))
1963 (save-excursion 1963 (save-excursion
1964 (goto-char (point-min)) 1964 (goto-char (point-min))
1965 (while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t) 1965 (while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t)
1975 (cons str items)))) 1975 (cons str items))))
1976 (while (and items (< number 9)) 1976 (while (and items (< number 9))
1977 (setq current (car items) 1977 (setq current (car items)
1978 items (cdr items) 1978 items (cdr items)
1979 number (1+ number)) 1979 number (1+ number))
1980 (setq entries (cons `[,current 1980 (setq entries (cons `[,current
1981 (Info-follow-reference ,current) 1981 (Info-follow-reference ,current)
1982 t] 1982 t]
1983 entries))) 1983 entries)))
1984 (if items 1984 (if items
1985 (setq entries (cons ["Other..." Info-follow-reference t] 1985 (setq entries (cons ["Other..." Info-follow-reference t]
2033 but after point, the next scroll moves into its first subnode. 2033 but after point, the next scroll moves into its first subnode.
2034 When after all menu items (or if their is no menu), move up to 2034 When after all menu items (or if their is no menu), move up to
2035 the parent node. 2035 the parent node.
2036 \\[Info-scroll-down] Normally, scroll backward. If the beginning of the buffer is 2036 \\[Info-scroll-down] Normally, scroll backward. If the beginning of the buffer is
2037 already visible, try to go to the previous menu entry, or up if there is none. 2037 already visible, try to go to the previous menu entry, or up if there is none.
2038 \\[beginning-of-buffer] Go to beginning of node. 2038 \\[beginning-of-buffer] Go to beginning of node.
2039 2039
2040 Advanced commands: 2040 Advanced commands:
2041 \\[Info-exit] Quit Info: reselect previously selected buffer. 2041 \\[Info-exit] Quit Info: reselect previously selected buffer.
2042 \\[Info-edit] Edit contents of selected node. 2042 \\[Info-edit] Edit contents of selected node.
2043 1 Pick first item in node's menu. 2043 1 Pick first item in node's menu.
2289 nil t) 2289 nil t)
2290 (let ((c (preceding-char)) 2290 (let ((c (preceding-char))
2291 face) 2291 face)
2292 (cond ((= c ?*) (setq face 'Info-title-1-face)) 2292 (cond ((= c ?*) (setq face 'Info-title-1-face))
2293 ((= c ?=) (setq face 'Info-title-2-face)) 2293 ((= c ?=) (setq face 'Info-title-2-face))
2294 (t (setq face 'Info-title-3-face))) 2294 (t (setq face 'Info-title-3-face)))
2295 (put-text-property (match-beginning 1) (match-end 1) 2295 (put-text-property (match-beginning 1) (match-end 1)
2296 'face face)) 2296 'face face))
2297 ;; This is a serious problem for trying to handle multiple 2297 ;; This is a serious problem for trying to handle multiple
2298 ;; frame types at once. We want this text to be invisible 2298 ;; frame types at once. We want this text to be invisible
2299 ;; on frames that can display the font above. 2299 ;; on frames that can display the font above.
2423 (cdr (car completions)) 2423 (cdr (car completions))
2424 'info-xref depth) 2424 'info-xref depth)
2425 (setq completions (cdr completions))) 2425 (setq completions (cdr completions)))
2426 t) 2426 t)
2427 nil)))) 2427 nil))))
2428 2428
2429 (defun Info-speedbar-goto-node (text node indent) 2429 (defun Info-speedbar-goto-node (text node indent)
2430 "When user clicks on TEXT, goto an info NODE. 2430 "When user clicks on TEXT, goto an info NODE.
2431 The INDENT level is ignored." 2431 The INDENT level is ignored."
2432 (select-frame speedbar-attached-frame) 2432 (select-frame speedbar-attached-frame)
2433 (let* ((buff (or (get-buffer "*info*") 2433 (let* ((buff (or (get-buffer "*info*")
2518 ) 2518 )
2519 2519
2520 (dolist (mess '("^Node has no Previous$" 2520 (dolist (mess '("^Node has no Previous$"
2521 "^No menu in this node$" 2521 "^No menu in this node$"
2522 "^Node has no Next$" 2522 "^Node has no Next$"
2523 "^No cross-references in this node^"
2524 search-failed
2523 "^No \".*\" in index$")) 2525 "^No \".*\" in index$"))
2524 (add-to-list 'debug-ignored-errors mess)) 2526 (add-to-list 'debug-ignored-errors mess))
2525 2527
2526 (provide 'info) 2528 (provide 'info)
2527 2529