|
@@ -20820,8 +20820,9 @@ If point is in an inline task, mark that task instead."
|
|
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."
|
|
(save-excursion
|
|
(save-excursion
|
|
- (let* ((elements (org-element-at-point t))
|
|
|
|
- (element (car elements))
|
|
|
|
|
|
+ (goto-char p)
|
|
|
|
+ (beginning-of-line)
|
|
|
|
+ (let* ((element (org-element-at-point))
|
|
(type (org-element-type element))
|
|
(type (org-element-type element))
|
|
(post-affiliated
|
|
(post-affiliated
|
|
(progn
|
|
(progn
|
|
@@ -20829,8 +20830,6 @@ meant to be filled."
|
|
(while (looking-at org-element--affiliated-re) (forward-line))
|
|
(while (looking-at org-element--affiliated-re) (forward-line))
|
|
(point))))
|
|
(point))))
|
|
(unless (< p post-affiliated)
|
|
(unless (< p post-affiliated)
|
|
- (goto-char p)
|
|
|
|
- (beginning-of-line)
|
|
|
|
(case type
|
|
(case type
|
|
(comment (looking-at "[ \t]*#\\+? ?") (match-string 0))
|
|
(comment (looking-at "[ \t]*#\\+? ?") (match-string 0))
|
|
((item plain-list)
|
|
((item plain-list)
|
|
@@ -20840,12 +20839,13 @@ meant to be filled."
|
|
(paragraph
|
|
(paragraph
|
|
;; Fill prefix is usually the same as the current line,
|
|
;; Fill prefix is usually the same as the current line,
|
|
;; except if the paragraph is at the beginning of an item.
|
|
;; except if the paragraph is at the beginning of an item.
|
|
- (let ((parent (cadr elements)))
|
|
|
|
- (if (eq (org-element-type parent) 'item)
|
|
|
|
- (make-string (org-list-item-body-column
|
|
|
|
- (org-element-property :begin parent))
|
|
|
|
- ? )
|
|
|
|
- (if (looking-at "\\s-+") (match-string 0) ""))))
|
|
|
|
|
|
+ (let ((parent (org-element-property :parent element)))
|
|
|
|
+ (cond ((eq (org-element-type parent) 'item)
|
|
|
|
+ (make-string (org-list-item-body-column
|
|
|
|
+ (org-element-property :begin parent))
|
|
|
|
+ ? ))
|
|
|
|
+ ((looking-at "\\s-+") (match-string 0))
|
|
|
|
+ (t ""))))
|
|
((comment-block verse-block)
|
|
((comment-block verse-block)
|
|
;; Only fill contents if P is within block boundaries.
|
|
;; Only fill contents if P is within block boundaries.
|
|
(let* ((cbeg (save-excursion (goto-char post-affiliated)
|
|
(let* ((cbeg (save-excursion (goto-char post-affiliated)
|
|
@@ -20939,6 +20939,7 @@ width for filling."
|
|
(skip-chars-backward " \r\t\n")
|
|
(skip-chars-backward " \r\t\n")
|
|
(line-beginning-position))
|
|
(line-beginning-position))
|
|
justify))) t)
|
|
justify))) t)
|
|
|
|
+ ;; Fill comments, indented or not.
|
|
(comment
|
|
(comment
|
|
(let ((fill-prefix (org-fill-context-prefix (point))))
|
|
(let ((fill-prefix (org-fill-context-prefix (point))))
|
|
(save-excursion
|
|
(save-excursion
|