summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el9
-rw-r--r--lisp/acdw-org.el13
2 files changed, 11 insertions, 11 deletions
diff --git a/init.el b/init.el index 6f97e02..d3a4111 100644 --- a/init.el +++ b/init.el
@@ -375,7 +375,7 @@
375 375
376(setup (:straight (org :host nil 376(setup (:straight (org :host nil
377 :repo "https://code.orgmode.org/bzg/org-mode.git")) 377 :repo "https://code.orgmode.org/bzg/org-mode.git"))
378 (require 'acdw-org) 378 (require 'acdw-org) ; so I don't clutter up init.el
379 (:option org-adapt-indentation nil 379 (:option org-adapt-indentation nil
380 org-catch-invisible-edits 'smart 380 org-catch-invisible-edits 'smart
381 org-confirm-babel-evaluate nil 381 org-confirm-babel-evaluate nil
@@ -400,10 +400,11 @@
400 org-startup-truncated nil 400 org-startup-truncated nil
401 org-tags-column (- 0 fill-column -3) 401 org-tags-column (- 0 fill-column -3)
402 org-directory "~/org") 402 org-directory "~/org")
403 (:bind "RET" unpackaged/org-return-dwim 403 (:bind "RET" acdw-org/return-dwim
404 "<S-return>" acdw-org/org-table-copy-down) 404 "<S-return>" acdw-org/org-table-copy-down)
405 (add-hook 'before-save-hook #'acdw/hook--org-mode-fix-blank-lines) 405 (add-hook 'before-save-hook #'acdw-org/fix-blank-lines-in-buffer)
406 (advice-add 'org-delete-backward-char :override #'acdw-org/delete-backward-char)) 406 (advice-add 'org-delete-backward-char
407 :override #'acdw-org/delete-backward-char))
407 408
408(setup eshell 409(setup eshell
409 (:option eshell-directory-name (acdw/dir "eshell/" t) 410 (:option eshell-directory-name (acdw/dir "eshell/" t)
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: