summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-10-20 11:59:07 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-10-20 11:59:07 +0200
commitbef53d7f672e9ddca971260ec09cb53f1b2084de (patch)
tree2ea7f833f69a0c4f2ca4d1c542bfa36e0ab04c34
parent6f7e92bdb64bbc305a10d4ebe31e9a3ee8e87580 (diff)
parent93040f46714f4b94ebbbd0ff8c3ccf58ae3437c5 (diff)
downloadorg-mode-bef53d7f672e9ddca971260ec09cb53f1b2084de.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org.el5
-rw-r--r--testing/lisp/test-org.el16
2 files changed, 20 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 40745ba..3984fc3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21360,7 +21360,10 @@ a footnote definition, try to fill the first paragraph within."
;; Check if auto-filling is meaningful.
(let ((fc (current-fill-column)))
(when (and fc (> (current-column) fc))
- (let ((fill-prefix (org-adaptive-fill-function)))
+ (let* ((fill-prefix (org-adaptive-fill-function))
+ ;; Enforce empty fill prefix, if required. Otherwise, it
+ ;; will be computed again.
+ (adaptive-fill-mode (not (equal fill-prefix ""))))
(when fill-prefix (do-auto-fill))))))
(defun org-comment-line-break-function (&optional soft)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 80822d0..58a8b30 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -200,6 +200,22 @@
(end-of-line)
(org-auto-fill-function)
(buffer-string)))))
+ ;; A hash within a line isn't a comment.
+ (should-not
+ (equal "12345 # 7890\n# 1"
+ (org-test-with-temp-text "12345 # 7890 1"
+ (let ((fill-column 12))
+ (end-of-line)
+ (org-auto-fill-function)
+ (buffer-string)))))
+ ;; Correctly interpret empty prefix.
+ (should-not
+ (equal "# a\n# b\nRegular\n# paragraph"
+ (org-test-with-temp-text "# a\n# b\nRegular paragraph"
+ (let ((fill-column 12))
+ (end-of-line 3)
+ (org-auto-fill-function)
+ (buffer-string)))))
;; Comment block: auto fill contents.
(should
(equal "#+BEGIN_COMMENT\n12345\n7890\n#+END_COMMENT"