emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/progmodes/etags.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/etags.el,v
Date: Thu, 05 Jun 2008 05:55:38 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/06/05 05:55:37

Index: progmodes/etags.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/etags.el,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -b -r1.209 -r1.210
--- progmodes/etags.el  6 May 2008 07:18:22 -0000       1.209
+++ progmodes/etags.el  5 Jun 2008 05:55:37 -0000       1.210
@@ -301,8 +301,7 @@
                     current-prefix-arg))
   (or (stringp file) (signal 'wrong-type-argument (list 'stringp file)))
   ;; Bind tags-file-name so we can control below whether the local or
-  ;; global value gets set.  Calling visit-tags-table-buffer will
-  ;; initialize a buffer for the file and set tags-file-name to the
+  ;; global value gets set.
   ;; Calling visit-tags-table-buffer with tags-file-name set to FILE will
   ;; initialize a buffer for FILE and set tags-file-name to the
   ;; fully-expanded name.
@@ -338,8 +337,7 @@
                     ;; it is initialized as a tag table buffer.
                     (save-excursion
                       (tags-verify-table (buffer-file-name table-buffer))))
-               (save-excursion
-                 (set-buffer table-buffer)
+               (with-current-buffer table-buffer
                  (if (tags-included-tables)
                      ;; Insert the included tables into the list we
                      ;; are processing.
@@ -378,8 +376,7 @@
              (setq computed (cons (car tables) computed)
                    table-buffer (get-file-buffer (car tables)))
              (if table-buffer
-                 (save-excursion
-                   (set-buffer table-buffer)
+                 (with-current-buffer table-buffer
                    (if (tags-included-tables)
                        ;; Insert the included tables into the list we
                        ;; are processing.
@@ -448,17 +445,18 @@
                 (funcall verify-tags-table-function))
          (revert-buffer t t)
          (tags-table-mode)))
-    (and (file-exists-p file)
-        (progn
-          (set-buffer (find-file-noselect file))
-          (or (string= file buffer-file-name)
+    (when (file-exists-p file)
+      (let* ((buf (find-file-noselect file))
+             (newfile (buffer-file-name buf)))
+        (unless (string= file newfile)
               ;; find-file-noselect has changed the file name.
               ;; Propagate the change to tags-file-name and tags-table-list.
               (let ((tail (member file tags-table-list)))
-                (if tail
-                    (setcar tail buffer-file-name))
-                (if (eq file tags-file-name)
-                    (setq tags-file-name buffer-file-name))))
+            (if tail (setcar tail newfile)))
+          (if (eq file tags-file-name) (setq tags-file-name newfile)))
+        ;; Only change buffer now that we're done using potentially
+        ;; buffer-local variables.
+        (set-buffer buf)
           (tags-table-mode)))))
 
 ;; Subroutine of visit-tags-table-buffer.  Search the current tags tables
@@ -883,8 +881,7 @@
        (setq last-tag tagname))
       ;; Record the location so we can pop back to it later.
       (let ((marker (make-marker)))
-       (save-excursion
-         (set-buffer
+       (with-current-buffer
           ;; find-tag-in-order does the real work.
           (find-tag-in-order
            (if (and next-p last-tag) last-tag tagname)
@@ -898,7 +895,7 @@
                find-tag-regexp-next-line-after-failure-p
              find-tag-next-line-after-failure-p)
            (if regexp-p "matching" "containing")
-           (or (not next-p) (not last-tag))))
+             (or (not next-p) (not last-tag)))
          (set-marker marker (point))
          (run-hooks 'local-find-tag-hook)
          (ring-insert tags-location-ring marker)
@@ -1560,18 +1557,10 @@
 
 ;; This might be a neat idea, but it's too hairy at the moment.
 ;;(defmacro tags-with-syntax (&rest body)
-;;   `(let ((current (current-buffer))
-;;        (otable (syntax-table))
-;;        (buffer (find-file-noselect (file-of-tag)))
-;;        table)
-;;       (unwind-protect
-;;        (progn
-;;          (set-buffer buffer)
-;;          (setq table (syntax-table))
-;;          (set-buffer current)
-;;          (set-syntax-table table)
-;;            ,@body)
-;;       (set-syntax-table otable))))
+;;   `(with-syntax-table
+;;        (with-current-buffer (find-file-noselect (file-of-tag))
+;;          (syntax-table))
+;;      ,@body))
 ;;(put 'tags-with-syntax 'edebug-form-spec '(&rest form))
 
 ;; exact file name match, i.e. searched tag must match complete file




reply via email to

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