justbur / emacs-which-key

Emacs package that displays available keybindings in popup
GNU General Public License v3.0
1.74k stars 87 forks source link

Trasient maps support #307

Open Ergus opened 3 years ago

Ergus commented 3 years ago

Hi:

I am wondering whether is it something available to provide some support for transient-maps. I mean; is it possible to show some hints with which-key when a transient-map is active?

justbur commented 3 years ago

Isn't the point of transient maps to show you the available key bindings? Are you talking about this package?

Ergus commented 3 years ago

Are you talking about this package?

No, I was referring to the set-transient-map function: https://www.gnu.org/software/emacs/manual/html_node/elisp/Controlling-Active-Maps.html

Ergus commented 3 years ago

The only package that offers more or less a similar functionality is hydra... but it is a little bit too much for basic uses and to go into vanilla as which-keys is expected to do hopefully very soon.

trev-dev commented 2 years ago

Just chiming in here. I've set myself up with a command to activate a sparse keymap via (set-transient-keymap) and which-key does not activate. Just wanna throw my name in the bucket of people who might care about this.

(defvar er/keymap
  (let ((map (make-sparse-keymap "er/objects")))
    (td/bind-keys '(("w" . er/mark-word)
                    ("W" . er/mark-symbol)
                    ("s" . er/mark-sentence)
                    ("p" . er/mark-paragraph)
                    ("b" . er/mark-block)
                    ("e" . er/mark-email)
                    ("u" . er/mark-url)
                    ("o" . er/mark-org-element)
                    ("O" . er/mark-org-parent))
                  map)
    map)
  "A keymap for quickly calling expand region functions.
\\{er/keymap}")

(defun er/keymap ()
  "Activate the `er/keymap'.
\\{er/keymap}"
  (interactive)
  (set-transient-map er/keymap))
KhalfaniW commented 1 year ago

Hercules was built to use which-key for transient states.

It's like hydra but it doesn't require the significant amount of setup. https://github.com/wurosh/hercules