0

I would like to integrate which-key like doom emacs with "space" in my configuration, but I get the error: Symbol's value as variable is void: some-map

;; shows shortcuts, when clicking C-x                                                     |
(add-to-list 'load-path "/Users/dave/.emacs.d/elpa/which-key-20220811.1616/which-key.el") |
(require 'which-key)                                                                      |
(which-key-mode)                                                                          |
                                                                                          |
(define-key some-map "f" '("foo" . command-foo))                                          |
(define-key some-map "b" '("bar-prefix" . (keymap)))                                      |
(setq my-map (make-sparse-keymap))                                                        |
(define-key some-map "b" (cons "bar-prefix" my-map))                                      |

3
  • 3
    Did you cut-and-paste from a tutorial? You'll need to change some-map above (which was probably just a "fake" example) to the real map that you want to use.
    – NickD
    Mar 6, 2023 at 18:30
  • @NickD: Post that as an answer? Or maybe OP wants to delete the question, if that's indeed the problem?
    – Drew
    Mar 6, 2023 at 22:25
  • @NickD I did not know, what keymaps are.
    – David
    Mar 7, 2023 at 17:51

1 Answer 1

1

;; shows shortcuts, when clicking C-x

(add-to-list 'load-path "/Users/dave/.emacs.d/elpa/which-key-20220811.1616/which-key.el")
(require 'which-key)
(which-key-mode)
(setq some-map (make-sparse-keymap))
(define-key some-map "f" '("foo" . command-foo))
(define-key some-map "b" '("bar-prefix" . (keymap)))
(setq my-map (make-sparse-keymap))
(define-key some-map "b" (cons "bar-prefix" my-map))
(define-key evil-normal-state-map (kbd "SPC") some-map)

see also here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Keymaps.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.