emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/info.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/info.el [lexbind]
Date: Tue, 06 Jul 2004 06:02:24 -0400

Index: emacs/lisp/info.el
diff -c emacs/lisp/info.el:1.304.2.12 emacs/lisp/info.el:1.304.2.13
*** emacs/lisp/info.el:1.304.2.12       Thu Apr 29 10:59:09 2004
--- emacs/lisp/info.el  Tue Jul  6 09:31:48 2004
***************
*** 863,871 ****
              (let ((pos (Info-find-node-in-buffer regexp)))
                (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)))
  
            (Info-select-node)
            (goto-char (point-min))
--- 863,879 ----
              (let ((pos (Info-find-node-in-buffer regexp)))
                (when pos
                  (goto-char pos)
!                 (throw 'foo t)))
! 
!               (when (string-match "\\([^.]+\\)\\." nodename)
!                 (let (Info-point-loc)
!                   (Info-find-node-2
!                    filename (match-string 1 nodename) no-going-back))
!                 (widen)
!                 (throw 'foo t))
! 
!               ;; No such anchor in tag table or node in tag table or file
!               (error "No such node or anchor: %s" nodename))
  
            (Info-select-node)
            (goto-char (point-min))
***************
*** 1075,1081 ****
      (goto-char (point-min))
      ;; Remove duplicate headings in the same menu.
      (while (search-forward "\n* Menu:" nil t)
!       (setq limit (save-excursion (search-forward "\n" nil t)))
        ;; Look for the next heading to unify.
        (while (re-search-forward "^\\(\\w.*\\)\n\\*" limit t)
        (let ((name (match-string 1))
--- 1083,1089 ----
      (goto-char (point-min))
      ;; Remove duplicate headings in the same menu.
      (while (search-forward "\n* Menu:" nil t)
!       (setq limit (save-excursion (search-forward "\n\^_" nil t)))
        ;; Look for the next heading to unify.
        (while (re-search-forward "^\\(\\w.*\\)\n\\*" limit t)
        (let ((name (match-string 1))
***************
*** 1286,1292 ****
        (let ((new-history (list Info-current-file Info-current-node)))
          (setq Info-history-list
                (cons new-history (delete new-history Info-history-list))))
!       (Info-fontify-node)
        (Info-display-images-node)
        (Info-hide-cookies-node)
        (run-hooks 'Info-selection-hook)))))
--- 1294,1301 ----
        (let ((new-history (list Info-current-file Info-current-node)))
          (setq Info-history-list
                (cons new-history (delete new-history Info-history-list))))
!       (if (not (eq Info-fontify-maximum-menu-size nil))
!             (Info-fontify-node))
        (Info-display-images-node)
        (Info-hide-cookies-node)
        (run-hooks 'Info-selection-hook)))))
***************
*** 1646,1652 ****
        (let ((inhibit-read-only t))
          (erase-buffer)
          (goto-char (point-min))
!         (insert "\n\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)))
--- 1655,1661 ----
        (let ((inhibit-read-only t))
          (erase-buffer)
          (goto-char (point-min))
!         (insert "\n\^_\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)))
***************
*** 1673,1679 ****
              (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::\n")
          (Info-insert-toc
--- 1682,1688 ----
              (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::\n")
          (Info-insert-toc
***************
*** 1682,1688 ****
        (if (not (bobp))
            (let ((Info-hide-note-references 'hide)
                  (Info-fontify-visited-nodes nil))
!             (setq Info-current-node "Top")
              (Info-fontify-node)))
        (goto-char (point-min))
        (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
--- 1691,1698 ----
        (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")
              (Info-fontify-node)))
        (goto-char (point-min))
        (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
***************
*** 1707,1722 ****
    (if (equal file "dir")
        (error "Table of contents for Info directory is not supported yet"))
    (with-temp-buffer
!     (let ((default-directory (or (and (stringp file)
!                                       (file-name-directory
!                                        (setq file (Info-find-file file))))
!                                  default-directory))
!           (sections '(("Top" "Top")))
!           nodes subfiles)
!       (while (or file subfiles)
!         (or file (message "Searching subfile %s..." (car subfiles)))
          (erase-buffer)
!         (info-insert-file-contents (or file (car subfiles)))
          (while (and (search-forward "\n\^_\nFile:" nil 'move)
                      (search-forward "Node: " nil 'move))
            (let ((nodename (substring-no-properties 
(Info-following-node-name)))
--- 1717,1734 ----
    (if (equal file "dir")
        (error "Table of contents for Info directory is not supported yet"))
    (with-temp-buffer
!     (let* ((default-directory (or (and (stringp file)
!                                        (file-name-directory
!                                         (setq file (Info-find-file file))))
!                                   default-directory))
!            (main-file file)
!            (sections '(("Top" "Top")))
!            nodes subfiles)
!       (while (or main-file subfiles)
!         (or main-file (message "Searching subfile %s..." (car subfiles)))
          (erase-buffer)
!         (info-insert-file-contents (or main-file (car subfiles)))
!         (goto-char (point-min))
          (while (and (search-forward "\n\^_\nFile:" nil 'move)
                      (search-forward "Node: " nil 'move))
            (let ((nodename (substring-no-properties 
(Info-following-node-name)))
***************
*** 1724,1730 ****
                                (point-max)) 2))
                  (section "Top")
                  menu-items)
!             (when (and (not (string-match "\\<index\\>" nodename))
                         (re-search-forward "^\\* Menu:" bound t))
                (forward-line 1)
                (beginning-of-line)
--- 1736,1742 ----
                                (point-max)) 2))
                  (section "Top")
                  menu-items)
!             (when (and (not (Info-index-node nodename file))
                         (re-search-forward "^\\* Menu:" bound t))
                (forward-line 1)
                (beginning-of-line)
***************
*** 1756,1762 ****
                                      (nreverse menu-items))
                                nodes))
              (goto-char bound)))
!         (if file
              (save-excursion
                (goto-char (point-min))
                (if (search-forward "\n\^_\nIndirect:" nil t)
--- 1768,1774 ----
                                      (nreverse menu-items))
                                nodes))
              (goto-char bound)))
!         (if main-file
              (save-excursion
                (goto-char (point-min))
                (if (search-forward "\n\^_\nIndirect:" nil t)
***************
*** 1765,1771 ****
                        (setq subfiles (cons (match-string-no-properties 1)
                                             subfiles)))))
                (setq subfiles (nreverse subfiles)
!                     file nil))
            (setq subfiles (cdr subfiles))))
        (message "")
        (nreverse nodes))))
--- 1777,1783 ----
                        (setq subfiles (cons (match-string-no-properties 1)
                                             subfiles)))))
                (setq subfiles (nreverse subfiles)
!                     main-file nil))
            (setq subfiles (cdr subfiles))))
        (message "")
        (nreverse nodes))))
***************
*** 1907,1912 ****
--- 1919,1925 ----
  
  (defvar Info-complete-menu-buffer)
  (defvar Info-complete-next-re nil)
+ (defvar Info-complete-nodes nil)
  (defvar Info-complete-cache nil)
  
  (defconst Info-node-spec-re
***************
*** 1920,1925 ****
--- 1933,1941 ----
    ;; - `Info-complete-next-re' which, if non-nil, indicates that we should
    ;; also look for menu items in subsequent nodes as long as those
    ;; nodes' names match `Info-complete-next-re'.  This feature is currently
+   ;; not used.
+   ;; - `Info-complete-nodes' which, if non-nil, indicates that we should
+   ;; also look for menu items in these nodes.  This feature is currently
    ;; only used for completion in Info-index.
  
    ;; Note that `Info-complete-menu-buffer' could be current already,
***************
*** 1943,1948 ****
--- 1959,1965 ----
          (if (and (equal (nth 0 Info-complete-cache) Info-current-file)
                   (equal (nth 1 Info-complete-cache) Info-current-node)
                   (equal (nth 2 Info-complete-cache) Info-complete-next-re)
+                  (equal (nth 5 Info-complete-cache) Info-complete-nodes)
                   (let ((prev (nth 3 Info-complete-cache)))
                     (eq t (compare-strings string 0 (length prev)
                                            prev 0 nil t))))
***************
*** 1955,1963 ****
                    (push (match-string-no-properties 1)
                          completions))
                  ;; Check subsequent nodes if applicable.
!                 (and Info-complete-next-re
!                      (setq nextnode (Info-extract-pointer "next" t))
!                      (string-match Info-complete-next-re nextnode)))
              (Info-goto-node nextnode))
            ;; Go back to the start node (for the next completion).
            (unless (equal Info-current-node orignode)
--- 1972,1983 ----
                    (push (match-string-no-properties 1)
                          completions))
                  ;; Check subsequent nodes if applicable.
!                 (or (and Info-complete-next-re
!                          (setq nextnode (Info-extract-pointer "next" t))
!                          (string-match Info-complete-next-re nextnode))
!                     (and Info-complete-nodes
!                          (setq Info-complete-nodes (cdr Info-complete-nodes)
!                                nextnode (car Info-complete-nodes)))))
              (Info-goto-node nextnode))
            ;; Go back to the start node (for the next completion).
            (unless (equal Info-current-node orignode)
***************
*** 1965,1971 ****
            ;; Update the cache.
            (set (make-local-variable 'Info-complete-cache)
                 (list Info-current-file Info-current-node
!                      Info-complete-next-re string completions)))
          (if action
              (all-completions string completions predicate)
            (try-completion string completions predicate)))))))
--- 1985,1992 ----
            ;; Update the cache.
            (set (make-local-variable 'Info-complete-cache)
                 (list Info-current-file Info-current-node
!                      Info-complete-next-re string completions
!                      Info-complete-nodes)))
          (if action
              (all-completions string completions predicate)
            (try-completion string completions predicate)))))))
***************
*** 2034,2040 ****
            (error "No such item in menu"))
        (beginning-of-line)
        (forward-char 2)
!       (Info-extract-menu-node-name)))))
  
  ;; If COUNT is nil, use the last item in the menu.
  (defun Info-extract-menu-counting (count)
--- 2055,2061 ----
            (error "No such item in menu"))
        (beginning-of-line)
        (forward-char 2)
!       (Info-extract-menu-node-name nil (Info-index-node))))))
  
  ;; If COUNT is nil, use the last item in the menu.
  (defun Info-extract-menu-counting (count)
***************
*** 2049,2055 ****
                (error "Too few items in menu"))
          (while (search-forward "\n* " nil t)
            nil))
!       (Info-extract-menu-node-name)))))
  
  (defun Info-nth-menu-item ()
    "Go to the node of the Nth menu item.
--- 2070,2076 ----
                (error "Too few items in menu"))
          (while (search-forward "\n* " nil t)
            nil))
!       (Info-extract-menu-node-name nil (Info-index-node))))))
  
  (defun Info-nth-menu-item ()
    "Go to the node of the Nth menu item.
***************
*** 2076,2082 ****
      ;; move forward until we can't go any farther.
      (while (Info-forward-node t t) nil)
      ;; Then keep moving down to last subnode, unless we reach an index.
!     (while (and (not (string-match "\\<index\\>" Info-current-node))
                (save-excursion (search-forward "\n* Menu:" nil t)))
        (Info-goto-node (Info-extract-menu-counting nil)))))
  
--- 2097,2103 ----
      ;; move forward until we can't go any farther.
      (while (Info-forward-node t t) nil)
      ;; Then keep moving down to last subnode, unless we reach an index.
!     (while (and (not (Info-index-node))
                (save-excursion (search-forward "\n* Menu:" nil t)))
        (Info-goto-node (Info-extract-menu-counting nil)))))
  
***************
*** 2092,2098 ****
      ;;     3. next node is up and next
      (cond ((and (not not-down)
                (save-excursion (search-forward "\n* menu:" nil t))
!               (not (string-match "\\<index\\>" Info-current-node)))
           (Info-goto-node (Info-extract-menu-counting 1))
           t)
          ((save-excursion (search-backward "next:" nil t))
--- 2113,2119 ----
      ;;     3. next node is up and next
      (cond ((and (not not-down)
                (save-excursion (search-forward "\n* menu:" nil t))
!               (not (Info-index-node)))
           (Info-goto-node (Info-extract-menu-counting 1))
           t)
          ((save-excursion (search-backward "next:" nil t))
***************
*** 2130,2136 ****
           ;; go down to find the last subnode*.
           (Info-prev)
           (let (Info-history)
!            (while (and (not (string-match "\\<index\\>" Info-current-node))
                         (save-excursion (search-forward "\n* Menu:" nil t)))
               (Info-goto-node (Info-extract-menu-counting nil)))))
          (t
--- 2151,2157 ----
           ;; go down to find the last subnode*.
           (Info-prev)
           (let (Info-history)
!            (while (and (not (Info-index-node))
                         (save-excursion (search-forward "\n* Menu:" nil t)))
               (Info-goto-node (Info-extract-menu-counting nil)))))
          (t
***************
*** 2321,2344 ****
        (if recur
            (error "No cross references in this node")
          (Info-prev-reference t)))))
  
  (defun Info-goto-index ()
!   (Info-goto-node "Top")
!   (or (search-forward "\n* menu:" nil t)
!       (error "No index"))
!   (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
!       (error "No index"))
!   (goto-char (match-beginning 1))
!   ;; Protect Info-history so that the current node (Top) is not added to it.
!   (let ((Info-history nil))
!     (Info-goto-node (Info-extract-menu-node-name))))
  
  ;;;###autoload
  (defun Info-index (topic)
    "Look up a string TOPIC in the index for this file.
- The index is defined as the first node in the top level menu whose
- name contains the word \"Index\", plus any immediately following
- 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.
--- 2342,2456 ----
        (if recur
            (error "No cross references in this node")
          (Info-prev-reference t)))))
+ 
+ (defvar Info-index-nodes nil
+   "Alist of cached index node names of visited Info files.
+ Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).")
+ 
+ (defun Info-index-nodes (&optional file)
+   "Return a list of names of all index nodes in Info FILE.
+ If FILE is omitted, it defaults to the current Info file.
+ First look in a list of cached index node names.  Then scan Info
+ file and its subfiles for nodes with the index cookie.  Then try
+ to find index nodes starting from the first node in the top level
+ menu whose name contains the word \"Index\", plus any immediately
+ following nodes whose names also contain the word \"Index\"."
+   (or file (setq file Info-current-file))
+   (or (assoc file Info-index-nodes)
+       ;; Skip virtual Info files
+       (and (member file '("dir" "history" "toc" "apropos"))
+            (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
+       (not (stringp file))
+       ;; Find nodes with index cookie
+       (let* ((default-directory (or (and (stringp file)
+                                          (file-name-directory
+                                           (setq file (Info-find-file file))))
+                                     default-directory))
+              Info-history Info-history-list Info-fontify-maximum-menu-size
+              (main-file file) subfiles nodes node)
+         (condition-case nil
+             (with-temp-buffer
+               (while (or main-file subfiles)
+                 (erase-buffer)
+                 (info-insert-file-contents (or main-file (car subfiles)))
+                 (goto-char (point-min))
+                 (while (search-forward "\0\b[index\0\b]" nil 'move)
+                   (save-excursion
+                     (re-search-backward "^\^_")
+                     (search-forward "Node: ")
+                     (setq nodes (cons (Info-following-node-name) nodes))))
+                 (if main-file
+                     (save-excursion
+                       (goto-char (point-min))
+                       (if (search-forward "\n\^_\nIndirect:" nil t)
+                           (let ((bound (save-excursion (search-forward 
"\n\^_" nil t))))
+                             (while (re-search-forward "^\\(.*\\): [0-9]+$" 
bound t)
+                               (setq subfiles (cons 
(match-string-no-properties 1)
+                                                    subfiles)))))
+                       (setq subfiles (nreverse subfiles)
+                             main-file nil))
+                   (setq subfiles (cdr subfiles)))))
+           (error nil))
+         (if nodes
+             (setq nodes (nreverse nodes)
+                   Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
+         nodes)
+       ;; Find nodes with the word "Index" in the node name
+       (let ((case-fold-search t)
+             Info-history Info-history-list Info-fontify-maximum-menu-size
+             nodes node)
+         (condition-case nil
+             (with-temp-buffer
+               (Info-mode)
+               (Info-find-node file "Top")
+               (when (and (search-forward "\n* menu:" nil t)
+                          (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil 
t))
+                 (goto-char (match-beginning 1))
+                 (setq nodes (list (Info-extract-menu-node-name)))
+                 (Info-goto-node (car nodes))
+                 (while (and (setq node (Info-extract-pointer "next" t))
+                             (string-match "\\<Index\\>" node))
+                   (setq nodes (cons node nodes))
+                   (Info-goto-node node))))
+           (error nil))
+         (if nodes
+             (setq nodes (nreverse nodes)
+                   Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
+         nodes)
+       ;; If file has no index nodes, still add it to the cache
+       (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
+   (cdr (assoc file Info-index-nodes)))
+ 
+ (defun Info-index-node (&optional node file)
+   "Return non-nil value if NODE is an index node.
+ If NODE is nil, check the current Info node.
+ If FILE is nil, check the current Info file."
+   (if (or (and node (not (equal node Info-current-node)))
+           (assoc (or file Info-current-file) Info-index-nodes))
+       (member (or node Info-current-node) (Info-index-nodes file))
+     ;; Don't search all index nodes if request is only for the current node
+     ;; and file is not in the cache of index nodes
+     (or
+      (save-match-data
+        (string-match "\\<Index\\>" (or node Info-current-node "")))
+      (save-excursion
+        (goto-char (+ (or (save-excursion
+                            (search-backward "\n\^_" nil t))
+                          (point-min)) 2))
+        (search-forward "\0\b[index\0\b]"
+                        (or (save-excursion
+                              (search-forward "\n\^_" nil t))
+                            (point-max)) t)))))
  
  (defun Info-goto-index ()
!   "Go to the first index node."
!   (let ((node (car (Info-index-nodes))))
!     (or node (error "No index"))
!     (Info-goto-node node)))
  
  ;;;###autoload
  (defun Info-index (topic)
    "Look up a string TOPIC in the index for this file.
  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.
***************
*** 2346,2352 ****
    (interactive
     (list
      (let ((Info-complete-menu-buffer (clone-buffer))
!         (Info-complete-next-re "\\<Index\\>"))
        (if (equal Info-current-file "dir")
          (error "The Info directory node has no index; use m to select a 
manual"))
        (unwind-protect
--- 2458,2465 ----
    (interactive
     (list
      (let ((Info-complete-menu-buffer (clone-buffer))
!         (Info-complete-nodes (Info-index-nodes))
!         (Info-history-list nil))
        (if (equal Info-current-file "dir")
          (error "The Info directory node has no index; use m to select a 
manual"))
        (unwind-protect
***************
*** 2359,2365 ****
    (let ((orignode Info-current-node)
        (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ 
\t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
                         (regexp-quote topic)))
!       node
        (case-fold-search t))
      (Info-goto-index)
      (or (equal topic "")
--- 2472,2479 ----
    (let ((orignode Info-current-node)
        (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ 
\t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
                         (regexp-quote topic)))
!       node (nodes (Info-index-nodes))
!       (ohist-list Info-history-list)
        (case-fold-search t))
      (Info-goto-index)
      (or (equal topic "")
***************
*** 2381,2388 ****
                              (string-to-number (concat "0"
                                                        (match-string 3))))
                        matches))
!               (and (setq node (Info-extract-pointer "next" t))
!                    (string-match "\\<Index\\>" node)))
            (Info-goto-node node))
          (or matches
              (progn
--- 2495,2501 ----
                              (string-to-number (concat "0"
                                                        (match-string 3))))
                        matches))
!               (setq nodes (cdr nodes) node (car nodes)))
            (Info-goto-node node))
          (or matches
              (progn
***************
*** 2392,2397 ****
--- 2505,2511 ----
          (while (setq found (assoc topic matches))
            (setq exact (cons found exact)
                  matches (delq found matches)))
+           (setq Info-history-list ohist-list)
          (setq Info-index-alternatives (nconc exact (nreverse matches)))
          (Info-index-next 0)))))
  
***************
*** 2454,2463 ****
          (ohist-list Info-history-list)
          (current-node Info-current-node)
          (current-file Info-current-file)
!         manuals matches node)
!       (let ((Info-fontify-maximum-menu-size 0)
!           Info-use-header-lines
!           Info-hide-note-references)
        (Info-directory)
        (message "Searching indices...")
        (goto-char (point-min))
--- 2568,2575 ----
          (ohist-list Info-history-list)
          (current-node Info-current-node)
          (current-file Info-current-file)
!         manuals matches node nodes)
!       (let ((Info-fontify-maximum-menu-size nil))
        (Info-directory)
        (message "Searching indices...")
        (goto-char (point-min))
***************
*** 2466,2490 ****
          (add-to-list 'manuals (match-string 1)))
        (dolist (manual manuals)
          (message "Searching %s" manual)
!         (condition-case nil
!             (save-excursion
!               (Info-find-node manual "Top")
!               (when (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
!                 (goto-char (match-beginning 1))
!                 (Info-goto-node (Info-extract-menu-node-name))
!                 (while
!                     (progn
!                       (goto-char (point-min))
!                       (while (re-search-forward pattern nil t)
!                         (add-to-list 'matches
!                                      (list manual
!                                            (match-string-no-properties 1)
!                                            (match-string-no-properties 2)
!                                            (match-string-no-properties 3))))
!                       (and (setq node (Info-extract-pointer "next" t))
!                            (string-match "\\<Index\\>" node)))
!                   (Info-goto-node node))))
!           (error nil))))
        (Info-goto-node (concat "(" current-file ")" current-node))
        (setq Info-history ohist
            Info-history-list ohist-list)
--- 2578,2599 ----
          (add-to-list 'manuals (match-string 1)))
        (dolist (manual manuals)
          (message "Searching %s" manual)
!         (if (setq nodes (Info-index-nodes (Info-find-file manual)))
!               (condition-case nil
!                   (save-excursion
!                     (Info-find-node manual (car nodes))
!                     (while
!                         (progn
!                           (goto-char (point-min))
!                           (while (re-search-forward pattern nil t)
!                             (add-to-list 'matches
!                                          (list manual
!                                                (match-string-no-properties 1)
!                                                (match-string-no-properties 2)
!                                                (match-string-no-properties 
3))))
!                           (setq nodes (cdr nodes) node (car nodes)))
!                       (Info-goto-node node)))
!                 (error nil)))))
        (Info-goto-node (concat "(" current-file ")" current-node))
        (setq Info-history ohist
            Info-history-list ohist-list)
***************
*** 2493,2499 ****
          (message "No matches found")
        (with-current-buffer (get-buffer-create " *info-apropos*")
          (erase-buffer)
!         (insert "\n\nFile: apropos, Node: Index, Up: (dir)\n")
          (insert "* Menu: \nNodes whose indices contain \"" string "\"\n\n")
          (dolist (entry matches)
            (insert
--- 2602,2608 ----
          (message "No matches found")
        (with-current-buffer (get-buffer-create " *info-apropos*")
          (erase-buffer)
!         (insert "\n\^_\nFile: apropos, Node: Index, Up: (dir)\n")
          (insert "* Menu: \nNodes whose indices contain \"" string "\"\n\n")
          (dolist (entry matches)
            (insert
***************
*** 2629,2636 ****
       ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ")
        (beginning-of-line)
        (forward-char 2)
!       (setq node (Info-extract-menu-node-name
!                   nil (string-match "\\<index\\>" Info-current-node)))
        (Info-goto-node node fork))
       ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))
        (Info-goto-node node fork))
--- 2738,2744 ----
       ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ")
        (beginning-of-line)
        (forward-char 2)
!       (setq node (Info-extract-menu-node-name nil (Info-index-node)))
        (Info-goto-node node fork))
       ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))
        (Info-goto-node node fork))
***************
*** 2683,2693 ****
--- 2791,2804 ----
    (define-key Info-mode-map "p" 'Info-prev)
    (define-key Info-mode-map "q" 'Info-exit)
    (define-key Info-mode-map "s" 'Info-search)
+   (define-key Info-mode-map "S" 'Info-search-case-sensitively)
    ;; For consistency with Rmail.
    (define-key Info-mode-map "\M-s" 'Info-search)
    (define-key Info-mode-map "\M-n" 'clone-buffer)
    (define-key Info-mode-map "t" 'Info-top-node)
    (define-key Info-mode-map "u" 'Info-up)
+   ;; For consistency with dired-copy-filename-as-kill.
+   (define-key Info-mode-map "w" 'Info-copy-current-node-name)
    (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-mouse-follow-nearest-node)
***************
*** 2832,2851 ****
      (error (ding))))
  
  
! (defun Info-copy-current-node-name ()
    "Put the name of the current info node into the kill ring.
! The name of the info file is prepended to the node name in parentheses."
!   (interactive)
    (unless Info-current-node
      (error "No current info node"))
!   (kill-new
!    (concat "("
!          (file-name-nondirectory
!           (if (stringp Info-current-file)
!               Info-current-file
!             (or buffer-file-name "")))
!          ")"
!          Info-current-node)))
  
  
  ;; Info mode is suitable only for specially formatted data.
--- 2943,2965 ----
      (error (ding))))
  
  
! (defun Info-copy-current-node-name (&optional arg)
    "Put the name of the current info node into the kill ring.
! The name of the info file is prepended to the node name in parentheses.
! With a zero prefix arg, put the name inside a function call to `info'."
!   (interactive "P")
    (unless Info-current-node
      (error "No current info node"))
!   (let ((node (concat "(" (file-name-nondirectory
!                            (or (and (stringp Info-current-file)
!                                     Info-current-file)
!                                buffer-file-name
!                                ""))
!                       ")" Info-current-node)))
!     (if (zerop (prefix-numeric-value arg))
!         (setq node (concat "(info \"" node "\")")))
!     (kill-new node)
!     (message "%s" node)))
  
  
  ;; Info mode is suitable only for specially formatted data.
***************
*** 3072,3079 ****
      ;; Bind Info-history to nil, to prevent the index nodes from
      ;; getting into the node history.
      (let ((Info-history nil)
!         node)
!       (Info-goto-node (Info-extract-menu-node-name))
        (while
          (progn
            (goto-char (point-min))
--- 3186,3194 ----
      ;; Bind Info-history to nil, to prevent the index nodes from
      ;; getting into the node history.
      (let ((Info-history nil)
!           (Info-history-list nil)
!         node (nodes (Info-index-nodes)))
!       (Info-goto-node (car nodes))
        (while
          (progn
            (goto-char (point-min))
***************
*** 3083,3090 ****
                                (match-string-no-properties 2)
                                0)
                          where)))
!           (and (setq node (Info-extract-pointer "next" t))
!                (string-match "\\<Index\\>" node)))
        (Info-goto-node node)))
      where))
  
--- 3198,3204 ----
                                (match-string-no-properties 2)
                                0)
                          where)))
!           (and (setq nodes (cdr nodes) node (car nodes))))
        (Info-goto-node node)))
      where))
  
***************
*** 3111,3117 ****
          ;; Bind Info-history to nil, to prevent the last Index node
          ;; visited by Info-find-emacs-command-nodes from being
          ;; pushed onto the history.
!         (let ((Info-history nil))
            (Info-find-node (car (car where))
                            (car (cdr (car where)))))
          (if (> num-matches 1)
--- 3225,3231 ----
          ;; Bind Info-history to nil, to prevent the last Index node
          ;; visited by Info-find-emacs-command-nodes from being
          ;; pushed onto the history.
!         (let ((Info-history nil) (Info-history-list nil))
            (Info-find-node (car (car where))
                            (car (cdr (car where)))))
          (if (> num-matches 1)
***************
*** 3448,3454 ****
        (goto-char (point-min))
        (when (and (or not-fontified-p fontify-visited-p)
                   (search-forward "\n* Menu:" nil t)
!                  (not (string-match "\\<Index\\>" Info-current-node))
                   ;; Don't take time to annotate huge menus
                   (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
          (let ((n 0)
--- 3562,3568 ----
        (goto-char (point-min))
        (when (and (or not-fontified-p fontify-visited-p)
                   (search-forward "\n* Menu:" nil t)
!                  (not (Info-index-node))
                   ;; Don't take time to annotate huge menus
                   (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
          (let ((n 0)
***************
*** 3537,3543 ****
  
        ;; Hide index line numbers
        (goto-char (point-min))
!       (when (and not-fontified-p (string-match "\\<Index\\>" 
Info-current-node))
          (while (re-search-forward "[ \t\n]*(line +[0-9]+)" nil t)
            (put-text-property (match-beginning 0) (match-end 0)
                               'invisible t)))
--- 3651,3657 ----
  
        ;; Hide index line numbers
        (goto-char (point-min))
!       (when (and not-fontified-p (Info-index-node))
          (while (re-search-forward "[ \t\n]*(line +[0-9]+)" nil t)
            (put-text-property (match-beginning 0) (match-end 0)
                               'invisible t)))
***************
*** 3757,3763 ****
  
  (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
--- 3871,3878 ----
  
  (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)))
  
  ;;;###autoload
  (defun Info-restore-desktop-buffer (desktop-buffer-file-name
***************
*** 3767,3772 ****
--- 3882,3890 ----
    (let ((first (nth 0 desktop-buffer-misc))
          (second (nth 1 desktop-buffer-misc)))
    (when (and first second)
+     (when desktop-buffer-name
+       (set-buffer (get-buffer-create desktop-buffer-name))
+       (Info-mode))
      (Info-find-node first second)
      (current-buffer))))
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]