Do not auto-fill when point is in Org property drawer
* lisp/org.el (org-return): Set auto-fill-function to nil when point is in an Org property drawer. * testing/lisp/test-org.el (test-org/return): Add test. <http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00102.html>
This commit is contained in:
parent
38bf7561d0
commit
fe7619cd18
|
@ -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.
|
||||
|
|
|
@ -1190,6 +1190,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)))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue