The typical approach would be to bind the key to a command, rather than another key sequence. In your case you want to call org-shiftup
with an argument. For example:
(define-key org-mode-map (kbd "<M-S-up>")
(lambda () (interactive) (org-shiftup 7)))
Alternatively you can bind one key sequence to another as in the example you cited. This works for me:
(define-key org-mode-map (kbd "<M-S-up>") (kbd "C-u 7 <S-up>"))
As @Tyler pointed out, when defining keys for a specific mode you generally want to use a mode hook or eval-after-load
so that the key is not defined until the mode's keymap has been defined.
A few general tips:
- Use
C-h k
to find that S-up is bound toorg-shiftup
. - Use
C-h f define-key
to read the doc fordefine-key
. It looks like you swapped the arguments and may not be familiar with keymaps. - As noted in the comments, use
C-h k
to see the appropriate key syntax -- when usingup
, you need the<>
. - To really understand key maps and key bindings, refer to the Elisp manual. There is also a great overview on Mastering Emacs.