|
@@ -20296,10 +20296,11 @@ the functionality can be provided as a fall-back.")
|
|
|
(org-set-local 'fill-paragraph-function 'org-fill-paragraph)
|
|
|
;; Prevent auto-fill from inserting unwanted new items.
|
|
|
(if (boundp 'fill-nobreak-predicate)
|
|
|
- (org-set-local 'fill-nobreak-predicate
|
|
|
- (if (memq 'org-fill-item-nobreak-p fill-nobreak-predicate)
|
|
|
- fill-nobreak-predicate
|
|
|
- (cons 'org-fill-item-nobreak-p fill-nobreak-predicate))))
|
|
|
+ (org-set-local
|
|
|
+ 'fill-nobreak-predicate
|
|
|
+ (org-uniquify
|
|
|
+ (append fill-nobreak-predicate
|
|
|
+ '(org-fill-item-nobreak-p org-fill-line-break-nobreak-p)))))
|
|
|
;; Adaptive filling: To get full control, first make sure that
|
|
|
;; `adaptive-fill-regexp' never matches. Then install our own matcher.
|
|
|
(unless (local-variable-p 'adaptive-fill-regexp (current-buffer))
|
|
@@ -20319,6 +20320,13 @@ the functionality can be provided as a fall-back.")
|
|
|
"Non-nil when a line break at point would insert a new item."
|
|
|
(and (looking-at (org-item-re)) (org-list-in-valid-context-p)))
|
|
|
|
|
|
+(defun org-fill-line-break-nobreak-p ()
|
|
|
+ "Non-nil when a line break at point would create an Org line break."
|
|
|
+ (save-excursion
|
|
|
+ (skip-chars-backward "[ \t]")
|
|
|
+ (skip-chars-backward "\\\\")
|
|
|
+ (looking-at "\\\\\\\\\\($\\|[^\\\\]\\)")))
|
|
|
+
|
|
|
(defun org-fill-paragraph (&optional justify)
|
|
|
"Re-align a table, pass through to fill-paragraph if no table."
|
|
|
(let ((table-p (org-at-table-p))
|