1

How can I have delete-selection-mode work when I press Enter (RET) in Org mode? I can always just delete the selection and then use RET, but I'm having a hard time working this into my muscle memory.

Current behavior: I select the text I want to replace. I use RET. A newline is input at point, no text is deleted, and the region remains active.

Desired behavior: I select the text I want to replace. I use RET. The text is replaced with a newline.

FINAL EDIT: This was an issue with the version of Org mode that I had installed. I was able to resolve it by opening Emacs and immediately (before opening any .org files) package-list-packages and installing org. I had to restart Emacs, and the issue was resolved.

5
  • When I set delete-selection-mode to t, I get the desired behavior you describe.
    – aadcg
    Dec 16, 2021 at 16:22
  • 1
    What @aadcg said. Do you see the same problem if you start Emacs with emacs -Q? If not, bisect your init file to find the culprit. Also, if you see the problem only in some specific mode or context, provide a step-by-step recipe to repro the problem, starting with emacs -Q
    – Drew
    Dec 16, 2021 at 18:08
  • This can happen in a mode that configures Enter to do something other than just insert a newline and possibly indent. What mode is it (i.e. what file type are you editing)? What is RET bound to (C-h c RET)? Dec 16, 2021 at 19:45
  • The problem indeed existed, but it has been fixed upstream, and is currently already part of the latest release. Can you report what you get from M-x org-version ?
    – gusbrs
    Dec 17, 2021 at 11:51
  • Thanks for the help with this. Dec 17, 2021 at 12:26

1 Answer 1

1

This problem was solved in the last version of Org mode by adding the following line:

(put 'org-return 'delete-selection t)

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.