about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-org.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 06803d3..c4431ab 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -38,6 +38,12 @@ lists, insert a new item or end the list, with checkbox if
38appropriate. In tables, insert a new row or end the table." 38appropriate. In tables, insert a new row or end the table."
39 ;; Inspired by John Kitchin: http://kitchingroup.cheme.cmu.edu/blog/2017/04/09/A-better-return-in-org-mode/ 39 ;; Inspired by John Kitchin: http://kitchingroup.cheme.cmu.edu/blog/2017/04/09/A-better-return-in-org-mode/
40 (interactive "P") 40 (interactive "P")
41 ;; Auto-fill if enabled
42 (when auto-fill-function
43 (if (listp auto-fill-function)
44 (dolist (func auto-fill-function)
45 (funcall func))
46 (funcall auto-fill-function)))
41 (if default 47 (if default
42 (org-return) 48 (org-return)
43 (cond 49 (cond
@@ -87,10 +93,6 @@ appropriate. In tables, insert a new row or end the table."
87 (org-element-property :contents-end context))) 93 (org-element-property :contents-end context)))
88 (item-child-p 94 (item-child-p
89 (unpackaged/org-element-descendant-of 'item context))) 95 (unpackaged/org-element-descendant-of 'item context)))
90 (message "(or %S (and %S %S) %S)"
91 first-item-p
92 itemp (not emptyp)
93 item-child-p)
94 ;; The original function from unpackaged just tested the (or ...) test 96 ;; The original function from unpackaged just tested the (or ...) test
95 ;; in this cond, in an if. However, that doesn't auto-end nested 97 ;; in this cond, in an if. However, that doesn't auto-end nested
96 ;; lists. So I made this form a cond and added the (and...) test in 98 ;; lists. So I made this form a cond and added the (and...) test in
@@ -99,13 +101,13 @@ appropriate. In tables, insert a new row or end the table."
99 ;; for now, it works well enough. 101 ;; for now, it works well enough.
100 (cond ((and itemp emptyp) 102 (cond ((and itemp emptyp)
101 (delete-region (line-beginning-position) (line-end-position)) 103 (delete-region (line-beginning-position) (line-end-position))
102 (newline 2)) 104 (insert "\n\n"))
103 ((or first-item-p 105 ((or first-item-p
104 (and itemp (not emptyp)) 106 (and itemp (not emptyp))
105 item-child-p) 107 item-child-p)
106 (org-insert-item)) 108 (org-insert-item))
107 (t (delete-region (line-beginning-position) (line-end-position)) 109 (t (delete-region (line-beginning-position) (line-end-position))
108 (newline))))) 110 (insert "\n")))))
109 111
110 ((when (fboundp 'org-inlinetask-in-task-p) 112 ((when (fboundp 'org-inlinetask-in-task-p)
111 (org-inlinetask-in-task-p)) 113 (org-inlinetask-in-task-p))