org.el (org-adaptive-fill-function): Fix various bugs when filling in message-mode
* org.el (org-adaptive-fill-function): In message-mode, don't lines in the message header, nor table lines in the body. Correctly fill lines starting with `org-outline-regexp' in the body.
This commit is contained in:
parent
84d2251e57
commit
a85b393994
13
lisp/org.el
13
lisp/org.el
|
@ -20989,14 +20989,17 @@ hierarchy of headlines by UP levels before marking the subtree."
|
||||||
Return fill prefix, as a string, or nil if current line isn't
|
Return fill prefix, as a string, or nil if current line isn't
|
||||||
meant to be filled."
|
meant to be filled."
|
||||||
(let (prefix)
|
(let (prefix)
|
||||||
(when (and (derived-mode-p 'message-mode) (message-in-body-p))
|
(catch 'exit
|
||||||
|
(when (derived-mode-p 'message-mode)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(cond ((looking-at message-cite-prefix-regexp)
|
(cond ((or (not (message-in-body-p))
|
||||||
(setq prefix (match-string-no-properties 0)))
|
(looking-at orgtbl-line-start-regexp))
|
||||||
|
(throw 'exit nil))
|
||||||
|
((looking-at message-cite-prefix-regexp)
|
||||||
|
(throw 'exit (match-string-no-properties 0)))
|
||||||
((looking-at org-outline-regexp)
|
((looking-at org-outline-regexp)
|
||||||
(setq prefix "")))))
|
(throw 'exit (make-string (length (match-string 0)) ? ))))))
|
||||||
(or prefix
|
|
||||||
(org-with-wide-buffer
|
(org-with-wide-buffer
|
||||||
(let* ((p (line-beginning-position))
|
(let* ((p (line-beginning-position))
|
||||||
(element (save-excursion (beginning-of-line) (org-element-at-point)))
|
(element (save-excursion (beginning-of-line) (org-element-at-point)))
|
||||||
|
|
Loading…
Reference in New Issue