From e32a67d66603aad1564b74bb298ab0b26355e558 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 22 Feb 2025 18:07:41 +0100 Subject: [PATCH] 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). --- site-lisp/db-org.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 437720d..3ded8be 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -2241,7 +2241,11 @@ PARAMS may contain the following values: 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 -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) (cond ((eq major-mode 'dired-mode) (setq file (abbreviate-file-name (dired-get-filename)))) @@ -2254,9 +2258,9 @@ bookmark that points to this file." (when (setq bmks (->> (bookmark-all-names) (-map (lambda (name) - (if (file-equal-p file - (abbreviate-file-name - (bookmark-location name))) + (if (string= file + (abbreviate-file-name + (bookmark-location name))) name))) (delete nil))) (setq bookmark