;;; info.el --- info package for Emacs.
-;; Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: help
"*Non-nil enables highlighting and fonts in Info nodes.")
(defvar Info-directory-list
- (let ((path (getenv "INFOPATH")))
+ (let ((path (getenv "INFOPATH"))
+ (sibling (expand-file-name "../info/" (invocation-directory))))
(if path
(let ((list nil)
idx)
path (substring path (min (1+ idx)
(length path)))))
(nreverse list))
- Info-default-directory-list))
+ (if (or (member sibling Info-default-directory-list)
+ (not (file-exists-p sibling)))
+ Info-default-directory-list
+ (reverse (cons sibling (cdr (reverse Info-default-directory-list)))))))
"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'
;; Search the directory list for the directory file.
(while dirs
- (or (member (file-truename (expand-file-name (car dirs))) dirs-done)
- (member (directory-file-name (file-truename (expand-file-name (car dirs))))
- dirs-done)
- ;; Try several variants of specified name.
- ;; Try upcasing, appending `.info', or both.
- (let* (temp
- (buffer
- (cond
- ((progn (setq temp (expand-file-name "DIR" (car dirs)))
- (file-exists-p temp))
- (find-file-noselect temp))
- ((progn (setq temp (expand-file-name "dir" (car dirs)))
- (file-exists-p temp))
- (find-file-noselect temp))
- ((progn (setq temp (expand-file-name "DIR.INFO" (car dirs)))
- (file-exists-p temp))
- (find-file-noselect temp))
- ((progn (setq temp (expand-file-name "dir.info" (car dirs)))
- (file-exists-p temp))
- (find-file-noselect temp)))))
- (setq dirs-done
- (cons (file-truename (expand-file-name (car dirs)))
- (cons (directory-file-name
- (file-truename (expand-file-name (car dirs))))
- dirs-done)))
- (if buffer (setq buffers (cons buffer buffers)
- Info-dir-file-attributes
- (cons (cons (buffer-file-name buffer)
- (file-attributes (buffer-file-name buffer)))
- Info-dir-file-attributes)))))
+ (let ((truename (file-truename (expand-file-name (car dirs)))))
+ (or (member truename dirs-done)
+ (member (directory-file-name truename) dirs-done)
+ ;; Try several variants of specified name.
+ ;; Try upcasing, appending `.info', or both.
+ (let* (temp
+ (buffer
+ (cond
+ ((progn (setq temp (expand-file-name "DIR" (car dirs)))
+ (file-exists-p temp))
+ (find-file-noselect temp))
+ ((progn (setq temp (expand-file-name "dir" (car dirs)))
+ (file-exists-p temp))
+ (find-file-noselect temp))
+ ((progn (setq temp (expand-file-name "DIR.INFO" (car dirs)))
+ (file-exists-p temp))
+ (find-file-noselect temp))
+ ((progn (setq temp (expand-file-name "dir.info" (car dirs)))
+ (file-exists-p temp))
+ (find-file-noselect temp)))))
+ (setq dirs-done
+ (cons truename
+ (cons (directory-file-name truename)
+ dirs-done)))
+ (if buffer (setq buffers (cons buffer buffers)
+ Info-dir-file-attributes
+ (cons (cons (buffer-file-name buffer)
+ (file-attributes (buffer-file-name buffer)))
+ Info-dir-file-attributes))))))
(setq dirs (cdr dirs)))
;; Distinguish the dir file that comes with Emacs from all the
(re-search-forward (concat "^\\* " (regexp-quote nodename) ":")
end t)
(progn
- (insert "* " nodename "\n")
+ (insert "* " nodename "::" "\n")
(setq menu-items (cons nodename menu-items)))))
(setq nodes (cdr nodes))))
;; Now take each node of each of the other buffers
NAME may be an abbreviation of the reference name."
(interactive
(let ((completion-ignore-case t)
- completions default (start-point (point)) str i)
+ completions default alt-default (start-point (point)) str i bol eol)
(save-excursion
+ ;; Store end and beginning of line.
+ (end-of-line)
+ (setq eol (point))
+ (beginning-of-line)
+ (setq bol (point))
+
(goto-char (point-min))
(while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t)
(setq str (buffer-substring
(1- (point))))
;; See if this one should be the default.
(and (null default)
- (< (match-beginning 0) start-point)
+ (<= (match-beginning 0) start-point)
(<= start-point (point))
(setq default t))
+ ;; See if this one should be the alternate default.
+ (and (null alt-default)
+ (and (<= bol (match-beginning 0))
+ (<= (point) eol))
+ (setq alt-default t))
(setq i 0)
(while (setq i (string-match "[ \n\t]+" str i))
(setq str (concat (substring str 0 i) " "
(setq i (1+ i)))
;; Record as a completion and perhaps as default.
(if (eq default t) (setq default str))
+ (if (eq alt-default t) (setq alt-default str))
(setq completions
(cons (cons str nil)
completions))))
+ ;; If no good default was found, try an alternate.
+ (or default
+ (setq default alt-default))
+ ;; If only one cross-reference found, then make it default.
+ (if (eq (length completions) 1)
+ (setq default (car (car completions))))
(if completions
(let ((input (completing-read (if default
(concat "Follow reference named: ("
(goto-char (point-min))
(or (search-forward "\n* menu:" nil t)
(error "No menu in this node"))
- (or (re-search-forward (concat "\n* " menu-item ":") nil t)
- (re-search-forward (concat "\n* " menu-item) nil t)
+ (or (re-search-forward (concat "\n\\* " menu-item ":") nil t)
+ (re-search-forward (concat "\n\\* " menu-item) nil t)
(error "No such item in menu"))
(beginning-of-line)
(forward-char 2)
\\[Info-index-next] (comma) Move to the next match from a previous `i' command.
Moving within a node:
-\\[scroll-up] Normally, scroll forward a full screen. If the end of the buffer is
+\\[Info-scroll-up] Normally, scroll forward a full screen. If the end of the buffer is
already visible, try to go to the next menu entry, or up if there is none.
-\\[scroll-down] Normally, scroll backward. If the beginning of the buffer is
+\\[Info-scroll-down] Normally, scroll backward. If the beginning of the buffer is
already visible, try to go to the previous menu entry, or up if there is none.
\\[beginning-of-buffer] Go to beginning of node.
;; Make mode line update.
(set-buffer-modified-p (buffer-modified-p))
(message (substitute-command-keys
- "Editing: Type \\<Info-mode-map>\\[Info-cease-edit] to return to info")))
+ "Editing: Type \\<Info-edit-map>\\[Info-cease-edit] to return to info")))
(defun Info-cease-edit ()
"Finish editing Info node; switch back to Info proper."
;;;###autoload
(defun Info-goto-emacs-command-node (command)
- "Go to the Info node in the Emacs manual for command COMMAND."
+ "Go to the Info node in the Emacs manual for command COMMAND.
+The command is found by looking up in Emacs manual's Command Index."
(interactive "CFind documentation for command: ")
(or (commandp command)
(signal 'wrong-type-argument (list 'commandp command)))
;;;###autoload
(defun Info-goto-emacs-key-command-node (key)
"Go to the Info node in the Emacs manual the command bound to KEY, a string.
-Interactively, if the binding is execute-extended-command, a command is read."
+Interactively, if the binding is execute-extended-command, a command is read.
+The command is found by looking up in Emacs manual's Command Index."
(interactive "kFind documentation for key:")
(let ((command (key-binding key)))
(cond ((null command)