1

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?

1
  • 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 at 18:44
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)
4
  • ... assuming that you don't care about the functionality that Org mode assigned to those keys in the first place.
    – NickD
    Nov 12 at 14:25
  • @djangoliv Thank you. Do you know why using org-ctrl-shift... does not work?
    – Beubeu
    Nov 12 at 14:31
  • @Beubeu Sorry, but no, I don't know...
    – djangoliv
    Nov 12 at 14:55
  • There are no such variables defined in Org mode, so giving them a value does not do anything.
    – NickD
    Nov 12 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.