Browse Source

Merge branch 'maint'

Kaushal Modi 2 years ago
parent
commit
b505a5b6ad
2 changed files with 15 additions and 1 deletions
  1. 7 1
      lisp/org.el
  2. 8 0
      testing/lisp/test-org.el

+ 7 - 1
lisp/org.el

@@ -20459,7 +20459,13 @@ object (e.g., within a comment).  In these case, you need to use
 	     (delete-and-extract-region (point) (line-end-position))))
 	(newline-and-indent)
 	(save-excursion (insert trailing-data))))
-     (t (if indent (newline-and-indent) (newline))))))
+     (t
+      ;; Do not auto-fill when point is in an Org property drawer.
+      (let ((auto-fill-function (and (not (org-at-property-p))
+				     auto-fill-function)))
+	(if indent
+	    (newline-and-indent)
+	  (newline)))))))
 
 (defun org-return-indent ()
   "Goto next table row or insert a newline and indent.

+ 8 - 0
testing/lisp/test-org.el

@@ -1196,6 +1196,14 @@
   (should
    (equal "| a |\n\n| b |"
 	  (org-test-with-temp-text "| a |<point>\n| b |"
+	    (org-return)
+	    (buffer-string))))
+  ;; Do not auto-fill on hitting <RET> inside a property drawer.
+  (should
+   (equal "* Heading\n:PROPERTIES:\n:SOME_PROP: This is a very long property value that goes beyond the fill-column. But this is inside a property drawer, so the auto-filling should be disabled.\n\n:END:"
+	  (org-test-with-temp-text "* Heading\n:PROPERTIES:\n:SOME_PROP: This is a very long property value that goes beyond the fill-column. But this is inside a property drawer, so the auto-filling should be disabled.<point>\n:END:"
+	    (setq-local fill-column 10)
+	    (auto-fill-mode 1)
 	    (org-return)
 	    (buffer-string)))))