Skip to content

Commit 2be537e

Browse files
Minor updates to project.el
* lisp/progmodes/project.el (project-find-file): Add optional 'filename' arg. (project--completing-read-strict): Ignore 'default' set to empty string.
1 parent e4eb8c8 commit 2be537e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lisp/progmodes/project.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,14 @@ pattern to search for."
443443
(read-regexp "Find regexp" (and id (regexp-quote id)))))
444444

445445
;;;###autoload
446-
(defun project-find-file ()
446+
(defun project-find-file (&optional filename)
447447
"Visit a file (with completion) in the current project's roots.
448448
The completion default is the filename at point, if one is
449449
recognized."
450450
(interactive)
451451
(let* ((pr (project-current t))
452452
(dirs (project-roots pr)))
453-
(project-find-file-in (thing-at-point 'filename) dirs pr)))
453+
(project-find-file-in (or filename (thing-at-point 'filename)) dirs pr)))
454454

455455
;;;###autoload
456456
(defun project-or-external-find-file ()
@@ -522,7 +522,7 @@ PREDICATE, HIST, and DEFAULT have the same meaning as in
522522
;; removing it when it has no matches. Neither seems natural
523523
;; enough. Removal is confusing; early expansion makes the prompt
524524
;; too long.
525-
(let* ((new-prompt (if default
525+
(let* ((new-prompt (if (and default (not (string-equal default "")))
526526
(format "%s (default %s): " prompt default)
527527
(format "%s: " prompt)))
528528
(res (completing-read new-prompt

0 commit comments

Comments
 (0)