GNU bug report logs - #63648
29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Mon, 22 May 2023 16:29:02 UTC

Severity: normal

Found in version 29.0.90

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: Spencer Baugh <sbaugh <at> janestreet.com>, 63648 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: bug#63648: 29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands
Date: Wed, 1 Nov 2023 23:12:15 +0200
[Message part 1 (text/plain, inline)]
On 28/10/2023 19:56, Juri Linkov wrote:
>>>>>> +         ;; Variation: could be a separate command, or an option.
>>>>>> +         ;; (command (let ((overriding-local-map project-prefix-map))
>>>>>> +         ;;            (key-binding (read-key-sequence
>>>>>> +         ;;                          (format "[execute in %s]:" (project-root pr)))
>>>>>> +         ;;                         t)))
>>>>> Thanks, it works nicely.
>>>>> Any reason not to use this by default?
>>>>
>>>> Nothing critical, but it might not fit the expectations without additional
>>>> instructions in the prompt, or it can be unnecessary if the user had
>>>> reached this command through 'C-x p o'.
>>> Indeed, this is needed only for 'C-x p p' that supports the global map.
>>>
>>>> In the latter case there is also a small chance that the user had set up
>>>> some advanced sub-maps inside project-prefix-map which would shadow some
>>>> global bindings. So maybe a separate command is best. Please see how you
>>>> like the attached new version together with
>>>>
>>>>     (setq project-switch-commands #'project-prefix-or-any-command)
>>> A separate command that is not used anywhere looks strange.
>>> Why not a simple option like 'project-switch-use-entire-map'?
>>
>> You would still need to change project-switch-commands, right? Or what
>> would the option be called?
> 
> I expected 'project-switch-use-global-map' to be used
> by 'project--switch-project-command' without the need
> to customize 'project-switch-commands'.

How about this, then?

project-switch-use-global-map is obsoleted, all variations are 
accessible through customizing project-switch-commands. Should have 
better discoverability for project-prefix-or-any-command than simply 
having it included.

>>>> I'm not sure about project-prefix-or-any-command's prompt, though (phrasing
>>>> feels awkward). Improvements welcome.
>>> I'm not a fan of the long prompt especially that wraps to the second
>>> line.
>>
>> It didn't wrap for me.
> 
> Because the length depends on the deepness of the project root.
> 
>> But if it's too long, how would you like it changed?
>> Remove everything? Just keep [executing in ...]?
> 
> I'd prefer keeping only [executing in ...] because it's useful
> to confirm in which directory the command will be executed.
> But all available keys are usually useless except in such modes
> as help-quick for novices.

I don't like having a prompt that requires prior knowledge to use, but 
fair enough, let's just use [executing in ...] for now. Perhaps someone 
will suggest an alternative later.

The new revision is attached, have a look.
[project-other-command-v5.diff (text/x-patch, attachment)]

This bug report was last modified 1 year and 200 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.