OK, the following snippet takes care of my immediate problem, but it's not an answer to my question (see below):
(add-hook 'org-mode-hook
(lambda ()
(define-key org-mode-map [27 S-down] 'org-shiftmetadown)
(define-key org-mode-map [27 S-up] 'org-shiftmetaup)
(define-key org-mode-map [27 S-right] 'org-shiftmetaright)
(define-key org-mode-map [27 S-left] 'org-shiftmetaleft)
(define-key org-mode-map [27 down] 'org-metadown)
(define-key org-mode-map [27 up] 'org-metaup)
(define-key org-mode-map [27 right] 'org-metaright)
(define-key org-mode-map [27 left] 'org-metaleft)
(define-key org-mode-map [27 return] 'org-meta-return)
(define-key org-mode-map [27 S-return] 'org-insert-todo-heading)))
To find the bindings I needed to define, I got a listing of org-mode-map
(with C-h v
), and searched for M-
to get all the bindings beginning with M-
:
(M-S-down . org-shiftmetadown)
(M-S-up . org-shiftmetaup)
(M-S-right . org-shiftmetaright)
(M-S-left . org-shiftmetaleft)
(M-down . org-metadown)
(M-up . org-metaup)
(M-right . org-metaright)
(M-left . org-metaleft)
(M-return . org-meta-return)
(M-S-return . org-insert-todo-heading)
Each one of these lines is the basis for a corresponding define-key
expression in the mode-hook shown above. The transformation should be pretty obvious. (The 27 in the define-key
expressions is the code for esc.)
One would need to do this sort of thing for every single mode that defines a key binding of the form M-
followed by a non-character key sequence, and for every such binding. Therefore, it is a very laborious, fragile, and hard-to-maintain hack. It does not do what the question requests, but instead laboriously simulates it for certain special cases. For this reason I did not post it as an answer, in the hopes that someone will post an actual answer to the original question.