diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-01-24 15:34:44 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-01-24 15:34:44 -0500 |
commit | 10e1d5f30f7ccb099106a3644776ed68db98b2d7 (patch) | |
tree | b262a31b2816b68efbd02740503b32efbd60f4ae /lisp/files.el | |
parent | 01739ccca08a95973b11e95a2d7a1fccfc63791a (diff) | |
download | emacs-10e1d5f30f7ccb099106a3644776ed68db98b2d7.tar.gz |
* 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
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 27 |
1 files changed, 12 insertions, 15 deletions
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." (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) @@ -6073,20 +6072,18 @@ only these files will be asked to be saved." "/" (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))))) |