bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41821: 28.0.50; read-directory-name in vc commands should provide de


From: Dmitry Gutov
Subject: bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects
Date: Thu, 2 Jul 2020 17:39:25 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

On 02.07.2020 01:10, Juri Linkov wrote:
we at least put this feature request on hold (and, for now,
revert the installed patches).

Ok, reverted the installed patches.

It's easy to achieve the same in the init file with these
simple advises.  Now this works perfectly from POV of users
who prefer to use project directories everywhere in all prompts
that ask for a directory:

#+begin_src emacs-lisp
;; When a prompt of some commands such as 'rgrep' or 'vc-print-log' asks for
;; a directory name, allow 'M-n' to access the most recently used project
;; directories saved in ~/.emacs.d/projects:

(advice-add 'read-directory-name :around

I figured you might want to define a vc-specific wrapper function for read-directory-name, for ease of advising. But now I'm not so sure.

                 (when (featurep 'project)
                   ;; Update project list with selected project dir
                   (let ((default-directory ret))
                     (project-current t)))

The 't' argument is counter-productive here. You don't want it to prompt, which will happen when the target directory is in the end outside of any detected projects.

And really if you just do this in an ad-hoc advice (and recommend it to other users), it's probably better to just remove this call for simplicity. After all, you probably interact with "proper" project commands anyway. And they will put the current project at the top of the history.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]