With jumping packages like Ace and Avy, you can start a function, provide a query char, and then jump to somewhere based on further input. (Lately I've preferred Avy, but that's irrelevant here.)

I have had both bound to C-' C-; (with other jumping functions bound to the home row) so that I can just hold control and fire off the sequence. It's very distracting though to have to lift my finger off control to input a 'plain' character for read-char to read.


How can I strip all modifier keys off a read-char-returned key code?

  • 1
    For a-z you can likely just do: (string (+ (read-char) 96)) You'll need to do some more sanity checking for anything you use though, also you'll need to handle C-g which you can likely with with-local-quit. May 11, 2015 at 21:06

1 Answer 1


I think you want event-basic-type. E.g. (event-basic-type ?\C-;) returns ?;.

If you want to only stop the control modifier but keep the other modifiers (e.g. the shift modifier), then you can try something like:

(require 'cl-lib)
(defun my-strip-control (event)
   (append (cl-set-difference (event-modifiers event)
                              '(control click))
           (list (event-basic-type event)))))
  • This is good enough for my use case (and actually answers my question more strictly than I meant it) so I'll still accept if the following can't be done: is it possible to keep 'Shift' as a modifier key? That is, to convert \C-L -> L? May 11, 2015 at 21:44
  • In Elisp, ?\C-l and ?\C-L are one and the same.
    – Stefan
    May 11, 2015 at 22:05
  • Is that really true? Because I have C-s bound to isearch and C-S (i.e. C-S-s) bound to helm-swoop. May 12, 2015 at 0:10
  • 1
    Details matter: ?\C-l and ?\C-L are one and the same, but ?\C-L and ?\C-\S-l are different.
    – Stefan
    May 12, 2015 at 0:42

Your Answer

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

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