diff --git a/lisp/org.el b/lisp/org.el index b45cc0618..b9daba84e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -21111,7 +21111,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. diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 17e7a223c..6bea90a54 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -1190,6 +1190,14 @@ (should (equal "| a |\n\n| b |" (org-test-with-temp-text "| a |\n| b |" + (org-return) + (buffer-string)))) + ;; Do not auto-fill on hitting 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.\n:END:" + (setq-local fill-column 10) + (auto-fill-mode 1) (org-return) (buffer-string)))))