(Info-goto-node file)
(Info-goto-node (concat "(" file ")")))
(if (zerop (buffer-size))
- (Info-directory))))
+ (Info-directory))))
;;;###autoload
(defun info-emacs-manual ()
(if (stringp filename)
(let (temp temp-downcase found)
(setq filename (substitute-in-file-name filename))
- (cond
+ (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 `./'
(Info-insert-dir))
((eq filename 'apropos)
(insert-buffer-substring " *info-apropos*"))
- ((eq filename 'history)
- (insert-buffer-substring " *info-history*"))
- ((eq filename 'toc)
- (insert-buffer-substring " *info-toc*"))
(t
(info-insert-file-contents filename nil)
(setq default-directory (file-name-directory filename))))
(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.
(when pos
(goto-char pos)
(throw 'foo t))
- ;; No such anchor in tag table or node in tag table or file
- (error "No such node or anchor: %s" nodename)))
+ (error "No such anchor in tag table or node in tag table or file: %s"
+ nodename)))
(Info-select-node)
(goto-char (point-min))
nodename end)
(re-search-backward "^\^_")
(search-forward "Node: ")
- (setq nodename (Info-following-node-name))
+ (setq nodename
+ (and (looking-at (Info-following-node-name-re))
+ (match-string 1)))
(search-forward "\n\^_" nil 'move)
(beginning-of-line)
(setq end (point))
(if fork
(set-buffer
(clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t)))
+ (if (member (buffer-name) '("*info-history*" "*info-toc*"))
+ (switch-to-buffer "*info*"))
(let (filename)
(string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
nodename)
(interactive)
(Info-find-node "dir" "top"))
\f
+;;;###autoload (add-hook 'same-window-buffer-names "*info-history*")
+
(defun Info-history ()
- "Go to a node with a menu of visited nodes."
+ "Create the buffer *info-history* with a menu of visited nodes."
(interactive)
(let ((curr-file Info-current-file)
(curr-node Info-current-node)
p)
- (with-current-buffer (get-buffer-create " *info-history*")
- (let ((inhibit-read-only t))
- (erase-buffer)
- (goto-char (point-min))
- (insert "\n\1f\nFile: history Node: Top, Up: (dir)\n\n")
- (insert "Recently Visited Nodes\n**********************\n\n")
- (insert "* Menu:\n\n")
- (let ((hl (delete '("history" "Top") Info-history-list)))
- (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))
- (setq p (point)))
- (insert "* " node ": (" (file-name-nondirectory file)
- ")" node ".\n"))
- (setq hl (cdr hl))))))
- (Info-find-node "history" "Top")
+ (pop-to-buffer
+ (with-current-buffer (get-buffer-create "*info-history*")
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (goto-char (point-min))
+ (insert "Node: History\n\n")
+ (insert "Recently Visited Nodes\n**********************\n\n")
+ (insert "* Menu:\n\n")
+ (let ((hl Info-history-list))
+ (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))
+ (setq p (point)))
+ (insert "* " node ": (" (file-name-nondirectory file)
+ ")" node ".\n"))
+ (setq hl (cdr hl))))
+ (or (eq major-mode 'Info-mode) (Info-mode))
+ (setq Info-current-file "info-history")
+ (setq Info-current-node "Info History")
+ (Info-set-mode-line)
+ (if (not (bobp)) (Info-fontify-node))
+ (current-buffer))))
(goto-char (or p (point-min)))))
+;;;###autoload (add-hook 'same-window-buffer-names "*info-toc*")
+
(defun Info-toc ()
- "Go to a node with table of contents of the current Info file."
+ "Create the buffer *info-toc* with Info file's table of contents."
(interactive)
(let ((curr-file Info-current-file)
(curr-node 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\1f\nFile: toc Node: Top, Up: (dir)\n\n")
- (insert "Table of Contents\n*****************\n\n")
- (insert "*Note Top::\n")
- (Info-insert-toc
- (nth 2 (assoc "Top" node-list)) ; get Top nodes
- node-list 0 (file-name-nondirectory curr-file)))
- (if (not (bobp))
- (let ((Info-hide-note-references 'hide)
- (Info-fontify-visited-nodes nil))
- (Info-fontify-node)))
- (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")
+ (pop-to-buffer
+ (with-current-buffer (get-buffer-create "*info-toc*")
+ (if (not (equal Info-current-file curr-file))
+ (let ((inhibit-read-only t)
+ (node-list (Info-build-toc curr-file)))
+ (erase-buffer)
+ (goto-char (point-min))
+ (insert "Node: Contents\n\n")
+ (insert "Table of Contents\n*****************\n\n")
+ (insert "*Note Top::\n")
+ (Info-insert-toc
+ (nth 2 (assoc "Top" node-list)) ; get Top nodes
+ node-list 0)
+ (or (eq major-mode 'Info-mode) (Info-mode))
+ (setq Info-current-file curr-file)
+ (setq Info-current-node "Contents")
+ (Info-set-mode-line)))
+ (if (not (bobp))
+ (let ((Info-hide-note-references 'hide))
+ (Info-fontify-node)))
+ (goto-char (point-min))
+ (if (setq p (search-forward (concat "*Note " curr-node "::") nil t))
+ (setq p (- p (length curr-node) 2)))
+ (current-buffer)))
(goto-char (or p (point-min)))))
-(defun Info-insert-toc (nodes node-list level curr-file)
+(defun Info-insert-toc (nodes node-list level)
"Insert table of contents with references to nodes."
(let ((section "Top"))
(while nodes
(unless (member (nth 1 node) (list nil section))
(insert (setq section (nth 1 node)) "\n"))
(insert (make-string level ?\t))
- (insert "*Note " (car nodes) ": (" curr-file ")" (car nodes) ".\n")
- (Info-insert-toc (nth 2 node) node-list (1+ level) curr-file)
+ (insert "*Note " (car nodes) "::\n")
+ (Info-insert-toc (nth 2 node) node-list (1+ level))
(setq nodes (cdr nodes))))))
(defun Info-build-toc (file)
nodes whose names also contain the word \"Index\".
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.
+Use the `,' command to see the other matches.
Give a blank topic name to go to the Index node itself."
(interactive
(list
(Info-index-next 0)))))
(defun Info-index-next (num)
- "Go to the next matching index item from the last \\<Info-mode-map>\\[Info-index] command."
+ "Go to the next matching index item from the last `i' command."
(interactive "p")
(or Info-index-alternatives
(error "No previous `i' command"))
(ohist-list Info-history-list)
(current-node Info-current-node)
(current-file Info-current-file)
- manuals matches node)
+ manuals matches temp-file node)
(let ((Info-fontify-maximum-menu-size 0)
Info-use-header-lines
Info-hide-note-references)
\\[Info-history] Go to the history buffer.
\\[Info-toc] Go to the buffer with a table of contents.
\\[Info-index] Look up a topic in this file's Index and move to that node.
-\\[Info-index-next] (comma) Move to the next match from a previous \\<Info-mode-map>\\[Info-index] command.
+\\[Info-index-next] (comma) Move to the next match from a previous `i' command.
\\[Info-top-node] Go to the Top node of this file.
\\[Info-final-node] Go to the final node in this file.
\\[Info-backward-node] Go backward one node, considering all nodes as forming one sequence.
\\[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.
+ from a previous `Info-search' command.
\\[Info-next-reference] Move cursor to next cross-reference or menu item.
\\[Info-prev-reference] Move cursor to previous cross-reference or menu item."
(kill-all-local-variables)
;; This is for the sake of the invisible text we use handling titles.
(make-local-variable 'line-move-ignore-invisible)
(setq line-move-ignore-invisible t)
+ (make-local-variable 'desktop-buffer-misc-data-function)
+ (setq desktop-buffer-misc-data-function 'Info-desktop-buffer-misc-data)
(add-hook 'clone-buffer-hook 'Info-clone-buffer-hook nil t)
(add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
(Info-set-mode-line)
;; Get Info running, and pop to it in another window.
(save-window-excursion
(info))
- (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
+ ;; FIXME It would be cool if this could use a buffer other
+ ;; than *info*.
+ (pop-to-buffer "*info*")
;; Bind Info-history to nil, to prevent the last Index node
;; visited by Info-find-emacs-command-nodes from being
;; pushed onto the history.
(add-text-properties (match-beginning 3) (match-end 3)
'(invisible t front-sticky nil rear-nonsticky t))
;; Unhide the file name of the external reference in parens
- (if (and (match-string 6) (not (eq Info-hide-note-references 'hide)))
+ (if (match-string 6)
(remove-text-properties (match-beginning 6) (match-end 6)
'(invisible t front-sticky nil rear-nonsticky t)))
;; Unhide newline because hidden newlines cause too long lines
(save-match-data
- (let ((beg3 (match-beginning 3))
- (end3 (match-end 3)))
- (if (and (string-match "\n[ \t]*" (match-string 3))
- (not (save-match-data
- (save-excursion
- (goto-char (1+ end3))
- (looking-at "[.)]*$")))))
- (remove-text-properties (+ beg3 (match-beginning 0))
- (+ beg3 (match-end 0))
+ (let ((start3 (match-beginning 3)))
+ (if (string-match "\n[ \t]*" (match-string 3))
+ (remove-text-properties (+ start3 (match-beginning 0)) (+ start3 (match-end 0))
'(invisible t front-sticky nil rear-nonsticky t))))))
(when (and Info-refill-paragraphs Info-hide-note-references)
(push (set-marker (make-marker) start)
"^No \".*\" in index$"))
(add-to-list 'debug-ignored-errors mess))
+;;;; Desktop support
+
+(defun Info-desktop-buffer-misc-data (desktop-dirname)
+ "Auxiliary information to be saved in desktop file."
+ (list Info-current-file Info-current-node))
+
+;;;###autoload
+(defun Info-restore-desktop-buffer (desktop-buffer-file-name
+ desktop-buffer-name
+ desktop-buffer-misc)
+ "Restore an info buffer specified in a desktop file."
+ (let ((first (nth 0 desktop-buffer-misc))
+ (second (nth 1 desktop-buffer-misc)))
+ (when (and first second)
+ (with-no-warnings
+ (Info-find-node first second))
+ (current-buffer))))
+
(provide 'info)
;;; arch-tag: f2480fe2-2139-40c1-a49b-6314991164ac