瀏覽代碼

Merge branch 'maint'

Nicolas Goaziou 12 年之前
父節點
當前提交
bef53d7f67
共有 2 個文件被更改,包括 20 次插入1 次删除
  1. 4 1
      lisp/org.el
  2. 16 0
      testing/lisp/test-org.el

+ 4 - 1
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)

+ 16 - 0
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"