]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/project.el (project--read-file-cpd-relative): Optimize.
authorJuri Linkov <juri@linkov.net>
Mon, 19 Dec 2022 19:46:40 +0000 (21:46 +0200)
committerJuri Linkov <juri@linkov.net>
Mon, 19 Dec 2022 19:47:28 +0000 (21:47 +0200)
lisp/progmodes/project.el

index 605636d93e36439551d5763d902f6da74812c23f..c263379847365035a8270e058a8b1b3d9cf4de65 100644 (file)
@@ -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