summaryrefslogtreecommitdiff
path: root/lisp/ss-org.el
diff options
context:
space:
mode:
authorSzymon Szukalski <szymon@szymonszukalski.com>2026-04-10 13:44:48 +1000
committerSzymon Szukalski <szymon@szymonszukalski.com>2026-04-10 13:44:48 +1000
commitf6fc37d74f0b027ea7cfb1c6ff5c9e362d8af465 (patch)
tree1263f3f6736b0e464c78a9916b4ce6cb3855121f /lisp/ss-org.el
parentca8e1ea67b46f427829e272ac3eaf8186c04577a (diff)
Add Org refile configuration
Diffstat (limited to 'lisp/ss-org.el')
-rw-r--r--lisp/ss-org.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/ss-org.el b/lisp/ss-org.el
index 6f1ae1b..88590fa 100644
--- a/lisp/ss-org.el
+++ b/lisp/ss-org.el
@@ -243,6 +243,19 @@ This is for significant navigation points only and clears forward history."
(interactive)
(find-file (ss-require-existing-file ss-moc-file)))
+(defun ss-org-refresh-agenda-files-for-refile (&rest _args)
+ "Refresh `org-agenda-files' before refile when agenda setup is available."
+ (when (fboundp 'ss-refresh-org-agenda-files)
+ (ss-refresh-org-agenda-files)))
+
+(defun ss-org-configure-refile ()
+ "Configure Org refile to target any heading in `org-agenda-files'."
+ (setq org-refile-targets '((org-agenda-files :regexp . "^\\*+ "))
+ org-refile-use-outline-path 'file
+ org-outline-path-complete-in-steps nil)
+ (unless (advice-member-p #'ss-org-refresh-agenda-files-for-refile #'org-refile)
+ (advice-add 'org-refile :before #'ss-org-refresh-agenda-files-for-refile)))
+
(defun ss-org-setup ()
"Initialize base Org configuration."
(use-package org
@@ -259,6 +272,7 @@ This is for significant navigation points only and clears forward history."
"DONE(d)" "CANCELLED(x@)"))
org-log-done 'note
org-log-into-drawer t)
+ (ss-org-configure-refile)
(add-hook 'org-mode-hook
(lambda ()
(setq-local org-hide-emphasis-markers t)