doomemacs / doomemacs

An Emacs framework for the stubborn martian hacker
MIT License
19.46k stars 3.06k forks source link

which-key descriptions not being replaced after rebinding #7887

Open yaaama opened 4 months ago

yaaama commented 4 months ago

I confirm that...

I have seen others raise issues on this before but the solutions don't seem to work for me, maybe I am missing something

Expected behavior

I want to rebind some keys that are occupied by module specific functions that I have not enabled, but the whichkey descriptions are not updating.

I am trying different ways of rebinding and I can't seem to figure it out, I have tried which-key-add.... functions and unbinding the keys first to try replacing it manually but to no avail.

Here are a few of the permutations I have tried:

(map! :desc "Dict at pt search" :leader "s t" #'+dict/describe-word-at-pt
      :desc "Dict Search" :leader "s T" #'+dict/describe-word)

(map! :leader :prefix "s"
      :desc "Dict at pt search" "t" #'+dict/describe-word-at-pt
      :desc "Dict Search" "T" #'+dict/describe-word)

(map! :leader
      :prefix ("s" . "search")
      :desc "Dict at pt search" "t" #'+dict/describe-word-at-pt
      :desc "Dict Search" "T" #'+dict/describe-word)

(map! :map doom-leader-map
      :desc "Dict at pt search" "s t" #'+dict/describe-word-at-pt
      :desc "Dict Search" "s T" #'+dict/describe-word)

I wanted to mention that this has been a problem for a while now and I have only gotten around to trying to investigate the problem just now (hence why the example I gave above is silly as the <leader> s t keys already map to a description about "Dictionaries").

Thank you

Current behavior

The which key descriptions continue to say "Dictionary" and "Thesaurus"

Steps to reproduce

Rebind the leader map keys

System Information

https://pastebin.com/f4Ld7vgL

anuvyklack commented 3 months ago

I face the same problem, but one of the ways worked for me.

When I set keybindins next way, the descriptions don't apply:

(map! :map doom-leader-toggle-map
      (:when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot)))
       :desc "Code-lens"    "l" #'lsp-lens-mode
       :desc "Line numbers" "L" #'doom/toggle-line-numbers))

But when I reproduce the way they are set up in Doom's initial configs, the descriptions apply:

(map! :leader
      (:prefix-map ("t" . "toggle")
       (:when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot)))
        :desc "Code-lens"    "l" #'lsp-lens-mode
        :desc "Line numbers" "L" #'doom/toggle-line-numbers)))

I'm using evil, if it matters.

yaaama commented 3 months ago

I face the same problem, but one of the ways worked for me.

When I set keybindins next way, the descriptions don't apply:

(map! :map doom-leader-toggle-map
      (:when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot)))
       :desc "Code-lens"    "l" #'lsp-lens-mode
       :desc "Line numbers" "L" #'doom/toggle-line-numbers))

But when I reproduce the way they are set up in Doom's initial configs, the descriptions apply:

(map! :leader
      (:prefix-map ("t" . "toggle")
       (:when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot)))
        :desc "Code-lens"    "l" #'lsp-lens-mode
        :desc "Line numbers" "L" #'doom/toggle-line-numbers)))

I'm using evil, if it matters.

Unfortunately this does not work for me either.

Here is what I have:

(map! :leader
(:prefix-map ("t" . "toggle")
       :desc "Doom profiler" "P" #'doom/toggle-profiler
       :desc "Olivetti" "C" #'olivetti-mode
       :desc "Outline Minor Faces" "O" #'outline-minor-faces-mode
       :desc "Rainbow Mode" "c" #'rainbow-mode
       :desc "Doom debug mode" "d" #'doom-debug-mode
       :desc "Size indication mode" "S" #'size-indication-mode
       :desc "Indent bars mode" "i" #'indent-bars-mode))

Rainbow mode is still not replacing the previous key description (Fill column indicator).