GNU bug report logs -
#63648
29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands
Previous Next
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
>> And indeed with the following patch replacing the current definition of
>> 'project-switch-project' with just:
>>
>> (defun project-switch-project (dir)
>> (interactive (list (funcall project-prompter)))
>> (setq next-default-directory dir))
>
> This would be a new "prefix command", like the `universal-argument`,
> `C-x RET c`, the `ofw-other-window`, vc-edit-next-command,
> `ofw-other-frame` from the `other-frame-window` package, and a few more.
>
> In order for this new prefix to interact correctly with those other
> ones, it should probably use `prefix-command-preserve-state` and it
> would be good to make it show some visual feedback via
> `prefix-command-echo-keystrokes-functions`.
Here is the same function turned into a prefix command,
so it supports both cases:
1. 'C-x p p d' -- keys from project-prefix-map
2. 'C-x p p C-x d' -- global keybindings
```
(defun project-switch-project (dir)
(interactive (list (funcall project-prompter)))
(if (symbolp project-switch-commands)
(let ((default-directory dir))
(call-interactively project-switch-commands))
(let* ((echofun (lambda () "[switch-project]"))
(postfun (lambda () (remove-hook
'prefix-command-echo-keystrokes-functions
echofun))))
(setq next-default-directory dir)
(add-hook 'prefix-command-echo-keystrokes-functions echofun)
(message (project--keymap-prompt))
(prefix-command-update)
(set-transient-map project-prefix-map nil postfun))))
```
If this is conceptually ok, then more customization could be ported
from project--switch-project-command such as project-switch-use-entire-map.
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.