When completing relative project file names, use relative history
* lisp/progmodes/project.el: Require 'cl-lib'. * lisp/progmodes/project.el (project--read-file-cpd-relative): Pre-process history entries around completing-read (bug#58447). This includes both filtering by common-parent-directory prefix and mapping into relative names.
This commit is contained in:
parent
3b618d0e3e
commit
c8d75046a2
1 changed files with 9 additions and 1 deletions
|
@ -174,6 +174,7 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(require 'cl-generic)
|
(require 'cl-generic)
|
||||||
|
(require 'cl-lib)
|
||||||
(require 'seq)
|
(require 'seq)
|
||||||
(eval-when-compile (require 'subr-x))
|
(eval-when-compile (require 'subr-x))
|
||||||
|
|
||||||
|
@ -1038,7 +1039,14 @@ by the user at will."
|
||||||
(_ (when included-cpd
|
(_ (when included-cpd
|
||||||
(setq substrings (cons "./" substrings))))
|
(setq substrings (cons "./" substrings))))
|
||||||
(new-collection (project--file-completion-table substrings))
|
(new-collection (project--file-completion-table substrings))
|
||||||
(relname (let ((history-add-new-input nil))
|
(abbr-cpd (abbreviate-file-name common-parent-directory))
|
||||||
|
(relname (cl-letf ((history-add-new-input nil)
|
||||||
|
((symbol-value hist)
|
||||||
|
(mapcan
|
||||||
|
(lambda (s)
|
||||||
|
(and (string-prefix-p abbr-cpd s)
|
||||||
|
(list (substring s (length abbr-cpd)))))
|
||||||
|
(symbol-value hist))))
|
||||||
(project--completing-read-strict prompt
|
(project--completing-read-strict prompt
|
||||||
new-collection
|
new-collection
|
||||||
predicate
|
predicate
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue