2

Similarly to what is described here, org-mode overrides C-S-<arrow> key-binds which, in order to control the size of the windows, I have defined as follows:

(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)
(global-set-key (kbd "S-C-<down>") 'shrink-window)

I would expect an identical solution to work, i.e.:

(add-hook 'org-ctrl-shiftright-final-hook 'enlarge-window-horizontally)
(add-hook 'org-ctrl-shiftleft-final-hook 'shrink-window-horizontally)
(add-hook 'org-ctrl-shiftup-final-hook 'enlarge-window)
(add-hook 'org-ctrl-shiftdown-final-hook 'shrink-window)

However the above has no effect at all. In org-mode those keys are still bind to setting and clearing marks (up/down combinations) and to work with the clock log (right/left combinations). In particular, they are bound to org-shiftcontrolup (and similar for the remaining three).

Does someone know how can one successfully override these key-binds in org-mode?

Drew
  • 75,699
  • 9
  • 109
  • 225
unvarnished
  • 129
  • 5
  • 1
    There is no variable `org-ctrl-shiftright-final-hook` (or any of the other directions) defined in Org mode and therefore *nobody runs such a hook*. You can define such variables as you have done above and you can add functions to them, but you might as well be defining a variable called, say, `beubeu` or `nickd` and expecting something to happen: if nobody uses the variable, then it doesn't matter what its value is - nobody uses it and so it might as well not exist. – NickD Nov 12 '21 at 18:44

1 Answers1

2

You can override the org-mode-map like this:

(define-key org-mode-map (kbd "S-C-<left>") 'shrink-window-horizontally)
(define-key org-mode-map (kbd "S-C-<right>") 'enlarge-window-horizontally)
(define-key org-mode-map (kbd "S-C-<down>") 'shrink-window)
(define-key org-mode-map (kbd "S-C-<up>") 'enlarge-window)
djangoliv
  • 3,169
  • 16
  • 31