armindarvish / consult-gh

An Interactive interface for "GitHub CLI" client inside GNU Emacs using Consult

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ergonomic default values for consult-gh-repo-clone

oantolin opened this issue · comments

I was a little surprised that consult-gh-repo-clone didn't seem to have a quick way to choose consult-gh-default-clone-directory as the location for the cloned repo. I was also surprised it made me type out the name. I'd suggest that for the target directory, consult-gh-default-clone-directory be placed on the future history, so a simple M-n would fill it in. And as for the name, it should default to the name of the repo.

Yes, that makes sense. I did not test consult-gh-repo-clone extensively because my usual path so far has been through consult-gh-search-repos and then using embark to call clone action so I kind of didn't spend enough time thinking about and polishing the consult-gh-repo-clone. I think consult-gh-repo-fork may need similar improvements as well. I'll take a look at those once I merge some of these other enhancement features I'm implementing now.

Alright I ended up doing something slightly different than adding to future history. The consult-gh-default-clone-directory is now the initial-input in minibuffer. You can also pass en empty string for current directory (default-directory).

I also reimplemented consult-gh-repo-clone and consult-gh-repo-fork so that they can now take multiple repos by using crm-separator.

Thanks for the fix! Having the repo name be the initial input for the name is perfect. But I have my doubts about making consult-gh-default-clone-directory the initial input for the directory, and the reason is that it makes it a little awkward to use default-directory for Vertico users. As you mentioned, you can use the empty string for that, but to enter the empty string you need to first delete the initial input (which is fine, C-0 C-k or C-S-<backspace> will do it); when you do that the subdirectories of consult-gh-default-clone-directory become the candidates, and you need to use M-RET (vertico-accept) to accept the empty string. If you press RET by accident instead you get the first subdirectory of consult-gh-default-clone-directory.

I still think that for the directory it would be better to use future history (but for the name, definitely initial input is a good idea).

Hmmm, that's a good point, but I still prefer to do it the other way around; meaning the default entry is consult-gh-default-clone-directory but the future history is default-directory. So you can do "M-n" to get the default-directory if you want.
I think this would be more consistent with setting consult-gh-default-clone-directory and also more intuitive, because often you do not want to clone a repository in the directory you are actively working in!

This is now done in develop branch.

Sounds good, thanks!