From: Juri Linkov Date: Mon, 19 Dec 2022 19:46:40 +0000 (+0200) Subject: * lisp/progmodes/project.el (project--read-file-cpd-relative): Optimize. X-Git-Tag: emacs-29.0.90~1064 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cfbfd393b450d4eb7ac0b7922b44208688553c9e;p=emacs.git * lisp/progmodes/project.el (project--read-file-cpd-relative): Optimize. --- diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 605636d93e3..c2633798473 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1040,13 +1040,14 @@ by the user at will." (setq substrings (cons "./" substrings)))) (new-collection (project--file-completion-table substrings)) (abbr-cpd (abbreviate-file-name common-parent-directory)) + (abbr-cpd-length (length abbr-cpd)) (relname (cl-letf ((history-add-new-input nil) ((symbol-value hist) (mapcan (lambda (s) (and (string-prefix-p abbr-cpd s) - (not (eq (length abbr-cpd) (length s))) - (list (substring s (length abbr-cpd))))) + (not (eq abbr-cpd-length (length s))) + (list (substring s abbr-cpd-length)))) (symbol-value hist)))) (project--completing-read-strict prompt new-collection