Comments (3)
Currently, I'm achieving this feature by means of the following code:
(use-package which-key
:custom
(which-key-mode t)
(which-key-show-early-on-C-h 'prompt))
(defun my/which-key--before-C-h-dispatch ()
(when (and (not (which-key--popup-showing-p))
(eq which-key-show-early-on-C-h 'prompt))
(which-key--create-buffer-and-show (kbd (which-key--current-key-string)))
(setq unread-command-events (listify-key-sequence
(kbd (which-key--current-key-string))))))
(advice-add 'which-key-C-h-dispatch :before #'my/which-key--before-C-h-dispatch)
Basically, if which-key-show-early-on-C-h
is set with the 'prompt
symbol, then a which-key window gets shown instantly after the invocation of which-key-C-h-dispatch
and the same key sequence is fed again by means of the unread-command-events
variable.
I'm showing this code just to give an idea of the feature. It seems to work but since the package does contain some timer based mechanisms i don't know if there are some gimmicks that I'm ignoring right now by displaying the which key windows instantly.
from emacs-which-key.
You're right that the behavior of C-h
depends on whether the which-key buffer is showing when it's pressed, but I'm not sure of the purpose of your advice function. It appears to do the same thing as the first condition in which-key-C-h-dispatch
as long as 'prompt
is used.
The original purpose of using C-h
to show the which-key
buffer was to have a way to turn off the automatic display time and allow for it to be shown "on demand". If this is how it's used, the timing issue you mention is not a problem. In other words, this is not the intended setup for this option (see the docstring of which-key-show-early-on-C-h
).
That being said, I may be able to help if you can describe more precisely what you are trying to achieve with this option.
from emacs-which-key.
Thank you for your help. I'll try to describe my issue with some gifs, I hope to be clear.
I do use which-key
with the default behaviour: its window automatically pops out 1 second after a prefix key.
I often would like to invoke describe-prefix-bindings
command in order to get a more detailed view of the available commands under a specific keymap. This command is under which-key-C-h-map
by default.
Here is what happens when I try to type C-x C-h
a few times:
I don't know why the which key window appears earlier than expected, but this leads the C-x C-h
behaviour to be rather inconsistent: sometimes it shows the which-key window, sometimes it prompts for a command.
This is the bahaviour of C-x C-h
with the patch:
This way, describe-prefix-bindings
can always be called with <prefixes> C-h C-h
, regardless of whether the which-key window was already shown or not. This applies to any other command that I could add to the which-key-C-h-map
.
from emacs-which-key.
Related Issues (20)
- custom string replacement: ambiguous example in README HOT 6
- which-key-mode appears in which-key-faces customize group HOT 1
- Composition not being used in which-key buffer HOT 2
- BUG: conflict between which-key-window and avy-goto-char-2. HOT 2
- which-key menu misalignment with ellipsis char HOT 1
- Setting which-key-show-operator-state-maps to true "breaks" outer and inner evil maps HOT 1
- which-key crashes when trying to display term-raw-map HOT 1
- How to switch among different pages of keys conveniently in which-key mode? HOT 1
- which-key canβt show keys: There is not enough space based on your settings and frame size HOT 2
- Customize which-key-C-h-dispatch prompt HOT 1
- The texts for the same key in different keymaps are overridden each other HOT 2
- Question about `which-key-undo` HOT 1
- which-key is good enough to be built-into Emacs HOT 1
- Question about full description popups HOT 3
- Automatic expansion of unnamed prefixes
- misoperation
- Once which-key popup is triggered via which-key-show-early-on-C-h all delays are ignored afterwards HOT 1
- Which-key shows wrong labels from inactive keymaps HOT 1
- Side window is too narrow HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacs-which-key.