1

In orgmode, I'd like shift-cursor keys and shift-control-cursor keys to do selection extension and selection extension by word.

I have that partially working already, using the recipe from www.reddit.com/r/emacs/comments/tbj09/using_shift_selection_in_orgmode_buffers_without/.

What works is:

  • Doing shift- or shift-control-cursor in regular orgmode text.
  • Setting the point in regular text and extending into a header.
  • Setting the point in a header and extending with shift-home or shift-end and then extending with shift- or shift-control-cursor.

What does not work is:

  • Setting the point in a header and immediately continuing with any shift-cursor and shift-control-cursor.
  • Setting the point in a header, doing shift-home or shift-end and extending with shift-Up/Down.
  • Setting the point in a header, doing shift-home or shift-end and then extending to the initial point position (so, transitioning the selection size through 0), then trying to shift- or shift-control-cursor in any direction.

'Does not work' means I still get orgmode item status functions called. I'd like to get CUA selection extension.

I suppose could try the add-hook 'org-shiftup-final-hook recipe, but I don't know how the functions I need should be called.

Is it doable then?

8
  • Sorry, I don't understand your question. Could you provide us with some practical examples? If your issue is: how to turn a selection into headings when using CUA mode? Then you just have to do a normal selection and then do C-S-c *. The same goes for items and tables (C-S-c - and C-S-c |), etc.
    – crocefisso
    Commented Apr 30 at 9:15
  • @crocefisso I'd like shift-cursor and shift-control-cursor to work, i.e. to expand the selection, regardless of where the point was before that. Now it works smoothly only from anywhere inside regular text
    – yury10578
    Commented Apr 30 at 14:15
  • What are shift-cursor and shift-control-cursor? I don't see any Emacs command with these names. Do you mean what shift+arrow and shift+control+arrow do outside of Emacs? In Emacs (and org-mode), selection can be made with C-SPC and then arrows (or also Control + arrows).
    – crocefisso
    Commented Apr 30 at 21:33
  • @crocefisso: Okay, shift+arrow and shift+control+arrow then (I've seen the cursor-style references on this site) And yes, I mean what those combinations do in word processors.
    – yury10578
    Commented May 1 at 3:54
  • 1
    i have (setq org-support-shift-select t) in my .emacs file and items 2 & 3 are working. Only item 1 where you do, shift-cursor does todo status change or priority change. But that can be overcome, if you press shift-home/shift-end to select the whole line and move in the reverse direction.
    – Saravana
    Commented May 1 at 4:27

1 Answer 1

1

On org-mode headings, S-<left> and S-<right> allow to cycle through task states, while S-<up> and S-<down> allow to cycle through priorities. On org-table, org-timestamp, org-item, etc. they also do something specific.

In org-mode, these commands are defined in org.el, see:

  • org-shiftup
  • org-shiftdown
  • org-shiftright
  • org-shiftleft

Of course, it is possible to unbind S-<left> or C-S-<left> from org-shiftleft, but this will downgrade org-mode.

Below is an example of such unbinding using use-package. Note that we strongly recommend avoiding such unbindings and getting used to C-SPC instead.

(use-package org
  :config
  (unbind-key "S-<left>" org-mode-map)
  (unbind-key "S-<right>" org-mode-map)
  (unbind-key "S-<up>" org-mode-map)
  (unbind-key "S-<down>" org-mode-map)
  (unbind-key "C-S-<left>" org-mode-map)
  (unbind-key "C-S-<right>" org-mode-map)
  (unbind-key "C-S-<up>" org-mode-map)
  (unbind-key "C-S-<down>" org-mode-map)
  )
7
  • 1
    Thank you, but that's looks more like a comment, not an answer to my question. If I knew how to do those unbindings and rebindings, I wouldn't ask. As far as I understand that's not such a straightforward thing.
    – yury10578
    Commented May 1 at 18:06
  • ...and why org-mode? Because of the control it gives over the document structure, and the markup being lightweight, and exporting to interesting formats being well-documented.
    – yury10578
    Commented May 1 at 18:08
  • Updated. Note that as a consequence of a bad problem, the solution is also bad. Better get used to C-SPC.
    – crocefisso
    Commented May 2 at 11:14
  • Thank you. Would you add C-S-arrows to those keychords already mentioned? I checked, and with C-S- ones the answer would be complete.
    – yury10578
    Commented May 2 at 17:48
  • Updated. I didn't put the C-S part in the first place because I thought it was trivial.
    – crocefisso
    Commented May 2 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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