;;; info.el --- info package for Emacs
;; Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-;; 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: help
(put 'info-menu-5 'face-alias 'info-menu-star)
(defface info-xref
- '((((min-colors 88)
- (class color) (background light)) :foreground "blue1" :underline t)
- (((class color) (background light)) :foreground "blue" :underline t)
- (((min-colors 88)
- (class color) (background dark)) :foreground "cyan1" :underline t)
- (((class color) (background dark)) :foreground "cyan" :underline t)
- (t :underline t))
- "Face for Info cross-references."
+ '((t :inherit link))
+ "Face for unvisited Info cross-references."
:group 'info)
(defface info-xref-visited
- '((default :inherit info-xref)
- (((class color) (background light)) :foreground "magenta4")
- (((class color) (background dark)) :foreground "violet"))
+ '((t :inherit (link-visited info-xref)))
"Face for visited Info cross-references."
+ :version "22.1"
:group 'info)
(defcustom Info-fontify-visited-nodes t
(cond
((string= (downcase filename) "dir")
(setq found t))
- ((string= filename "apropos")
- (setq found 'apropos))
- ((string= filename "history")
- (setq found 'history))
- ((string= filename "toc")
- (setq found 'toc))
(t
(let ((dirs (if (string-match "^\\./" filename)
;; If specified name starts with `./'
(if noerror
(setq filename nil)
(error "Info file %s does not exist" filename)))
- filename)))
+ filename)
+ (and (member filename '(apropos history toc)) filename)))
(defun Info-find-node (filename nodename &optional no-going-back)
"Go to an Info node specified as separate FILENAME and NODENAME.
(setq Info-current-file
(cond
((eq filename t) "dir")
- ((eq filename 'apropos) "apropos")
- ((eq filename 'history) "history")
- ((eq filename 'toc) "toc")
(t filename)))
))
;; Use string-equal, not equal, to ignore text props.
(point)
(if (re-search-forward "^[^* \n\t]" nil t)
(match-beginning 0)
- (or limit (point-max)))) entries))))
+ (or limit (point-max))))
+ entries)
+ (forward-line 0))))
;; Insert the entries just found.
(while (= (line-beginning-position 0) (1- (point)))
(backward-char))
;; Now remove duplicate entries under the same heading.
(let ((seen nil)
- (limit (point)))
+ (limit (point-marker)))
(goto-char start)
- (while (re-search-forward "^* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)"
- limit 'move)
+ (while (and (> limit (point))
+ (re-search-forward "^* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)"
+ limit 'move))
;; Fold case straight away; `member-ignore-case' here wasteful.
(let ((x (downcase (match-string 1))))
(if (member x seen)
(concat
" ("
(if (stringp Info-current-file)
- (file-name-nondirectory Info-current-file)
- "")
+ (replace-regexp-in-string
+ "%" "%%" (file-name-nondirectory Info-current-file))
+ (format "*%S*" Info-current-file))
") "
(if Info-current-node
- (propertize Info-current-node
+ (propertize (replace-regexp-in-string
+ "%" "%%" Info-current-node)
'face 'mode-line-buffer-id
'help-echo
"mouse-1: scroll forward, mouse-3: scroll back"
;; Skip Tag Table node
(save-excursion
(and (search-backward "\^_" nil t)
- (looking-at "\^_\nTag Table"))))))
- (let ((search-spaces-regexp Info-search-whitespace-regexp))
+ (looking-at
+ "\^_\n\\(Tag Table\\|Local Variables\\)"))))))
+ (let ((search-spaces-regexp
+ (if (or (not isearch-mode) isearch-regexp)
+ Info-search-whitespace-regexp)))
(if (if backward
(re-search-backward regexp bound t)
(re-search-forward regexp bound t))
;; If no subfiles, give error now.
(if give-up
(if (null Info-current-subfile)
- (let ((search-spaces-regexp Info-search-whitespace-regexp))
+ (let ((search-spaces-regexp
+ (if (or (not isearch-mode) isearch-regexp)
+ Info-search-whitespace-regexp)))
(if backward
(re-search-backward regexp)
(re-search-forward regexp)))
;; Skip Tag Table node
(save-excursion
(and (search-backward "\^_" nil t)
- (looking-at "\^_\nTag Table"))))))
- (let ((search-spaces-regexp Info-search-whitespace-regexp))
+ (looking-at
+ "\^_\n\\(Tag Table\\|Local Variables\\)"))))))
+ (let ((search-spaces-regexp
+ (if (or (not isearch-mode) isearch-regexp)
+ Info-search-whitespace-regexp)))
(if (if backward
(re-search-backward regexp nil t)
(re-search-forward regexp nil t))
(defun Info-isearch-push-state ()
`(lambda (cmd)
- (Info-isearch-pop-state cmd ,Info-current-file ,Info-current-node)))
+ (Info-isearch-pop-state cmd ',Info-current-file ',Info-current-node)))
(defun Info-isearch-pop-state (cmd file node)
- (or (and (string= Info-current-file file)
- (string= Info-current-node node))
+ (or (and (equal Info-current-file file)
+ (equal Info-current-node node))
(progn (Info-find-node file node) (sit-for 0))))
(defun Info-isearch-start ()
(forward-line 1)
(cond ((re-search-backward
(concat name ":" (Info-following-node-name-re)) bound t)
- (match-string 1))
+ (match-string-no-properties 1))
((not (eq errorname t))
(error "Node has no %s"
(capitalize (or errorname name)))))))))
;;; For compatibility; other files have used this name.
(defun Info-following-node-name ()
(and (looking-at (Info-following-node-name-re))
- (match-string 1)))
+ (match-string-no-properties 1)))
(defun Info-next ()
"Go to the next node of this node."
(Info-goto-node node)
(setq p (point))
(goto-char (point-min))
- (if (and (search-forward "\n* Menu:" nil t)
+ (if (and (stringp old-file)
+ (search-forward "\n* Menu:" nil t)
(re-search-forward
(if (string-equal old-node "Top")
(concat "\n\\*[^:]+: +(" (file-name-nondirectory old-file) ")")
(while hl
(let ((file (nth 0 (car hl)))
(node (nth 1 (car hl))))
- (if (and (string-equal file curr-file)
- (string-equal node curr-node))
+ (if (and (equal file curr-file)
+ (equal node curr-node))
(setq p (point)))
- (insert "* " node ": ("
- (propertize (or (file-name-directory file) "") 'invisible t)
- (file-name-nondirectory file)
- ")" node ".\n"))
+ (if (stringp file)
+ (insert "* " node ": ("
+ (propertize (or (file-name-directory file) "") 'invisible t)
+ (file-name-nondirectory file)
+ ")" node ".\n")))
(setq hl (cdr hl))))))
- (Info-find-node "history" "Top")
+ (Info-find-node 'history "Top")
(goto-char (or p (point-min)))))
(defun Info-toc ()
"Go to a node with table of contents of the current Info file.
Table of contents is created from the tree structure of menus."
(interactive)
- (let ((curr-file (substring-no-properties Info-current-file))
- (curr-node (substring-no-properties Info-current-node))
- p)
- (with-current-buffer (get-buffer-create " *info-toc*")
- (let ((inhibit-read-only t)
- (node-list (Info-build-toc curr-file)))
- (erase-buffer)
- (goto-char (point-min))
- (insert "\n\^_\nFile: toc, Node: Top, Up: (dir)\n\n")
- (insert "Table of Contents\n*****************\n\n")
- (insert "*Note Top: (" curr-file ")Top.\n")
- (Info-insert-toc
- (nth 2 (assoc "Top" node-list)) ; get Top nodes
- node-list 0 curr-file))
- (if (not (bobp))
- (let ((Info-hide-note-references 'hide)
- (Info-fontify-visited-nodes nil))
- (Info-mode)
- (setq Info-current-file "toc" Info-current-node "Top")
- (goto-char (point-min))
- (narrow-to-region (or (re-search-forward "\n[\^_\f]\n" nil t)
- (point-min))
- (point-max))
- (Info-fontify-node)
- (widen)))
- (goto-char (point-min))
- (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
- (setq p (- p (length curr-node) 2))))
- (Info-find-node "toc" "Top")
- (goto-char (or p (point-min)))))
+ (if (stringp Info-current-file)
+ (let ((curr-file (substring-no-properties Info-current-file))
+ (curr-node (substring-no-properties Info-current-node))
+ p)
+ (with-current-buffer (get-buffer-create " *info-toc*")
+ (let ((inhibit-read-only t)
+ (node-list (Info-build-toc curr-file)))
+ (erase-buffer)
+ (goto-char (point-min))
+ (insert "\n\^_\nFile: toc, Node: Top, Up: (dir)\n\n")
+ (insert "Table of Contents\n*****************\n\n")
+ (insert "*Note Top: (" curr-file ")Top.\n")
+ (Info-insert-toc
+ (nth 2 (assoc "Top" node-list)) ; get Top nodes
+ node-list 0 curr-file))
+ (if (not (bobp))
+ (let ((Info-hide-note-references 'hide)
+ (Info-fontify-visited-nodes nil))
+ (Info-mode)
+ (setq Info-current-file 'toc Info-current-node "Top")
+ (goto-char (point-min))
+ (narrow-to-region (or (re-search-forward "\n[\^_\f]\n" nil t)
+ (point-min))
+ (point-max))
+ (Info-fontify-node)
+ (widen)))
+ (goto-char (point-min))
+ (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
+ (setq p (- p (length curr-node) 2))))
+ (Info-find-node 'toc "Top")
+ (goto-char (or p (point-min))))))
(defun Info-insert-toc (nodes node-list level curr-file)
"Insert table of contents with references to nodes."
(setq Info-point-loc
(if (match-beginning 5)
(string-to-number (match-string 5))
- (buffer-substring (match-beginning 0) (1- (match-beginning 1)))))
+ (buffer-substring-no-properties
+ (match-beginning 0) (1- (match-beginning 1)))))
;;; Uncomment next line to use names of cross-references in non-index nodes:
;;; (setq Info-point-loc
;;; (buffer-substring (match-beginning 0) (1- (match-beginning 1))))
)
(replace-regexp-in-string
"[ \n]+" " "
- (or (match-string 2)
+ (or (match-string-no-properties 2)
;; If the node name is the menu entry name (using `entry::').
- (buffer-substring (match-beginning 0) (1- (match-beginning 1)))))))
+ (buffer-substring-no-properties
+ (match-beginning 0) (1- (match-beginning 1)))))))
;; No one calls this.
;;(defun Info-menu-item-sequence (list)
(or file (setq file Info-current-file))
(or (assoc file Info-index-nodes)
;; Skip virtual Info files
- (and (member file '("dir" "history" "toc" "apropos"))
+ (and (member file '("dir" apropos history toc))
(setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
(not (stringp file))
(if Info-file-supports-index-cookies
;;;###autoload
(defun Info-index (topic)
- "Look up a string TOPIC in the index for this file.
+ "Look up a string TOPIC in the index for this manual and go to that entry.
If there are no exact matches to the specified topic, this chooses
the first match which is a case-insensitive substring of a topic.
Use the \\<Info-mode-map>\\[Info-index-next] command to see the other matches.
-Give a blank topic name to go to the Index node itself."
+Give an empty topic name to go to the Index node itself."
(interactive
(list
(let ((Info-complete-menu-buffer (clone-buffer))
(message "%s" (if (eq (car-safe err) 'error)
(nth 1 err) err))
(sit-for 1 t)))))
- (Info-goto-node (concat "(" current-file ")" current-node))
+ (Info-find-node current-file current-node)
(setq Info-history ohist
Info-history-list ohist-list)
(message "Searching indices...done")
(if (nth 3 entry)
(concat " (line " (nth 3 entry) ")")
"")))))
- (Info-find-node "apropos" "Index")
+ (Info-find-node 'apropos "Index")
(setq Info-complete-cache nil)))))
(defun Info-undefined ()
(defun Info-follow-nearest-node (&optional fork)
"Follow a node reference near point.
If point is on a reference, follow that reference. Otherwise,
-if point is in a menu item description, follow that menu item."
+if point is in a menu item description, follow that menu item.
+
+If FORK is non-nil (interactively with a prefix arg), show the node in
+a new Info buffer.
+If FORK is a string, it is the name to use for the new buffer."
(interactive "P")
(or (Info-try-follow-nearest-node fork)
(when (save-excursion
(interactive "P")
(unless Info-current-node
(error "No current Info node"))
- (let ((node (concat "(" (file-name-nondirectory Info-current-file) ")"
- Info-current-node)))
+ (let ((node (if (stringp Info-current-file)
+ (concat "(" (file-name-nondirectory Info-current-file) ")"
+ Info-current-node))))
(if (zerop (prefix-numeric-value arg))
(setq node (concat "(info \"" node "\")")))
+ (unless (stringp Info-current-file)
+ (setq node (format "(Info-find-node '%S '%S)"
+ Info-current-file Info-current-node)))
(kill-new node)
(message "%s" node)))
\\[Info-search-case-sensitively] Search through this Info file for specified regexp case-sensitively.
\\[Info-search-next] Search for another occurrence of regexp
from a previous \\<Info-mode-map>\\[Info-search] command.
-\\[Info-index] Look up a topic in this file's Index and move to that node.
+\\[Info-index] Search for a topic in this manual's Index and go to index entry.
\\[Info-index-next] (comma) Move to the next match from a previous \\<Info-mode-map>\\[Info-index] command.
\\[info-apropos] Look for a string in the indices of all manuals.
\\[Info-goto-node] Move to node specified by name.
"^[ \t]+" ""
(replace-regexp-in-string
"[ \t\n]+" " "
- (or (match-string 5)
+ (or (match-string-no-properties 5)
(and (not (equal (match-string 4) ""))
- (match-string 4))
- (match-string 2)))))
+ (match-string-no-properties 4))
+ (match-string-no-properties 2)))))
(external-link-p
(string-match "(\\([^)]+\\))\\([^)]*\\)" node))
(file (if external-link-p
(file-name-nondirectory
- (match-string 1 node))
+ (match-string-no-properties 1 node))
Info-current-file))
(hl Info-history-list)
res)
(if external-link-p
(setq node (if (equal (match-string 2 node) "")
"Top"
- (match-string 2 node))))
+ (match-string-no-properties 2 node))))
(while hl
(if (and (string-equal node (nth 1 (car hl)))
- (string-equal
- file (if external-link-p
- (file-name-nondirectory
- (caar hl))
- (caar hl))))
+ (equal file
+ (if (and external-link-p
+ (stringp (caar hl)))
+ (file-name-nondirectory
+ (caar hl))
+ (caar hl))))
(setq res (car hl) hl nil)
(setq hl (cdr hl))))
res))) 'info-xref-visited 'info-xref))
(if (and Info-fontify-visited-nodes
(save-match-data
(let* ((node (if (equal (match-string 3) "")
- (match-string 1)
- (match-string 3)))
+ (match-string-no-properties 1)
+ (match-string-no-properties 3)))
(external-link-p
(string-match "(\\([^)]+\\))\\([^)]*\\)" node))
(file (if external-link-p
(file-name-nondirectory
- (match-string 1 node))
+ (match-string-no-properties 1 node))
Info-current-file))
(hl Info-history-list)
res)
(if external-link-p
(setq node (if (equal (match-string 2 node) "")
"Top"
- (match-string 2 node))))
+ (match-string-no-properties 2 node))))
(while hl
(if (and (string-equal node (nth 1 (car hl)))
- (string-equal
- file (if external-link-p
- (file-name-nondirectory (caar hl))
- (caar hl))))
+ (equal file
+ (if (and external-link-p
+ (stringp (caar hl)))
+ (file-name-nondirectory
+ (caar hl))
+ (caar hl))))
(setq res (car hl) hl nil)
(setq hl (cdr hl))))
res))) 'info-xref-visited 'info-xref)))
(defun Info-desktop-buffer-misc-data (desktop-dirname)
"Auxiliary information to be saved in desktop file."
- (if (not (member Info-current-file '("apropos" "history" "toc")))
- (list Info-current-file Info-current-node)))
+ (unless (member Info-current-file '(apropos history toc nil))
+ (list Info-current-file Info-current-node)))
(defun Info-restore-desktop-buffer (desktop-buffer-file-name
desktop-buffer-name