0

When shift-select-mode is on (Emacs' default), C-S-up in text mode selects the previous paragraph.

This does not work under Org-Mode, where C-S-up gets translated into C-up, which is mapped to org-backward-paragraph and just moves up, but does not select the paragraph.

The question is how to enable shift selection for C-S-up.

The solution here is not ideal, as it relies on backward-paragraph (instead of org-backward-paragraph), which does not work well with several Org-mode constructs (e.g., doesn't treat bullet points as paragraphs).

PS: I'm using org-support-shift-select and org-replace-disputed keys, like this:

(setq org-support-shift-select t
      org-replace-disputed-keys t)
(setq org-disputed-keys
      '(
        ([(shift left)]          . [(meta -)])         ; change status (todo/closed/done)
        ([(shift right)]         . [(meta =)])         ;
        ([(shift up)]            . [(control meta -)]) ; change priority
        ([(shift down)]          . [(control meta =)]) ;
        ([(control shift right)] . [(meta +)])         ; status of group
        ([(control shift left)]  . [(meta _)])         ;
        ([(control shift up)]    . [(control meta +)]) ; change clock logs
        ([(control shift down)]  . [(control meta _)]) ;
        ))
  • The entire world of Emacs, except for me, bends over backwards to not touch any of the internal functions except to the extent of applying an advice. It sounds like you just want to add an interactive code "^" to org-backward-paragraph so that native shift-select works. You might want to play around with modifying that function in a scratch buffer and see if you can get it to do what you want -- the interactive statement [to enable native shift-select] would look like this: (interactive "^") instead of (interactive). – lawlist Jul 18 '18 at 1:45
  • In my own setup, I have modified org-backward-element in the manner mentioned in the previous comment and that is what I use instead of org-backward-paragraph. I do the same thing with org-forward-element. And, I bind them to M-up/M-down and just hold down the shift key if I want native shift-selection. – lawlist Jul 18 '18 at 1:52
1

Based on clues from lawlist's comments, reading around the area of "Key Sequence Input" in the elisp info file, and an explanation of defadvice that even I can understand, here, I added this to my .emacs:

(defadvice org-backward-paragraph
    (before set-up-shift-select-backward-paragraph activate)
  (interactive "^"))
(defadvice org-forward-paragraph
    (before set-up-shift-select-forward-paragraph activate)
  (interactive "^"))

This gives a similar effect to using C-S-up and C-S-down in text-mode. The difference that I see is where point winds up.

This code causes calls to org-backward-paragraph and org-forward-paragraph to first call interactive with the magic character ^, which means to set up shift-select.

I am also using org-replace-disputed-keys, but that didn't help with paragraphs.

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.