Open agzam opened 3 years ago
which-key--hide-popup - why would it try to hide the popup when it was never opened, I'm just moving cursor around?
which-key
:
(add-hook 'pre-command-hook #'which-key--hide-popup)
profiler
to see which functions cause the lag, and please post the profiler
report here in order to let us investigate the possible issues.I'm seeing this too. It's strange because I've used this package for a long time now, and only in the past few weeks has this become an issue for me. A few notes:
I don't see this issue on my Mac, which is running v28/master, from this project.
On GNU/Linux I'm using the v28/master + pgtk fork from the AUR. I think pgtk might be part of the problem. @agzam, are you using pgtk perchance? I'm not sure if it's a thing on Mac.
When I open something (e.g., a big .org file), moving the cursor around initially is slow; I'd disable which-key-posframe and, voila - it gets fast again. I would re-enable the mode - and it is still fast, it won't go back to lagging as when I open the file. So, it is slow only when the first time I open the file.
I observe this too, but it usually becomes slow again once I do something to actually activate which-key-posframe (eg <C-x>
, pause...).
I can reproduce this with a very minimal setup: emacs -Q
and then:
(require 'which-key)
(require 'which-key-posframe)
(which-key-mode 1)
(which-key-posframe-mode 1)
...so I think we can rule out interactions with other packages.
Maybe you can use profiler to see which functions cause the lag, and please post the profiler report here in order to let us investigate the possible issues.
Here's mine:
626 46% - which-key--hide-popup
621 45% - which-key--hide-popup-ignore-command
621 45% - which-key-posframe--hide
604 44% posframe-hide
264 19% + timer-event-handler
173 12% + command-execute
122 9% + eldoc-pre-command-refresh-echo-area
113 8% + redisplay_internal (C function)
19 1% + sp--save-pre-command-state
12 0% + winner-save-old-configurations
8 0% + evil--jump-hook
5 0% + evil-repeat-pre-hook
4 0% + global-hl-line-highlight
3 0% sp--post-command-hook-handler
3 0% + highlight-parentheses--initiate-highlight
3 0% + evil-escape-pre-command-hook
0 0% + ...
I started using the package, and recently I realized - for some reason, just moving the cursor around got noticeably slower. Profiler showed some which-key related functions to blame, i.e.:
which-key--hide-popup
- why would it try to hide the popup when it was never opened, I'm just moving cursor around? upd: it seems that function runs regardless of which-key-posframe - either it's enabled or not.. For a while I thought there's something in my which-key settings causing that. Then after spending some more time, I found the culprit - it's which-key-posframe.
However, it is not as straightforward as saying "the package has issues". Interestingly, this is what's happening:
I have which-key and which-key-posframe enabled with the settings such these:
When I open something (e.g., a big .org file), moving the cursor around initially is slow; I'd disable which-key-posframe and, voila - it gets fast again. I would re-enable the mode - and it is still fast, it won't go back to lagging as when I open the file. So, it is slow only when the first time I open the file.
I'm not exactly sure what's causing it. It could be Emacs 28 with native comp, or a Mac-specific problem.
I'll leave this here just in case someone experienced similar problems or suggests a work around.