[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45134: Add project-switch-project-by-name
From: |
Rudolf Schlatte |
Subject: |
bug#45134: Add project-switch-project-by-name |
Date: |
Wed, 09 Dec 2020 16:42:23 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Rudolf Schlatte <rudi@constantly.at> writes:
>
>> Certain “dashboard-type” packages present a list of projects and let the
>> user switch to one of them. In that case, the project root is already
>> known, and project.el only needs to present the dispatch menu of
>> ‘project-switch-commands’. As an example, see
>> ‘dashboard-projects-switch-function’ at
>> https://github.com/emacs-dashboard/emacs-dashboard/blob/75f0c46db03b40ec983dbf4aa81e2ccb2e4a16ef/dashboard-widgets.el#L696
>>
>> This patch adds a function ‘project-switch-project-by-name’, analogous
>> to ‘projectile-switch-project-by-name’. I hope the diff makes it
>> through unmangled..
>
> Makes sense to me.
>
>> +(defun project-switch-project-by-name (project-root)
>> + "\"Switch\" to the project in PROJECT-ROOT and run an Emacs command.
>
> But is this the best name for this function? PROJECT-ROOT isn't the
> name of the project, but a directory.
You mean the argument name? Fine with renaming that - PROJECT-DIR or
DIR are all ok (DIR is used in ‘project-switch-project’ just above the
added function, so maybe that’s best).
Even though the argument is a directory, I chose the function name
‘project-switch-project-by-name’ to stay close to projectile, which uses
‘projectile-switch-project-by-name’ for the analogous function.