emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/vc-arch.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/vc-arch.el,v
Date: Wed, 28 Mar 2007 01:19:45 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        07/03/28 01:19:44

Index: vc-arch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc-arch.el,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- vc-arch.el  28 Jan 2007 07:05:42 -0000      1.23
+++ vc-arch.el  28 Mar 2007 01:19:43 -0000      1.24
@@ -109,6 +109,19 @@
 
 (defconst vc-arch-tagline-re "^\\W*arch-tag:[ \t]*\\(.*[^ \t\n]\\)")
 
+(defmacro vc-with-current-file-buffer (file &rest body)
+  (declare (indent 2) (debug t))
+  `(let ((-kill-buf- nil)
+         (-file- ,file))
+     (with-current-buffer (or (find-buffer-visiting -file-)
+                              (setq -kill-buf- (generate-new-buffer " temp")))
+       ;; Avoid find-file-literally since it can do many undesirable extra
+       ;; things (among which, call us back into an infinite loop).
+       (if -kill-buf- (insert-file-contents -file-))
+       (unwind-protect
+           (progn ,@body)
+         (if (buffer-live-p -kill-buf-) (kill-buffer -kill-buf-))))))
+
 (defun vc-arch-file-source-p (file)
   "Can return nil, `maybe' or a non-nil value.
 Only the value `maybe' can be trusted :-(."
@@ -122,7 +135,7 @@
          (concat ".arch-ids/" (file-name-nondirectory file) ".id")
          (file-name-directory file)))
        ;; Check the presence of a tagline.
-       (with-current-buffer (find-file-noselect file)
+       (vc-with-current-file-buffer file
          (save-excursion
            (goto-char (point-max))
            (or (re-search-backward vc-arch-tagline-re (- (point) 1000) t)




reply via email to

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