aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2014-07-24 09:30:36 +0200
committerMichael Albinus2014-07-24 09:30:36 +0200
commit934eeab5ff5d3dbe233f8fd1acd698b401aee44c (patch)
tree4805b99a87695e98558fe667619140d2deb54b89
parentd6a393dd19e89519e96025168c4bf06a2d93f23d (diff)
downloademacs-934eeab5ff5d3dbe233f8fd1acd698b401aee44c.tar.gz
emacs-934eeab5ff5d3dbe233f8fd1acd698b401aee44c.zip
* net/tramp-cache.el (tramp-flush-file-function): Wrap the code
with `save-match-data'. Fixes: debbugs:18095
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/tramp-cache.el18
2 files changed, 15 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8a916a7f110..5024dadcad9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12014-07-24 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp-cache.el (tramp-flush-file-function): Wrap the code
4 with `save-match-data'. (Bug#18095)
5
12014-07-21 Vincent Belaïche <vincentb1@users.sourceforge.net> 62014-07-21 Vincent Belaïche <vincentb1@users.sourceforge.net>
2 7
3 * ses.el (ses-truncate-cell): Use cl-progv instead of eval in 8 * ses.el (ses-truncate-cell): Use cl-progv instead of eval in
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index b5ef8c28d2d..838d326603c 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -201,17 +201,19 @@ Remove also properties of all files in subdirectories."
201;; Reverting or killing a buffer should also flush file properties. 201;; Reverting or killing a buffer should also flush file properties.
202;; They could have been changed outside Tramp. In eshell, "ls" would 202;; They could have been changed outside Tramp. In eshell, "ls" would
203;; not show proper directory contents when a file has been copied or 203;; not show proper directory contents when a file has been copied or
204;; deleted before. 204;; deleted before. We must apply `save-match-data', because it would
205;; corrupt other packages otherwise (reported from org).
205(defun tramp-flush-file-function () 206(defun tramp-flush-file-function ()
206 "Flush all Tramp cache properties from `buffer-file-name'. 207 "Flush all Tramp cache properties from `buffer-file-name'.
207This is suppressed for temporary buffers." 208This is suppressed for temporary buffers."
208 (unless (string-match "^ \\*temp\\*" (or (buffer-name) "")) 209 (save-match-data
209 (let ((bfn (if (stringp (buffer-file-name)) 210 (unless (string-match "^ \\*temp\\*" (or (buffer-name) ""))
210 (buffer-file-name) 211 (let ((bfn (if (stringp (buffer-file-name))
211 default-directory))) 212 (buffer-file-name)
212 (when (tramp-tramp-file-p bfn) 213 default-directory)))
213 (with-parsed-tramp-file-name bfn nil 214 (when (tramp-tramp-file-p bfn)
214 (tramp-flush-file-property v localname)))))) 215 (with-parsed-tramp-file-name bfn nil
216 (tramp-flush-file-property v localname)))))))
215 217
216(add-hook 'before-revert-hook 'tramp-flush-file-function) 218(add-hook 'before-revert-hook 'tramp-flush-file-function)
217(add-hook 'eshell-pre-command-hook 'tramp-flush-file-function) 219(add-hook 'eshell-pre-command-hook 'tramp-flush-file-function)