Hi, Thanks for the comments. Nicolas Goaziou writes: > "RET breaks headline text" may be more accurate. OK. >> + (let* ((context (if org-return-follows-link (org-element-context) >> + (org-element-at-point))) >> + (type (org-element-type context))) >> + (cond >> + ;; At a headline >> + ((and (eq type 'headline) (not (bolp))) > > You are removing an optimization here. > > Checking if point is on a headline/inlinetask doesn't require to use > `org-element-at-point'/`org-element-context'. It is faster to simply > check for `org-outline-regexp' (or derived) at bol. > > This optimization is less important than it used to be, now that > properties drawers are at a fixed location. Nevertheless, it might be > worth keeping it in mind. I did it 'cause it's easier, I think, to read a single cond than first an if and then a cond. The latter also seems easier to fix in the future. >> + (org-show-entry) >> + (let ((string "")) >> + (unless (and (save-excursion >> + (beginning-of-line) >> + (looking-at org-complex-heading-regexp)) >> + (or (and (match-beginning 3) >> + (< (point) >> + (save-excursion >> + (goto-char (match-beginning 4)) >> + (skip-chars-backward " \t") >> + (point)))) >> + (and (match-beginning 5) >> + (>= (point) (match-beginning 5))))) >> + ;; Point is on headline keywords, tags or cookies. Do not break >> + ;; them: add a newline after the headline instead. >> + (setq string (delete-and-extract-region >> + (point) (or (match-beginning 5) >> + (line-end-position)))) > > The `setq' is not necessary here. Bind it within `let' instead. You are right. >> + (when (match-beginning 5) >> + (insert (make-string (length string) ?\ )))) > > ?\ -> ?\s > > If you add this feature, please augment `test-org/return' from > "test-org.el" accordingly. Done and and attached. Anybody against pushing this? —Rasmus -- There are known knowns; there are things we know that we know