I use the commands event-apply-meta-modifier and event-apply-super-modifier to have keys I can tap that apply the meta and super modifier to the next typed shortcut. But when I first apply the meta modifier, then tap the key that should apply the super modifier, Emacs doesn't stack the modifiers but instead says

M-` is undefined

(I have event-apply-super-modifier on the `-key). So I tried to define a command

(defun ahp/event-apply-meta-and-super-modifier ()
  "This function kills all lines in the buffer of a regexp-search using the all-package."
  (call-interactively 'event-apply-meta-modifier)
  (call-interactively 'event-apply-super-modifier)

But when I use this command Emacs says

ahp/event-apply-meta-and-super-modifier: Wrong type argument: commandp, event-apply-meta-modifier

How can I make this command work?

  • 2
    but event-apply-meta-modifier is not a command
    – shynur
    Commented Dec 29, 2023 at 22:03
  • 2
    @shynur is correct of course (that's why you get the error message), but there are other, deeper problems here. For one, each of these functions does a (read-event), so you have two different events, one in each call - what you want to do is modify the same event twice: I don't think that's possible with these functions: you'll have to go to a lower-level function.
    – NickD
    Commented Dec 30, 2023 at 2:25

1 Answer 1


I simply concatenated the definitions of those two functions:

(defun MetaSuper-next-cmd ()
  (execute-kbd-macro (vector (event-apply-modifier (event-apply-modifier (read-event) 'super 23 "s-") 'meta 27 "M-"))))


(keymap-global-set "M-s-<left>" #'beginning-of-defun)
(keymap-global-set "M-s-j" #'beginning-of-defun)

M-x MetaSuper-next-cmd <left> or M-x MetaSuper-next-cmd j.

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.