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.

  • When I set `delete-selection-mode` to `t`, I get the desired behavior you describe. – aadcg Dec 16 '21 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 '21 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`)? – Gilles 'SO- stop being evil' Dec 16 '21 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 '21 at 11:51
  • Thanks for the help with this. – ComfyPotato3 Dec 17 '21 at 12:26

1 Answers1

1

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

(put 'org-return 'delete-selection t)
link0ff
  • 1,081
  • 5
  • 14