(project--remove-from-project-list
project-root "Project `%s' removed from known projects"))
+(put 'project-forget-project 'minibuffer-action
+ (cons
+ (lambda (name)
+ (project-forget-project
+ (or (get-text-property 0 'project-root name)
+ (seq-find (lambda (dir)
+ (when-let ((proj (project-current nil dir)))
+ (string= (project-name proj) name)))
+ (project-known-project-roots)))))
+ "forget"))
+
(defvar project--dir-history)
(defun project-prompt-project-dir (&optional prompt)
name as the initial input for completion, and return that directory."
(let* ((current (project-current))
(default (and current (project-name current)))
- (name (completing-read (format-prompt (or prompt "Project") default)
- (lambda (string pred action)
- (if (eq action 'metadata)
- `(metadata (sort-function . minibuffer-sort-alphabetically))
- (complete-with-action
- action
- (seq-keep (lambda (dir)
- (when-let ((proj (project-current nil dir)))
- (project-name proj)))
- (project-known-project-roots))
- string pred)))
- nil nil nil
- 'project-name-history
- default)))
+ (name
+ (minibuffer-with-setup-hook
+ (lambda () (setq completion-max-replace-secs 0))
+ (completing-read (format-prompt (or prompt "Project") default)
+ (lambda (string pred action)
+ (if (eq action 'metadata)
+ `(metadata (sort-function . minibuffer-sort-alphabetically))
+ (complete-with-action
+ action
+ (seq-keep (lambda (dir)
+ (when-let ((proj (project-current nil dir))
+ (name (project-name proj)))
+ (propertize name 'project-root dir)))
+ (project-known-project-roots))
+ string pred)))
+ nil nil nil
+ 'project-name-history
+ default))))
(or (seq-find (lambda (dir)
(when-let ((proj (project-current nil dir)))
(string= (project-name proj) name)))