Search code examples
emacselispkey-bindings

Emacs key binding for multiple commands


I'm new to emacs, and have a rookie question. I can bind a key to a particular function by (global-set-key (kbd "C-c a b c") 'some-command), where some-command is a function. How can I invoke two functions (say some-command and some-other-command) with one key binding? Thanks a lot!


Solution

  • You can define your own function which call the two functions, and bind the key to your own function. Or use a simple lambda:

    (global-set-key (kbd "C-c a b c") (lambda () (interactive) (some-command) (some-other-command)))