summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2014-08-03 09:57:37 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-08-03 09:57:37 +0200
commit381ad4b33a85913e34b433c7bddad621d7e1e3bf (patch)
tree706127e685980115a91ccf4dba7c430a4f91e8e6
parentd649b792c03b6c92bf68f382f63ba530cce6acfa (diff)
downloadorg-mode-381ad4b33a85913e34b433c7bddad621d7e1e3bf.tar.gz
Small refactoring
* lisp/org.el (org-fill-paragraph): Avoid calling `fill-region-as-paragraph' if BEG is equal to END.
-rw-r--r--lisp/org.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/lisp/org.el b/lisp/org.el
index dd4feb6..3926890 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -22853,17 +22853,16 @@ a footnote definition, try to fill the first paragraph within."
;; Fill paragraph, taking line breaks into account.
(save-excursion
(goto-char beg)
- (let ((starters (list beg)))
- (while (re-search-forward "\\\\\\\\[ \t]*\\(\n\\)" end t)
+ (let ((cuts (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))))
+ (save-excursion (backward-char)
+ (org-element-context))))
+ (push (point) cuts)))
+ (dolist (c (delq end cuts))
+ (fill-region-as-paragraph c end justify)
+ (setq end c))))
t)))
;; Contents of `comment-block' type elements should be
;; filled as plain text, but only if point is within block