bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7854: 24.0.50; Buffer *temp* modified; kill anyway?


From: Stefan Monnier
Subject: bug#7854: 24.0.50; Buffer *temp* modified; kill anyway?
Date: Mon, 24 Jan 2011 15:36:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> Can you check to see if the quick-fix below solves the problem?
> It solves the problem.  Thank you!

Thanks for confirming.  I've installed the patch below in the emacs-23
branch, which should fix it right.


        Stefan


=== modified file 'lisp/files.el'
--- lisp/files.el       2011-01-20 02:55:36 +0000
+++ lisp/files.el       2011-01-24 20:22:34 +0000
@@ -6118,8 +6118,7 @@
                          (substitute-in-file-name identity)
                          ;; `add' means add "/:" to the result.
                          (file-truename add 0)
-                         ;; `quote' means add "/:" to buffer-file-name.
-                         (insert-file-contents quote 0)
+                         (insert-file-contents insert-file-contents 0)
                          ;; `unquote-then-quote' means set buffer-file-name
                          ;; temporarily to unquoted filename.
                          (verify-visited-file-modtime unquote-then-quote)
@@ -6150,20 +6149,18 @@
                           "/"
                         (substring (car pair) 2)))))
        (setq file-arg-indices (cdr file-arg-indices))))
-    (cond ((eq method 'identity)
-          (car arguments))
-         ((eq method 'add)
-          (concat "/:" (apply operation arguments)))
-         ((eq method 'quote)
-          (unwind-protect
+    (case method
+      (identity (car arguments))
+      (add (concat "/:" (apply operation arguments)))
+      (insert-file-contents
+       (let ((visit (nth 1 arguments)))
+         (prog1
               (apply operation arguments)
-            (setq buffer-file-name (concat "/:" buffer-file-name))))
-         ((eq method 'unquote-then-quote)
-          (let (res)
-            (setq buffer-file-name (substring buffer-file-name 2))
-            (setq res (apply operation arguments))
-            (setq buffer-file-name (concat "/:" buffer-file-name))
-            res))
+           (when (and visit buffer-file-name)
+             (setq buffer-file-name (concat "/:" buffer-file-name))))))
+      (unquote-then-quote
+       (let ((buffer-file-name (substring buffer-file-name 2)))
+         (apply operation arguments)))
          (t
           (apply operation arguments)))))
 






reply via email to

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