aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/info.el151
1 files changed, 73 insertions, 78 deletions
diff --git a/lisp/info.el b/lisp/info.el
index c67a1a5f0c7..5fd9af31202 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -480,7 +480,7 @@ in all the directories in that path."
480 (Info-goto-node file) 480 (Info-goto-node file)
481 (Info-goto-node (concat "(" file ")"))) 481 (Info-goto-node (concat "(" file ")")))
482 (if (zerop (buffer-size)) 482 (if (zerop (buffer-size))
483 (Info-directory)))) 483 (Info-directory))))
484 484
485;;;###autoload 485;;;###autoload
486(defun info-emacs-manual () 486(defun info-emacs-manual ()
@@ -535,11 +535,15 @@ just return nil (no error)."
535 (if (stringp filename) 535 (if (stringp filename)
536 (let (temp temp-downcase found) 536 (let (temp temp-downcase found)
537 (setq filename (substitute-in-file-name filename)) 537 (setq filename (substitute-in-file-name filename))
538 (cond 538 (cond
539 ((string= (downcase filename) "dir") 539 ((string= (downcase filename) "dir")
540 (setq found t)) 540 (setq found t))
541 ((string= filename "apropos") 541 ((string= filename "apropos")
542 (setq found 'apropos)) 542 (setq found 'apropos))
543 ((string= filename "history")
544 (setq found 'history))
545 ((string= filename "toc")
546 (setq found 'toc))
543 (t 547 (t
544 (let ((dirs (if (string-match "^\\./" filename) 548 (let ((dirs (if (string-match "^\\./" filename)
545 ;; If specified name starts with `./' 549 ;; If specified name starts with `./'
@@ -742,6 +746,10 @@ a case-insensitive match is tried."
742 (Info-insert-dir)) 746 (Info-insert-dir))
743 ((eq filename 'apropos) 747 ((eq filename 'apropos)
744 (insert-buffer-substring " *info-apropos*")) 748 (insert-buffer-substring " *info-apropos*"))
749 ((eq filename 'history)
750 (insert-buffer-substring " *info-history*"))
751 ((eq filename 'toc)
752 (insert-buffer-substring " *info-toc*"))
745 (t 753 (t
746 (info-insert-file-contents filename nil) 754 (info-insert-file-contents filename nil)
747 (setq default-directory (file-name-directory filename)))) 755 (setq default-directory (file-name-directory filename))))
@@ -782,6 +790,8 @@ a case-insensitive match is tried."
782 (cond 790 (cond
783 ((eq filename t) "dir") 791 ((eq filename t) "dir")
784 ((eq filename 'apropos) "apropos") 792 ((eq filename 'apropos) "apropos")
793 ((eq filename 'history) "history")
794 ((eq filename 'toc) "toc")
785 (t filename))) 795 (t filename)))
786 )) 796 ))
787 ;; Use string-equal, not equal, to ignore text props. 797 ;; Use string-equal, not equal, to ignore text props.
@@ -843,8 +853,8 @@ a case-insensitive match is tried."
843 (when pos 853 (when pos
844 (goto-char pos) 854 (goto-char pos)
845 (throw 'foo t)) 855 (throw 'foo t))
846 (error "No such anchor in tag table or node in tag table or file: %s" 856 ;; No such anchor in tag table or node in tag table or file
847 nodename))) 857 (error "No such node or anchor: %s" nodename)))
848 858
849 (Info-select-node) 859 (Info-select-node)
850 (goto-char (point-min)) 860 (goto-char (point-min))
@@ -982,9 +992,7 @@ a case-insensitive match is tried."
982 nodename end) 992 nodename end)
983 (re-search-backward "^\^_") 993 (re-search-backward "^\^_")
984 (search-forward "Node: ") 994 (search-forward "Node: ")
985 (setq nodename 995 (setq nodename (Info-following-node-name))
986 (and (looking-at (Info-following-node-name-re))
987 (match-string 1)))
988 (search-forward "\n\^_" nil 'move) 996 (search-forward "\n\^_" nil 'move)
989 (beginning-of-line) 997 (beginning-of-line)
990 (setq end (point)) 998 (setq end (point))
@@ -1298,8 +1306,6 @@ If FORK is a string, it is the name to use for the new buffer."
1298 (if fork 1306 (if fork
1299 (set-buffer 1307 (set-buffer
1300 (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t))) 1308 (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t)))
1301 (if (member (buffer-name) '("*info-history*" "*info-toc*"))
1302 (switch-to-buffer "*info*"))
1303 (let (filename) 1309 (let (filename)
1304 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)" 1310 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
1305 nodename) 1311 nodename)
@@ -1616,75 +1622,60 @@ If SAME-FILE is non-nil, do not move to a different Info file."
1616 (interactive) 1622 (interactive)
1617 (Info-find-node "dir" "top")) 1623 (Info-find-node "dir" "top"))
1618 1624
1619;;;###autoload (add-hook 'same-window-buffer-names "*info-history*")
1620
1621(defun Info-history () 1625(defun Info-history ()
1622 "Create the buffer *info-history* with a menu of visited nodes." 1626 "Go to a node with a menu of visited nodes."
1623 (interactive) 1627 (interactive)
1624 (let ((curr-file Info-current-file) 1628 (let ((curr-file Info-current-file)
1625 (curr-node Info-current-node) 1629 (curr-node Info-current-node)
1626 p) 1630 p)
1627 (pop-to-buffer 1631 (with-current-buffer (get-buffer-create " *info-history*")
1628 (with-current-buffer (get-buffer-create "*info-history*") 1632 (let ((inhibit-read-only t))
1629 (let ((inhibit-read-only t)) 1633 (erase-buffer)
1630 (erase-buffer) 1634 (goto-char (point-min))
1631 (goto-char (point-min)) 1635 (insert "\n\nFile: history Node: Top, Up: (dir)\n\n")
1632 (insert "Node: History\n\n") 1636 (insert "Recently Visited Nodes\n**********************\n\n")
1633 (insert "Recently Visited Nodes\n**********************\n\n") 1637 (insert "* Menu:\n\n")
1634 (insert "* Menu:\n\n") 1638 (let ((hl (delete '("history" "Top") Info-history-list)))
1635 (let ((hl Info-history-list)) 1639 (while hl
1636 (while hl 1640 (let ((file (nth 0 (car hl)))
1637 (let ((file (nth 0 (car hl))) 1641 (node (nth 1 (car hl))))
1638 (node (nth 1 (car hl)))) 1642 (if (and (string-equal file curr-file)
1639 (if (and (string-equal file curr-file) 1643 (string-equal node curr-node))
1640 (string-equal node curr-node)) 1644 (setq p (point)))
1641 (setq p (point))) 1645 (insert "* " node ": (" (file-name-nondirectory file)
1642 (insert "* " node ": (" (file-name-nondirectory file) 1646 ")" node ".\n"))
1643 ")" node ".\n")) 1647 (setq hl (cdr hl))))))
1644 (setq hl (cdr hl)))) 1648 (Info-find-node "history" "Top")
1645 (or (eq major-mode 'Info-mode) (Info-mode))
1646 (setq Info-current-file "info-history")
1647 (setq Info-current-node "Info History")
1648 (Info-set-mode-line)
1649 (if (not (bobp)) (Info-fontify-node))
1650 (current-buffer))))
1651 (goto-char (or p (point-min))))) 1649 (goto-char (or p (point-min)))))
1652 1650
1653;;;###autoload (add-hook 'same-window-buffer-names "*info-toc*")
1654
1655(defun Info-toc () 1651(defun Info-toc ()
1656 "Create the buffer *info-toc* with Info file's table of contents." 1652 "Go to a node with table of contents of the current Info file."
1657 (interactive) 1653 (interactive)
1658 (let ((curr-file Info-current-file) 1654 (let ((curr-file Info-current-file)
1659 (curr-node Info-current-node) 1655 (curr-node Info-current-node)
1660 p) 1656 p)
1661 (pop-to-buffer 1657 (with-current-buffer (get-buffer-create " *info-toc*")
1662 (with-current-buffer (get-buffer-create "*info-toc*") 1658 (let ((inhibit-read-only t)
1663 (if (not (equal Info-current-file curr-file)) 1659 (node-list (Info-build-toc curr-file)))
1664 (let ((inhibit-read-only t) 1660 (erase-buffer)
1665 (node-list (Info-build-toc curr-file))) 1661 (goto-char (point-min))
1666 (erase-buffer) 1662 (insert "\n\nFile: toc Node: Top, Up: (dir)\n\n")
1667 (goto-char (point-min)) 1663 (insert "Table of Contents\n*****************\n\n")
1668 (insert "Node: Contents\n\n") 1664 (insert "*Note Top::\n")
1669 (insert "Table of Contents\n*****************\n\n") 1665 (Info-insert-toc
1670 (insert "*Note Top::\n") 1666 (nth 2 (assoc "Top" node-list)) ; get Top nodes
1671 (Info-insert-toc 1667 node-list 0 (file-name-nondirectory curr-file)))
1672 (nth 2 (assoc "Top" node-list)) ; get Top nodes 1668 (if (not (bobp))
1673 node-list 0) 1669 (let ((Info-hide-note-references 'hide)
1674 (or (eq major-mode 'Info-mode) (Info-mode)) 1670 (Info-fontify-visited-nodes nil))
1675 (setq Info-current-file curr-file) 1671 (Info-fontify-node)))
1676 (setq Info-current-node "Contents") 1672 (goto-char (point-min))
1677 (Info-set-mode-line))) 1673 (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
1678 (if (not (bobp)) 1674 (setq p (- p (length curr-node) 2))))
1679 (let ((Info-hide-note-references 'hide)) 1675 (Info-find-node "toc" "Top")
1680 (Info-fontify-node)))
1681 (goto-char (point-min))
1682 (if (setq p (search-forward (concat "*Note " curr-node "::") nil t))
1683 (setq p (- p (length curr-node) 2)))
1684 (current-buffer)))
1685 (goto-char (or p (point-min))))) 1676 (goto-char (or p (point-min)))))
1686 1677
1687(defun Info-insert-toc (nodes node-list level) 1678(defun Info-insert-toc (nodes node-list level curr-file)
1688 "Insert table of contents with references to nodes." 1679 "Insert table of contents with references to nodes."
1689 (let ((section "Top")) 1680 (let ((section "Top"))
1690 (while nodes 1681 (while nodes
@@ -1692,8 +1683,8 @@ If SAME-FILE is non-nil, do not move to a different Info file."
1692 (unless (member (nth 1 node) (list nil section)) 1683 (unless (member (nth 1 node) (list nil section))
1693 (insert (setq section (nth 1 node)) "\n")) 1684 (insert (setq section (nth 1 node)) "\n"))
1694 (insert (make-string level ?\t)) 1685 (insert (make-string level ?\t))
1695 (insert "*Note " (car nodes) "::\n") 1686 (insert "*Note " (car nodes) ": (" curr-file ")" (car nodes) ".\n")
1696 (Info-insert-toc (nth 2 node) node-list (1+ level)) 1687 (Info-insert-toc (nth 2 node) node-list (1+ level) curr-file)
1697 (setq nodes (cdr nodes)))))) 1688 (setq nodes (cdr nodes))))))
1698 1689
1699(defun Info-build-toc (file) 1690(defun Info-build-toc (file)
@@ -2320,7 +2311,7 @@ name contains the word \"Index\", plus any immediately following
2320nodes whose names also contain the word \"Index\". 2311nodes whose names also contain the word \"Index\".
2321If there are no exact matches to the specified topic, this chooses 2312If there are no exact matches to the specified topic, this chooses
2322the first match which is a case-insensitive substring of a topic. 2313the first match which is a case-insensitive substring of a topic.
2323Use the `,' command to see the other matches. 2314Use the \\<Info-mode-map>\\[Info-index-next] command to see the other matches.
2324Give a blank topic name to go to the Index node itself." 2315Give a blank topic name to go to the Index node itself."
2325 (interactive 2316 (interactive
2326 (list 2317 (list
@@ -2375,7 +2366,7 @@ Give a blank topic name to go to the Index node itself."
2375 (Info-index-next 0))))) 2366 (Info-index-next 0)))))
2376 2367
2377(defun Info-index-next (num) 2368(defun Info-index-next (num)
2378 "Go to the next matching index item from the last `i' command." 2369 "Go to the next matching index item from the last \\<Info-mode-map>\\[Info-index] command."
2379 (interactive "p") 2370 (interactive "p")
2380 (or Info-index-alternatives 2371 (or Info-index-alternatives
2381 (error "No previous `i' command")) 2372 (error "No previous `i' command"))
@@ -2433,7 +2424,7 @@ Build a menu of the possible matches."
2433 (ohist-list Info-history-list) 2424 (ohist-list Info-history-list)
2434 (current-node Info-current-node) 2425 (current-node Info-current-node)
2435 (current-file Info-current-file) 2426 (current-file Info-current-file)
2436 manuals matches temp-file node) 2427 manuals matches node)
2437 (let ((Info-fontify-maximum-menu-size 0) 2428 (let ((Info-fontify-maximum-menu-size 0)
2438 Info-use-header-lines 2429 Info-use-header-lines
2439 Info-hide-note-references) 2430 Info-hide-note-references)
@@ -2855,7 +2846,7 @@ Selecting other nodes:
2855\\[Info-history] Go to the history buffer. 2846\\[Info-history] Go to the history buffer.
2856\\[Info-toc] Go to the buffer with a table of contents. 2847\\[Info-toc] Go to the buffer with a table of contents.
2857\\[Info-index] Look up a topic in this file's Index and move to that node. 2848\\[Info-index] Look up a topic in this file's Index and move to that node.
2858\\[Info-index-next] (comma) Move to the next match from a previous `i' command. 2849\\[Info-index-next] (comma) Move to the next match from a previous \\<Info-mode-map>\\[Info-index] command.
2859\\[Info-top-node] Go to the Top node of this file. 2850\\[Info-top-node] Go to the Top node of this file.
2860\\[Info-final-node] Go to the final node in this file. 2851\\[Info-final-node] Go to the final node in this file.
2861\\[Info-backward-node] Go backward one node, considering all nodes as forming one sequence. 2852\\[Info-backward-node] Go backward one node, considering all nodes as forming one sequence.
@@ -2886,7 +2877,7 @@ Advanced commands:
2886\\[Info-search-case-sensitively] Search through this Info file 2877\\[Info-search-case-sensitively] Search through this Info file
2887 for specified regexp case-sensitively. 2878 for specified regexp case-sensitively.
2888\\[Info-search-next] Search for another occurrence of regexp 2879\\[Info-search-next] Search for another occurrence of regexp
2889 from a previous `Info-search' command. 2880 from a previous \\<Info-mode-map>\\[Info-search] command.
2890\\[Info-next-reference] Move cursor to next cross-reference or menu item. 2881\\[Info-next-reference] Move cursor to next cross-reference or menu item.
2891\\[Info-prev-reference] Move cursor to previous cross-reference or menu item." 2882\\[Info-prev-reference] Move cursor to previous cross-reference or menu item."
2892 (kill-all-local-variables) 2883 (kill-all-local-variables)
@@ -3080,9 +3071,7 @@ COMMAND must be a symbol or string."
3080 ;; Get Info running, and pop to it in another window. 3071 ;; Get Info running, and pop to it in another window.
3081 (save-window-excursion 3072 (save-window-excursion
3082 (info)) 3073 (info))
3083 ;; FIXME It would be cool if this could use a buffer other 3074 (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
3084 ;; than *info*.
3085 (pop-to-buffer "*info*")
3086 ;; Bind Info-history to nil, to prevent the last Index node 3075 ;; Bind Info-history to nil, to prevent the last Index node
3087 ;; visited by Info-find-emacs-command-nodes from being 3076 ;; visited by Info-find-emacs-command-nodes from being
3088 ;; pushed onto the history. 3077 ;; pushed onto the history.
@@ -3377,14 +3366,20 @@ Preserve text properties."
3377 (add-text-properties (match-beginning 3) (match-end 3) 3366 (add-text-properties (match-beginning 3) (match-end 3)
3378 '(invisible t front-sticky nil rear-nonsticky t)) 3367 '(invisible t front-sticky nil rear-nonsticky t))
3379 ;; Unhide the file name of the external reference in parens 3368 ;; Unhide the file name of the external reference in parens
3380 (if (match-string 6) 3369 (if (and (match-string 6) (not (eq Info-hide-note-references 'hide)))
3381 (remove-text-properties (match-beginning 6) (match-end 6) 3370 (remove-text-properties (match-beginning 6) (match-end 6)
3382 '(invisible t front-sticky nil rear-nonsticky t))) 3371 '(invisible t front-sticky nil rear-nonsticky t)))
3383 ;; Unhide newline because hidden newlines cause too long lines 3372 ;; Unhide newline because hidden newlines cause too long lines
3384 (save-match-data 3373 (save-match-data
3385 (let ((start3 (match-beginning 3))) 3374 (let ((beg3 (match-beginning 3))
3386 (if (string-match "\n[ \t]*" (match-string 3)) 3375 (end3 (match-end 3)))
3387 (remove-text-properties (+ start3 (match-beginning 0)) (+ start3 (match-end 0)) 3376 (if (and (string-match "\n[ \t]*" (match-string 3))
3377 (not (save-match-data
3378 (save-excursion
3379 (goto-char (1+ end3))
3380 (looking-at "[.)]*$")))))
3381 (remove-text-properties (+ beg3 (match-beginning 0))
3382 (+ beg3 (match-end 0))
3388 '(invisible t front-sticky nil rear-nonsticky t)))))) 3383 '(invisible t front-sticky nil rear-nonsticky t))))))
3389 (when (and Info-refill-paragraphs Info-hide-note-references) 3384 (when (and Info-refill-paragraphs Info-hide-note-references)
3390 (push (set-marker (make-marker) start) 3385 (push (set-marker (make-marker) start)