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,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/info.el,v
Date: Sat, 19 Apr 2008 03:33:14 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/04/19 03:33:13

Index: info.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/info.el,v
retrieving revision 1.526
retrieving revision 1.527
diff -u -b -r1.526 -r1.527
--- info.el     13 Apr 2008 22:12:01 -0000      1.526
+++ info.el     19 Apr 2008 03:33:13 -0000      1.527
@@ -449,7 +449,7 @@
     (if decoder
        (progn
          (insert-file-contents-literally fullname visit)
-         (let ((buffer-read-only nil)
+         (let ((inhibit-read-only t)
                (coding-system-for-write 'no-conversion)
                (default-directory (or (file-name-directory fullname)
                                       default-directory)))
@@ -756,8 +756,7 @@
 where the match was found, and MODE is `major-mode' of the buffer in
 which the match was found."
   (let ((case-fold-search case-fold))
-    (save-excursion
-      (set-buffer (marker-buffer marker))
+    (with-current-buffer (marker-buffer marker)
       (goto-char marker)
 
       ;; Search tag table
@@ -826,7 +825,7 @@
         ;; Switch files if necessary
         (or (null filename)
             (equal Info-current-file filename)
-            (let ((buffer-read-only nil))
+            (let ((inhibit-read-only t))
               (setq Info-current-file nil
                     Info-current-subfile nil
                     Info-current-file-completions nil
@@ -880,8 +879,7 @@
                                (or Info-tag-table-buffer
                                    (generate-new-buffer " *info tag table*"))))
                           (setq Info-tag-table-buffer tagbuf)
-                          (save-excursion
-                            (set-buffer tagbuf)
+                          (with-current-buffer tagbuf
                             (buffer-disable-undo (current-buffer))
                             (setq case-fold-search t)
                             (erase-buffer)
@@ -1059,10 +1057,9 @@
                            (cons (directory-file-name truename)
                                  dirs-done)))
                (if attrs
-                   (save-excursion
+                   (with-current-buffer (generate-new-buffer " info dir")
                      (or buffers
                          (message "Composing main Info directory..."))
-                     (set-buffer (generate-new-buffer " info dir"))
                      (condition-case nil
                          (progn
                            (insert-file-contents file)
@@ -1237,8 +1234,7 @@
   (let (lastfilepos
        lastfilename)
     (if (numberp nodepos)
-       (save-excursion
-         (set-buffer (marker-buffer Info-tag-table-marker))
+       (with-current-buffer (marker-buffer Info-tag-table-marker)
          (goto-char (point-min))
          (or (looking-at "\^_")
              (search-forward "\n\^_"))
@@ -1264,7 +1260,7 @@
     ;; Assume previous buffer is in Info-mode.
     ;; (set-buffer (get-buffer "*info*"))
     (or (equal Info-current-subfile lastfilename)
-       (let ((buffer-read-only nil))
+       (let ((inhibit-read-only t))
          (setq buffer-file-name nil)
          (widen)
          (erase-buffer)
@@ -1469,17 +1465,15 @@
 
 (defvar Info-read-node-completion-table)
 
-(defun Info-read-node-name-2 (string path-and-suffixes action)
+(defun Info-read-node-name-2 (dirs suffixes string pred action)
   "Virtual completion table for file names input in Info node names.
 PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)."
-  (let* ((names nil)
-        (suffixes (remove "" (cdr path-and-suffixes)))
+  (setq suffixes (remove "" suffixes))
+  (when (file-name-absolute-p string)
+    (setq dirs (list (file-name-directory string))))
+  (let ((names nil)
         (suffix (concat (regexp-opt suffixes t) "\\'"))
-        (string-dir (file-name-directory string))
-        (dirs
-         (if (file-name-absolute-p string)
-             (list (file-name-directory string))
-           (car path-and-suffixes))))
+        (string-dir (file-name-directory string)))
     (dolist (dir dirs)
       (unless dir
        (setq dir default-directory))
@@ -1501,10 +1495,7 @@
          (when (string-match suffix file)
            (setq file (substring file 0 (match-beginning 0)))
            (push (if string-dir (concat string-dir file) file) names)))))
-    (cond
-     ((eq action t) (all-completions string names))
-     ((null action) (try-completion string names))
-     (t (test-completion string names)))))
+    (complete-with-action action names string pred)))
 
 ;; This function is used as the "completion table" while reading a node name.
 ;; It does completion using the alist in Info-read-node-completion-table
@@ -1515,11 +1506,12 @@
    ((string-match "\\`([^)]*\\'" string)
     (completion-table-with-context
      "("
-     (apply-partially 'completion-table-with-terminator
-                      ")" 'Info-read-node-name-2)
+     (apply-partially 'completion-table-with-terminator ")"
+                      (apply-partially 'Info-read-node-name-2
+                                       Info-directory-list
+                                       (mapcar 'car Info-suffix-list)))
      (substring string 1)
-     (cons Info-directory-list
-           (mapcar 'car Info-suffix-list))
+     predicate
      code))
 
    ;; If a file name was given, then any node is fair game.
@@ -1682,8 +1674,7 @@
        (unwind-protect
            ;; Try other subfiles.
            (let ((list ()))
-             (save-excursion
-               (set-buffer (marker-buffer Info-tag-table-marker))
+             (with-current-buffer (marker-buffer Info-tag-table-marker)
                (goto-char (point-min))
                (search-forward "\n\^_\nIndirect:")
                (save-restriction
@@ -2271,8 +2262,7 @@
 
   ;; Note that `Info-complete-menu-buffer' could be current already,
   ;; so we want to save point.
-  (save-excursion
-    (set-buffer Info-complete-menu-buffer)
+  (with-current-buffer Info-complete-menu-buffer
     (let ((completion-ignore-case t)
          (case-fold-search t)
          (orignode Info-current-node)
@@ -4219,9 +4209,8 @@
 (defun Info-speedbar-fetch-file-nodes (nodespec)
   "Fetch the subnodes from the info NODESPEC.
 NODESPEC is a string of the form: (file)node."
-  (save-excursion
     ;; Set up a buffer we can use to fake-out Info.
-    (set-buffer (get-buffer-create " *info-browse-tmp*"))
+  (with-current-buffer (get-buffer-create " *info-browse-tmp*")
     (if (not (equal major-mode 'Info-mode))
        (Info-mode))
     ;; Get the node into this buffer




reply via email to

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