docker.el icon indicating copy to clipboard operation
docker.el copied to clipboard

Enable completion of directories when selecting a compose file

Open heaysa opened this issue 2 years ago • 3 comments

docker-compose-read-compose-file completes *.yaml and *.yml filenames but not directories, which must be manually typed if the desired compose file is not in the initial input.I use a custom function to get around this, which may warrant consideration as a feature in docker.el.

(defun docker-compose-read-compose-file (prompt &optional initial-input _history)
  "Wrapper around `read-file-name' forwarding PROMPT and INITIAL-INPUT."
  (read-file-name prompt nil nil t initial-input 
                  (lambda (file-name)
                    (or (file-directory-p file-name)
                        (string-match ".*\\.yml\\|.*\\.yaml" file-name)))))

heaysa avatar Nov 29 '23 00:11 heaysa

Hum. Are there drawbacks from replacing the current function with your implementation?

Silex avatar Nov 29 '23 21:11 Silex

The main one I can think of is that there will be as many completion candidates to choose from as there are directories, rather than just one, or a few, yaml files; one of which is often the sought file.

I am also using vertico for the actual completion selection, and if the emacs window is small and the number of completions large then the sharing of minibuffer space between vertico candidates and the transient stuff above causes the prompt to disappear. But that sounds like a separate issue. Shown below.

Not too many candidates:

ok

Too many candidates:

not_ok

heaysa avatar Nov 30 '23 00:11 heaysa

Sorry was very busy. Will try to work on this.

Silex avatar Aug 04 '24 20:08 Silex