[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] emacs-26 59e8533 1/3: Add save-match-data to abbreviat
Re: [Emacs-diffs] emacs-26 59e8533 1/3: Add save-match-data to abbreviate-file-name (Bug#32201)
Tue, 23 Oct 2018 21:15:12 -0400
On Tue, 16 Oct 2018 at 21:50, Stefan Monnier <address@hidden> wrote:
> > @@ -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)
> Wouldn't it better to read (match-string 1 filename) earlier?
> `save-match-data` is a costly operation compared to (match-string
> 1 filename), so it doesn't make much sense to use it everywhere
> between the match and the final (match-string 1 filename).
Yeah, I think I kind of added it mindlessly, following the
save-match-data in the previous clause.