Skip to main content
replaced http://emacs.stackexchange.com/ with https://emacs.stackexchange.com/
Source Link

This question is a follow-up to this answerthis answer (q.v.).

This question is a follow-up to this answer (q.v.).

This question is a follow-up to this answer (q.v.).

added 121 characters in body
Source Link
kjo
  • 3.3k
  • 21
  • 49

OK, the following snippet takes care of my immediate problem, but it's not an answer to my questionbut it's not an answer to my question (see below):

One would need to do this sort of thing for every single mode X that defines a key binding of the form M- followed by a non-character key sequence. Specifically, and for every such binding, one would have to include a define-key expression in a mode-hook for mode X. Therefore, itthis approach is obviously a very laborious, fragile, and hard-to-maintain hack. It does not do what the question requests, but instead laboriouslypainstakingly 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.

OK, the following snippet takes care of my immediate problem, but it's not an answer to my question (see below):

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.

OK, the following snippet takes care of my immediate problem, but it's not an answer to my question (see below):

One would need to do this sort of thing for every single mode X that defines a key binding of the form M- followed by a non-character key sequence. Specifically, for every such binding, one would have to include a define-key expression in a mode-hook for mode X. Therefore, this approach is obviously a very laborious, fragile, and hard-to-maintain hack. It does not do what the question requests, but instead painstakingly 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.

added 1837 characters in body
Source Link
kjo
  • 3.3k
  • 21
  • 49

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.


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.

deleted 811 characters in body
Source Link
kjo
  • 3.3k
  • 21
  • 49
Loading
Improved formatting.
Source Link
programking
  • 7.4k
  • 12
  • 43
  • 63
Loading
added 27 characters in body
Source Link
kjo
  • 3.3k
  • 21
  • 49
Loading
added 27 characters in body
Source Link
kjo
  • 3.3k
  • 21
  • 49
Loading
Source Link
kjo
  • 3.3k
  • 21
  • 49
Loading