Is it somehow possible to set multiple keys with global-set-key without having to repeat the statement, like setting multiple variables with setq?

1 Answer 1


In a word, no. C-h f global-set-key tells you what the function's signature is:

global-set-key is an interactive compiled Lisp function in subr.el.

(global-set-key KEY COMMAND)

Give KEY a global binding as COMMAND.


The function accepts only a single key sequence and a single command.

If you really wanted to save multiple occurrences of the text (global-set-key and ) then you could write a function to do that. E.g.:

(defun my-g-s-k (&rest k+c)
  (let (key cmd)
    (while k+c
      (global-set-key (car k+c) (cadr k+c))
      (setq k+c  (cddr k+c)))))

(my-g-s-k "\C-o"    'forward-char
          "\M-o"    'backward-char
          "\C-\M-o" 'forward-line)

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.