From: Noam Postavsky Date: Wed, 18 Jul 2018 22:45:47 +0000 (-0400) Subject: Add save-match-data to abbreviate-file-name (Bug#32201) X-Git-Tag: emacs-26.1.90~250 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=59e8533286cc8b5abc80b0966ef4b9fb676fbdfe;p=emacs.git Add save-match-data to abbreviate-file-name (Bug#32201) * lisp/files.el (abbreviate-file-name): Save match-data around expand-file-name; it is not guaranteed to preserve match-data, and may well do so depending on what file handlers and hooks are in effect. --- diff --git a/lisp/files.el b/lisp/files.el index fb8c34bcae8..4eb1560a20d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1929,7 +1929,7 @@ started Emacs, set `abbreviated-home-dir' to nil so it will be recalculated)." (save-match-data (string-match "^[a-zA-`]:/$" filename)))) (equal (get 'abbreviated-home-dir 'home) - (expand-file-name "~"))) + (save-match-data (expand-file-name "~")))) (setq filename (concat "~" (match-string 1 filename)