From: Michael Albinus Date: Thu, 24 Jul 2014 07:30:36 +0000 (+0200) Subject: * net/tramp-cache.el (tramp-flush-file-function): Wrap the code X-Git-Tag: emacs-25.0.90~2636^3~48 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=934eeab5ff5d3dbe233f8fd1acd698b401aee44c;p=emacs.git * net/tramp-cache.el (tramp-flush-file-function): Wrap the code with `save-match-data'. Fixes: debbugs:18095 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8a916a7f110..5024dadcad9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-24 Michael Albinus + + * net/tramp-cache.el (tramp-flush-file-function): Wrap the code + with `save-match-data'. (Bug#18095) + 2014-07-21 Vincent Belaïche * 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." ;; Reverting or killing a buffer should also flush file properties. ;; They could have been changed outside Tramp. In eshell, "ls" would ;; not show proper directory contents when a file has been copied or -;; deleted before. +;; deleted before. We must apply `save-match-data', because it would +;; corrupt other packages otherwise (reported from org). (defun tramp-flush-file-function () "Flush all Tramp cache properties from `buffer-file-name'. This is suppressed for temporary buffers." - (unless (string-match "^ \\*temp\\*" (or (buffer-name) "")) - (let ((bfn (if (stringp (buffer-file-name)) - (buffer-file-name) - default-directory))) - (when (tramp-tramp-file-p bfn) - (with-parsed-tramp-file-name bfn nil - (tramp-flush-file-property v localname)))))) + (save-match-data + (unless (string-match "^ \\*temp\\*" (or (buffer-name) "")) + (let ((bfn (if (stringp (buffer-file-name)) + (buffer-file-name) + default-directory))) + (when (tramp-tramp-file-p bfn) + (with-parsed-tramp-file-name bfn nil + (tramp-flush-file-property v localname))))))) (add-hook 'before-revert-hook 'tramp-flush-file-function) (add-hook 'eshell-pre-command-hook 'tramp-flush-file-function)