forked from mirrors/org-mode
Fix filling with `adaptive-fill-regexp'
* lisp/org.el (org-adaptive-fill-function): Look for a fill prefix at the beginning of the paragraph and subsquently on its second line instead of the current line. * testing/lisp/test-org.el: Add test
This commit is contained in:
parent
13cb28a227
commit
9e51049b22
10
lisp/org.el
10
lisp/org.el
|
@ -22163,7 +22163,15 @@ matches in paragraphs or comments, use it."
|
||||||
(make-string (org-list-item-body-column
|
(make-string (org-list-item-body-column
|
||||||
(org-element-property :begin parent))
|
(org-element-property :begin parent))
|
||||||
? ))
|
? ))
|
||||||
((looking-at adaptive-fill-regexp) (match-string 0))
|
((and adaptive-fill-regexp
|
||||||
|
;; Locally disable
|
||||||
|
;; `adaptive-fill-function' to let
|
||||||
|
;; `fill-context-prefix' handle
|
||||||
|
;; `adaptive-fill-regexp' variable.
|
||||||
|
(let (adaptive-fill-function)
|
||||||
|
(fill-context-prefix
|
||||||
|
post-affiliated
|
||||||
|
(org-element-property :end element)))))
|
||||||
((looking-at "[ \t]+") (match-string 0))
|
((looking-at "[ \t]+") (match-string 0))
|
||||||
(t "")))))
|
(t "")))))
|
||||||
(comment-block
|
(comment-block
|
||||||
|
|
|
@ -273,13 +273,30 @@
|
||||||
(buffer-string)))))
|
(buffer-string)))))
|
||||||
;; Auto fill paragraph when `adaptive-fill-regexp' matches.
|
;; Auto fill paragraph when `adaptive-fill-regexp' matches.
|
||||||
(should
|
(should
|
||||||
(equal "> 12345\n> 7890"
|
(equal "> 12345\n 7890"
|
||||||
(org-test-with-temp-text "> 12345 7890"
|
(org-test-with-temp-text "> 12345 7890"
|
||||||
(let ((fill-column 5)
|
(let ((fill-column 10)
|
||||||
(adaptive-fill-regexp "[ \t]*>+[ \t]*"))
|
(adaptive-fill-regexp "[ \t]*>+[ \t]*")
|
||||||
|
(adaptive-fill-first-line-regexp "\\`[ ]*\\'"))
|
||||||
(end-of-line)
|
(end-of-line)
|
||||||
(org-auto-fill-function)
|
(org-auto-fill-function)
|
||||||
(buffer-string)))))
|
(buffer-string)))))
|
||||||
|
(should
|
||||||
|
(equal "> 12345\n> 12345\n> 7890"
|
||||||
|
(org-test-with-temp-text "> 12345\n> 12345 7890"
|
||||||
|
(let ((fill-column 10)
|
||||||
|
(adaptive-fill-regexp "[ \t]*>+[ \t]*"))
|
||||||
|
(goto-char (point-max))
|
||||||
|
(org-auto-fill-function)
|
||||||
|
(buffer-string)))))
|
||||||
|
(should-not
|
||||||
|
(equal " 12345\n *12345\n *12345"
|
||||||
|
(org-test-with-temp-text " 12345\n *12345 12345"
|
||||||
|
(let ((fill-column 10)
|
||||||
|
(adaptive-fill-regexp "[ \t]*>+[ \t]*"))
|
||||||
|
(goto-char (point-max))
|
||||||
|
(org-auto-fill-function)
|
||||||
|
(buffer-string)))))
|
||||||
;; Auto fill comments.
|
;; Auto fill comments.
|
||||||
(should
|
(should
|
||||||
(equal " # 12345\n # 7890"
|
(equal " # 12345\n # 7890"
|
||||||
|
|
Loading…
Reference in a new issue