GNU bug report logs -
#70577
[PATCH] New command other-project-prefix
Previous Next
Full log
Message #101 received at 70577 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 15/05/2024 09:46, Juri Linkov wrote:
>>>> +(defvar other-project-prefix-transient-commands '(project-other-window-command
>>>> + project-other-frame-command
>>>> + project-other-tab-command
>>>> + other-window-prefix
>>>> + other-frame-prefix
>>>> + other-tab-prefix)
>>>> + "List of commands that `other-project-prefix' does not apply to.
>>> This doesn't yet support such things as 'C-x 5 p p'?
>>
>> I'm not sure that other-project-prefix can do that.
>>
>> How does other-frame-prefix work? display-buffer-override-next-command sets
>> up hooks in the very familiar fashion, so that the next command (and only
>> the next command) is affected by a number of changed variables, which get
>> restored after.
>>
>> I suppose other-project-prefix could learn all the new variables it needs
>> to "carry on", look up their values, and set them additionally for the next
>> command. But that seems very ad-hoc.
>>
>> It seems the "proper" way to fix that would be a cross-codebase change
>> where all similar "prefix" commands themselves check whether the next
>> command is a "prefix" command as well, and if so, keep the variables and
>> hooks in place for the command after it. This would also mean moving the
>> information from other-project-prefix-transient-commands to symbol
>> properties (the alternative I've mentioned previously).
>
> In https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63648#95
> I made an unfinished attempt to handle this by:
>
> ```
> diff --git a/lisp/window.el b/lisp/window.el
> index ab7dd5ced12..52ba407d9c8 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -9099,7 +9091,8 @@ display-buffer-override-next-command
> (> (minibuffer-depth) minibuffer-depth)
> ;; But don't remove immediately after
> ;; adding the hook by the same command below.
> - (eq this-command command))
> + (eq this-command command)
> + (memq this-command '(other-project-prefix)))
> (funcall exitfun))))
> ;; Call post-function after the next command finishes (bug#49057).
> (add-hook 'post-command-hook postfun)
> ```
>
> I'm not sure if this is a proper way, this needs more trial-and-error.
Looks like you were thinking along similar lines.
Here's a patch using symbol properties that makes the prefix commands
work combined in arbitrary order. At least according to my limited
testing - and only the commands that have this property set, of course.
Something to discuss:
- A better name for the property? Maybe something longer would be more
obvious for an accidental reader.
- Applying it through 'declare' forms could be a more self-contained
approach.
[other-project-prefix-v6.diff (text/x-patch, attachment)]
This bug report was last modified 125 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.