Fix performance issue with file comparison on Windows
`file-equal-p` makes creating links too slow with bookmark links enabled (which is the case by default).
This commit is contained in:
parent
4ddb17f204
commit
e32a67d666
@ -2241,7 +2241,11 @@ PARAMS may contain the following values:
|
|||||||
|
|
||||||
When in Dired, try to find bookmark that points to the file at
|
When in Dired, try to find bookmark that points to the file at
|
||||||
point. When in a buffer associated with a file, try to find a
|
point. When in a buffer associated with a file, try to find a
|
||||||
bookmark that points to this file."
|
bookmark that points to this file. Note that in this case, for
|
||||||
|
performance reasons, equality checks between file names is not
|
||||||
|
done with `file-equal-p', which seems to be too slow on Windows;
|
||||||
|
a simple `string=' is used instead, which may not be completely
|
||||||
|
accurate in certain cases."
|
||||||
(let (file bookmark bmks)
|
(let (file bookmark bmks)
|
||||||
(cond ((eq major-mode 'dired-mode)
|
(cond ((eq major-mode 'dired-mode)
|
||||||
(setq file (abbreviate-file-name (dired-get-filename))))
|
(setq file (abbreviate-file-name (dired-get-filename))))
|
||||||
@ -2254,9 +2258,9 @@ bookmark that points to this file."
|
|||||||
(when (setq bmks
|
(when (setq bmks
|
||||||
(->> (bookmark-all-names)
|
(->> (bookmark-all-names)
|
||||||
(-map (lambda (name)
|
(-map (lambda (name)
|
||||||
(if (file-equal-p file
|
(if (string= file
|
||||||
(abbreviate-file-name
|
(abbreviate-file-name
|
||||||
(bookmark-location name)))
|
(bookmark-location name)))
|
||||||
name)))
|
name)))
|
||||||
(delete nil)))
|
(delete nil)))
|
||||||
(setq bookmark
|
(setq bookmark
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user