diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 7cdaba9c07..47eb9f9982 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1038,7 +1038,14 @@ project--read-file-cpd-relative (_ (when included-cpd (setq substrings (cons "./" 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 new-collection predicate