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.el13
1 files changed, 6 insertions, 7 deletions
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 46497f6..dfabcc7 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -20,7 +20,7 @@
20 20
21;;; unpackaged.el: https://github.com/alphapapa/unpackaged.el 21;;; unpackaged.el: https://github.com/alphapapa/unpackaged.el
22 22
23(defun unpackaged/org-element-descendant-of (type element) 23(defun acdw-org/element-descendant-of (type element)
24 "Return non-nil if ELEMENT is a descendant of TYPE. 24 "Return non-nil if ELEMENT is a descendant of TYPE.
25TYPE should be an element type, like `item' or `paragraph'. 25TYPE should be an element type, like `item' or `paragraph'.
26ELEMENT should be a list like that returned by `org-element-context'." 26ELEMENT should be a list like that returned by `org-element-context'."
@@ -29,8 +29,7 @@ ELEMENT should be a list like that returned by `org-element-context'."
29 (or (eq type (car parent)) 29 (or (eq type (car parent))
30 (unpackaged/org-element-descendant-of type parent)))) 30 (unpackaged/org-element-descendant-of type parent))))
31 31
32;;;###autoload 32(defun acdw-org/return-dwim (&optional default)
33(defun unpackaged/org-return-dwim (&optional default)
34 "A helpful replacement for `org-return'. With prefix, call `org-return'. 33 "A helpful replacement for `org-return'. With prefix, call `org-return'.
35 34
36On headings, move point to position after entry content. In 35On headings, move point to position after entry content. In
@@ -92,7 +91,7 @@ appropriate. In tables, insert a new row or end the table."
92 (emptyp (eq (org-element-property :contents-begin context) 91 (emptyp (eq (org-element-property :contents-begin context)
93 (org-element-property :contents-end context))) 92 (org-element-property :contents-end context)))
94 (item-child-p 93 (item-child-p
95 (unpackaged/org-element-descendant-of 'item context))) 94 (acdw-org/element-descendant-of 'item context)))
96 ;; The original function from unpackaged just tested the (or ...) test 95 ;; The original function from unpackaged just tested the (or ...) test
97 ;; in this cond, in an if. However, that doesn't auto-end nested 96 ;; in this cond, in an if. However, that doesn't auto-end nested
98 ;; lists. So I made this form a cond and added the (and...) test in 97 ;; lists. So I made this form a cond and added the (and...) test in
@@ -133,7 +132,7 @@ appropriate. In tables, insert a new row or end the table."
133 ;; All other cases: call `org-return'. 132 ;; All other cases: call `org-return'.
134 (org-return))))) 133 (org-return)))))
135 134
136(defun unpackaged/org-fix-blank-lines (&optional prefix) 135(defun acdw-org/fix-blank-lines (&optional prefix)
137 "Ensure that blank lines exist between headings and 136 "Ensure that blank lines exist between headings and
138 between headings and their contents. With prefix, operate on 137 between headings and their contents. With prefix, operate on
139 whole buffer. Ensures that blank lines exist after each 138 whole buffer. Ensures that blank lines exist after each
@@ -171,10 +170,10 @@ appropriate. In tables, insert a new row or end the table."
171 nil 170 nil
172 'tree))) 171 'tree)))
173 172
174(defun acdw/hook--org-mode-fix-blank-lines () 173(defun acdw-org/fix-blanks-in-buffer ()
175 (when (eq major-mode 'org-mode) 174 (when (eq major-mode 'org-mode)
176 (let ((current-prefix-arg 4)) 175 (let ((current-prefix-arg 4))
177 (call-interactively #'unpackaged/org-fix-blank-lines)))) 176 (call-interactively #'acdw-org/fix-blank-lines))))
178 177
179 178
180;;; Generate custom IDs: 179;;; Generate custom IDs: