Something has changed for me, since I upgraded to newer org-mode

If I have this

* foo
** bar...
** baz...

If I put point on "**", then hit C-e to go to the end of line, it only moves point to after "r", while I expect it to move it to the end of the line.

Is there an easy way to get back this behavior?;)

  • 1
    The r is the end of the line (heading), is it not? Surely the ... is representing the elided text underneath that heading.
    – phils
    Aug 25 '20 at 8:51
  • Well, if I hit enter after C-e, it expands the headline. I don't want that. I want a new line. If I wanted to expand the headline, I would've hit tab Aug 25 '20 at 10:32
  • I guess you must have been using Emacs 25 previously. I can see that org-end-of-line changed in 26.1 to mean "Go to the end of the line, but before ellipsis, if any." In Emacs 25 it would put the cursor after the ... meaning at the very end of the collapsed section (i.e. not just the end of the heading). Is that what you want?
    – phils
    Aug 25 '20 at 11:26
  • It looks pretty hard-coded, but you could try (with-eval-after-load "org" (define-key org-mode-map "\C-e" nil)) to remove the org binding and fall back to the default (which is most likely move-end-of-line).
    – phils
    Aug 25 '20 at 11:29
  • 1
    Oh I see... in Emacs 27 they've added a remapping to the keymap which causes my suggested unbinding to then fall back to the exact same thing which we'd unbound. That seems excessive, and possibly a hint that the org devs feel there's a good reason for you not to do this. To tackle both things you actually need: (with-eval-after-load "org" (define-key org-mode-map "\C-e" nil) (define-key org-mode-map [remap move-end-of-line] nil))
    – phils
    Aug 25 '20 at 21:27

You can remove the org-move-end-of-line bindings for C-e like so:

(with-eval-after-load "org"
  (define-key org-mode-map "\C-e" nil)
  (define-key org-mode-map [remap move-end-of-line] nil))

Emacs 26.1 introduced the org-move-end-of-line behaviour change whereby it stops before the elided ... of a collapsed section; but note that prior to that change org did still have its own org-move-end-of-line, and so the code above (which should cause Emacs to simply call the default move-end-of-line command instead of org's version) is still likely to behave differently in some ways.

The current version of the function doesn't provide an option for the behaviour you want, but you could potentially add an older (or modified) version of org-move-end-of-line to your own config.

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.