I tried to set this:

(use-package avy
  :defer t
  (("C-z c" . avy-goto-char-timer)
   ("C-z l" . avy-goto-line)
   ("C-C j" . avy-resume))
  (avy-timeout-seconds 0.3)
  (avy-style 'pre)
  (avy-lead-face ((t (:background "#51afef" :foreground "#870000" :weight bold)))));

But emacs tells me: Key sequence C-z c starts with non-prefix key C-z.

When I press C-z C-h I'm told that the following are bound:

C-z C-b C-z b C-z o C-z p C-z q C-z r C-z s C-z t

  • Does :bind expect that you will tell it what keymap to use? If so, then do so, and specify the keys to bind in a prefix-key map without the prefix. E.g., if the keymap is bound to C-z then specify c, not C-z c, if you are also specifying which map to use.
    – Drew
    Jan 8, 2020 at 16:26
  • I'm not sure how to answer your question about :bind. Are you asking me specifically, or just asking in general about :bind? I basically cargo-culted this snippet from somewhere, so I'm not really clear on how it works.
    – basedrum1
    Jan 8, 2020 at 16:40
  • I don't know what syntax :bind expects. If you don't know then maybe find out (since you're using it). Or maybe someone else will answer, providing that info. My point was that you somehow have to let Emacs know which keymap you're trying to bind the keys in. See, for example, functions define-key and global-set-key.
    – Drew
    Jan 8, 2020 at 16:59
  • github.com/jwiegley/use-package#key-binding describes how :bind works, and how its related to keymaps.
    – basedrum1
    Jan 8, 2020 at 18:44
  • Sorry, but I don't use use-package, and I don't really care how its :bind syntax works. Someone who does will hopefully answer your question. My comment was a hint to maybe check what :bind expects, and to be aware of, and communicate to use-package, what keymap you want to bind the key in.
    – Drew
    Jan 8, 2020 at 20:05

2 Answers 2


A little experimentation shows that :bind uses the global keymap by default. You can define C-z as a prefix by creating a keymap and adding it as the definition of C-z to the global keymap. Here I create a sparse keymap, since only a few entries are needed:

(define-key global-map (kbd "C-z") (make-sparse-keymap))

After you have defined C-z as a prefix this way, the use-package in your question should work.

  • 1
    you can target any map using :map also, it seems possible to to define prefixes with :prefix and :prefix-map although I haven't used those myself. Vid. use-package src and also (use-package/bind-key.el at d2640fec376a8458a669e7526e63e5870d875118 · jwiegley/use-package
    – Muihlinn
    Jun 7, 2020 at 7:24
  • @Muihlinn: I don't know much about use-package and what I included in the answer was the result of some experimentation. I would encourage you to write your own answer with the additional information, particularly if my answer is wrong or conveys the wrong impression. And if it does, I'd rather delete it than leave wrong information lying around that could trap unwary victims.
    – NickD
    Jun 7, 2020 at 12:22
  • One good thing of use-package is that it doesn't force you to make things its own way. I don't see anything wrong in your response. While I do use it, mainly to encapsulate custom configuration and defer stuff until I need it, my knowledge is limited to what I already needed; keybinding prefixes hasn't been around yet. But I recall seeing them in source code looking for something else, so I pointed it as extra info. Binding to a given map is in the docs, and doesn't need further explanation.
    – Muihlinn
    Jun 7, 2020 at 12:47
  • OK - good to know. Thanks! And thanks for the extra info.
    – NickD
    Jun 7, 2020 at 12:53

C-z is the perfect key for a personal keymap prefix, but its bound to something like suspend-frame by default. It's right there next to C-x and C-c so it's just itching to be made a prefix.

Try this:

  (unbind-key "C-z")
  (bind-keys :prefix-map personal-ops-map
             :prefix "C-z"
             :prefix-docstring "Personal key bindings"
             ("v" . emacs-version))

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.