summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2014-08-02 23:16:05 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-08-02 23:16:05 +0200
commitd649b792c03b6c92bf68f382f63ba530cce6acfa (patch)
tree6d93f73ed17c2bb11bf4bec065f853937d0d6bb4
parentcbb82d0c6e45e58e98dc910df2fcce8c6aa1a611 (diff)
downloadorg-mode-d649b792c03b6c92bf68f382f63ba530cce6acfa.tar.gz
Small refactoring
* lisp/org.el (org-fill-paragraph): Small refactoring.
-rw-r--r--lisp/org.el20
1 files changed, 11 insertions, 9 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 974bc14..dd4feb6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -22851,17 +22851,19 @@ a footnote definition, try to fill the first paragraph within."
(concat "^" message-cite-prefix-regexp) end t))
(setq end (match-beginning 0))))
;; Fill paragraph, taking line breaks into account.
- ;; For that, insert hard newline characters after line
- ;; breaks and activate `use-hard-newlines'.
(save-excursion
(goto-char beg)
- (while (re-search-forward "\\\\\\\\[ \t]*\\(\n\\)" end t)
- (when (eq 'line-break
- (org-element-type
- (progn (backward-char)
- (save-match-data (org-element-context)))))
- (replace-match hard-newline nil nil nil 1)))
- (let ((use-hard-newlines t)) (fill-region beg end justify)))
+ (let ((starters (list beg)))
+ (while (re-search-forward "\\\\\\\\[ \t]*\\(\n\\)" end t)
+ (when (eq 'line-break
+ (org-element-type
+ (progn
+ (backward-char)
+ (save-match-data (org-element-context)))))
+ (push (point) starters)))
+ (dolist (s starters)
+ (fill-region-as-paragraph s end justify)
+ (setq end s))))
t)))
;; Contents of `comment-block' type elements should be
;; filled as plain text, but only if point is within block