diff options
| author | Juri Linkov | 2024-05-28 19:31:55 +0300 |
|---|---|---|
| committer | Juri Linkov | 2024-05-28 19:31:55 +0300 |
| commit | ebac4d4872829c44f65966b3268ceaf7ecbf43d9 (patch) | |
| tree | 37dcf02983e87d313275e88a9af4d68b1991ac03 | |
| parent | d9512da49514623ef3e35524dc894c06f2c0ce20 (diff) | |
| download | emacs-ebac4d4872829c44f65966b3268ceaf7ecbf43d9.tar.gz emacs-ebac4d4872829c44f65966b3268ceaf7ecbf43d9.zip | |
Provide a list of default values for M-n of project-find-file (bug#70996)
* lisp/progmodes/project.el (project-find-file)
(project-or-external-find-file): Provide a list of suggested
filenames for the first arg of project-find-file-in.
Use buffer-file-name first to make it more predictable for M-n.
(project--read-file-cpd-relative): Handle mb-default as a list.
| -rw-r--r-- | lisp/progmodes/project.el | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index dceca2eab48..8a8b4fc33d6 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -1080,8 +1080,9 @@ for VCS directories listed in `vc-directory-exclusion-list'." | |||
| 1080 | (dirs (list root)) | 1080 | (dirs (list root)) |
| 1081 | (project-files-relative-names t)) | 1081 | (project-files-relative-names t)) |
| 1082 | (project-find-file-in | 1082 | (project-find-file-in |
| 1083 | (or (thing-at-point 'filename) | 1083 | (delq nil (list (and buffer-file-name (project--find-default-from |
| 1084 | (and buffer-file-name (project--find-default-from buffer-file-name pr))) | 1084 | buffer-file-name pr)) |
| 1085 | (thing-at-point 'filename))) | ||
| 1085 | dirs pr include-all))) | 1086 | dirs pr include-all))) |
| 1086 | 1087 | ||
| 1087 | ;;;###autoload | 1088 | ;;;###autoload |
| @@ -1103,8 +1104,9 @@ for VCS directories listed in `vc-directory-exclusion-list'." | |||
| 1103 | (project-external-roots pr))) | 1104 | (project-external-roots pr))) |
| 1104 | (project-file-history-behavior t)) | 1105 | (project-file-history-behavior t)) |
| 1105 | (project-find-file-in | 1106 | (project-find-file-in |
| 1106 | (or (thing-at-point 'filename) | 1107 | (delq nil (list (and buffer-file-name (project--find-default-from |
| 1107 | (and buffer-file-name (project--find-default-from buffer-file-name pr))) | 1108 | buffer-file-name pr)) |
| 1109 | (thing-at-point 'filename))) | ||
| 1108 | dirs pr include-all))) | 1110 | dirs pr include-all))) |
| 1109 | 1111 | ||
| 1110 | (defcustom project-read-file-name-function #'project--read-file-cpd-relative | 1112 | (defcustom project-read-file-name-function #'project--read-file-cpd-relative |
| @@ -1166,11 +1168,14 @@ by the user at will." | |||
| 1166 | (setq all-files | 1168 | (setq all-files |
| 1167 | (delete common-parent-directory all-files)) | 1169 | (delete common-parent-directory all-files)) |
| 1168 | t)) | 1170 | t)) |
| 1169 | (mb-default (if (and common-parent-directory | 1171 | (mb-default (mapcar (lambda (mb-default) |
| 1170 | mb-default | 1172 | (if (and common-parent-directory |
| 1171 | (file-name-absolute-p mb-default)) | 1173 | mb-default |
| 1172 | (file-relative-name mb-default common-parent-directory) | 1174 | (file-name-absolute-p mb-default)) |
| 1173 | mb-default)) | 1175 | (file-relative-name |
| 1176 | mb-default common-parent-directory) | ||
| 1177 | mb-default)) | ||
| 1178 | (if (listp mb-default) mb-default (list mb-default)))) | ||
| 1174 | (substrings (mapcar (lambda (s) (substring s cpd-length)) all-files)) | 1179 | (substrings (mapcar (lambda (s) (substring s cpd-length)) all-files)) |
| 1175 | (_ (when included-cpd | 1180 | (_ (when included-cpd |
| 1176 | (setq substrings (cons "./" substrings)))) | 1181 | (setq substrings (cons "./" substrings)))) |