aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-01-24 15:34:44 -0500
committerStefan Monnier2011-01-24 15:34:44 -0500
commit10e1d5f30f7ccb099106a3644776ed68db98b2d7 (patch)
treeb262a31b2816b68efbd02740503b32efbd60f4ae
parent01739ccca08a95973b11e95a2d7a1fccfc63791a (diff)
downloademacs-10e1d5f30f7ccb099106a3644776ed68db98b2d7.tar.gz
emacs-10e1d5f30f7ccb099106a3644776ed68db98b2d7.zip
* files.el (file-name-non-special): Only change buffer-file-name after
insert-file-contents if it's `visit'ing the file. Fixes: debbugs:7854
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el27
2 files changed, 17 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4a8efcde0f5..820a54fd2fd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12011-01-24 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * files.el (file-name-non-special): Only change buffer-file-name after
4 insert-file-contents if it's `visit'ing the file (bug#7854).
5
12011-01-23 Chong Yidong <cyd@stupidchicken.com> 62011-01-23 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * dired.el (dired-revert): Doc fix (Bug#7758). 8 * dired.el (dired-revert): Doc fix (Bug#7758).
diff --git a/lisp/files.el b/lisp/files.el
index 92029b470ff..ee77975e38b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6041,8 +6041,7 @@ only these files will be asked to be saved."
6041 (substitute-in-file-name identity) 6041 (substitute-in-file-name identity)
6042 ;; `add' means add "/:" to the result. 6042 ;; `add' means add "/:" to the result.
6043 (file-truename add 0) 6043 (file-truename add 0)
6044 ;; `quote' means add "/:" to buffer-file-name. 6044 (insert-file-contents insert-file-contents 0)
6045 (insert-file-contents quote 0)
6046 ;; `unquote-then-quote' means set buffer-file-name 6045 ;; `unquote-then-quote' means set buffer-file-name
6047 ;; temporarily to unquoted filename. 6046 ;; temporarily to unquoted filename.
6048 (verify-visited-file-modtime unquote-then-quote) 6047 (verify-visited-file-modtime unquote-then-quote)
@@ -6073,20 +6072,18 @@ only these files will be asked to be saved."
6073 "/" 6072 "/"
6074 (substring (car pair) 2))))) 6073 (substring (car pair) 2)))))
6075 (setq file-arg-indices (cdr file-arg-indices)))) 6074 (setq file-arg-indices (cdr file-arg-indices))))
6076 (cond ((eq method 'identity) 6075 (case method
6077 (car arguments)) 6076 (identity (car arguments))
6078 ((eq method 'add) 6077 (add (concat "/:" (apply operation arguments)))
6079 (concat "/:" (apply operation arguments))) 6078 (insert-file-contents
6080 ((eq method 'quote) 6079 (let ((visit (nth 1 arguments)))
6081 (unwind-protect 6080 (prog1
6082 (apply operation arguments) 6081 (apply operation arguments)
6083 (setq buffer-file-name (concat "/:" buffer-file-name)))) 6082 (when (and visit buffer-file-name)
6084 ((eq method 'unquote-then-quote) 6083 (setq buffer-file-name (concat "/:" buffer-file-name))))))
6085 (let (res) 6084 (unquote-then-quote
6086 (setq buffer-file-name (substring buffer-file-name 2)) 6085 (let ((buffer-file-name (substring buffer-file-name 2)))
6087 (setq res (apply operation arguments)) 6086 (apply operation arguments)))
6088 (setq buffer-file-name (concat "/:" buffer-file-name))
6089 res))
6090 (t 6087 (t
6091 (apply operation arguments))))) 6088 (apply operation arguments)))))
6092 6089