;;; info.el --- info package for Emacs.
-;; Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: help
"List of directories to search for Info documentation files.
nil means not yet initialized. In this case, 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.
+The last element of `Info-default-directory-list' is the directory
+where Emacs's installs the Info files that come with it.
+If Emacs finds it has been installed elsewhere, or not yet installed,
+it replaces that element with the directory that its Info files are in.")
(defvar Info-current-file nil
"Info file that Info is now looking at, or nil.")
(setq tail (cdr tail)))
(setq fullname (concat filename (car (car tail)))
decoder (cdr (car tail)))
+ ;; check for conflict with jka-compr
+ (if (and (featurep 'jka-compr)
+ (jka-compr-installed-p)
+ (jka-compr-get-compression-info (concat filename
+ (car (car tail)))))
+ (setq decoder nil))
(or tail
(error "Can't find %s or any compressed version of it!" filename)))
(insert-file-contents fullname visit)
(Info-select-node)))
;; If we did not finish finding the specified node,
;; go back to the previous one.
- (or Info-current-node no-going-back
+ (or Info-current-node no-going-back (null Info-history)
(let ((hist (car Info-history)))
(setq Info-history (cdr Info-history))
(Info-find-node (nth 0 hist) (nth 1 hist) t)
Info-dir-file-attributes))))))
(setq dirs (cdr dirs)))
+ (or buffers
+ (error "Can't find the info directory node"))
;; Distinguish the dir file that comes with Emacs from all the
;; others. Yes, that is really what this is supposed to do.
;; If it doesn't work, fix it.
(defun Info-next-preorder ()
"Go to the next node, popping up a level if there is none."
(interactive)
- (cond ((looking-at "\\*note[ \n]*\\([^:]*\\):")
- (Info-follow-reference
- (buffer-substring (match-beginning 1) (match-end 1))))
- ((Info-no-error (Info-next-menu-item)) )
+ (cond ((Info-no-error (Info-next-menu-item)) )
((Info-no-error (Info-up)) (forward-line 1))
(t (error "No more nodes"))))
(interactive)
(if (pos-visible-in-window-p (point-max))
(Info-next-preorder)
- (scroll-up))
- )
+ (scroll-up)))
(defun Info-scroll-down ()
"Read the previous screen. If start of buffer is visible, go to last entry."
(interactive)
(if (pos-visible-in-window-p (point-min))
(Info-last-preorder)
- (scroll-down))
- )
+ (scroll-down)))
(defun Info-next-reference ()
"Move cursor to the next cross-reference or menu item in the node."
(t
(error "No %s around position %d" errorstring pos)))))))
-(defun Info-follow-nearest-node (click)
+(defun Info-mouse-follow-nearest-node (click)
"\\<Info-mode-map>Follow a node reference near point.
Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where you click.
-At end of the node's text, moves to the next node."
+At end of the node's text, moves to the next node, or up if none."
(interactive "e")
(let* ((start (event-start click))
(window (car start))
(pos (car (cdr start))))
(select-window window)
(goto-char pos))
+ (and (not (Info-try-follow-nearest-node))
+ (save-excursion (forward-line 1) (eobp))
+ (Info-next-preorder)))
+
+(defun Info-follow-nearest-node ()
+ "\\<Info-mode-map>Follow a node reference near point.
+Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where point is.
+If no reference to follow, moves to the next node, or up if none."
+ (interactive)
+ (or (Info-try-follow-nearest-node)
+ (Info-next-preorder)))
+
+;; Common subroutine.
+(defun Info-try-follow-nearest-node ()
+ "Follow a node reference near point. Return non-nil if successful."
(let (node)
(cond
- ((setq node (Info-get-token (point) "\\*note[ \n]" "\\*note[ \n]\\([^:]*\\):"))
+ ((setq node (Info-get-token (point) "\\*note[ \n]"
+ "\\*note[ \n]\\([^:]*\\):"))
(Info-follow-reference node))
((setq node (Info-get-token (point) "\\* " "\\* \\([^:]*\\)::"))
(Info-goto-node node))
((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)"))
(Info-goto-node "Top"))
((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)"))
- (Info-goto-node node))
- ((save-excursion (forward-line 1) (eobp))
- (Info-next)))
- ))
+ (Info-goto-node node)))
+ node))
\f
(defvar Info-mode-map nil
"Keymap containing Info commands.")
(suppress-keymap Info-mode-map)
(define-key Info-mode-map "." 'beginning-of-buffer)
(define-key Info-mode-map " " 'Info-scroll-up)
- (define-key Info-mode-map "\C-m" 'Info-next-preorder)
+ (define-key Info-mode-map "\C-m" 'Info-follow-nearest-node)
(define-key Info-mode-map "\t" 'Info-next-reference)
(define-key Info-mode-map "\e\t" 'Info-prev-reference)
(define-key Info-mode-map "1" 'Info-nth-menu-item)
(define-key Info-mode-map "u" 'Info-up)
(define-key Info-mode-map "," 'Info-index-next)
(define-key Info-mode-map "\177" 'Info-scroll-down)
- (define-key Info-mode-map [mouse-2] 'Info-follow-nearest-node)
+ (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node)
)
\f
;; Info mode is suitable only for specially formatted data.