aboutsummaryrefslogtreecommitdiffstats
path: root/oni-org
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-06-05 14:14:56 -0700
committerGravatar Tom Willemse2022-06-05 14:14:56 -0700
commitdf3396bd8f98eca3bf63550410d33cacf514830f (patch)
treeb5fede15a7100562d1139adbd3fef6a684f35e64 /oni-org
parentc63f5f0fec205962ce9037510fb7de3efba4ee01 (diff)
downloademacs-config-df3396bd8f98eca3bf63550410d33cacf514830f.tar.gz
emacs-config-df3396bd8f98eca3bf63550410d33cacf514830f.zip
[oni-org] Search through the archive for project tasks
When I archive tasks I still want them to show up in the projects.
Diffstat (limited to 'oni-org')
-rw-r--r--oni-org/oni-org.el32
1 files changed, 19 insertions, 13 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el
index a1f9336..9f5cfaf 100644
--- a/oni-org/oni-org.el
+++ b/oni-org/oni-org.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2022.0526.181315
+;; Version: 2022.0602.214649
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch)
;; This program is free software; you can redistribute it and/or modify
@@ -828,24 +828,30 @@ This is an around advice for ‘org-html--svg-image’ as FUN."
(add-hook 'org-property-allowed-value-functions #'oni-org-pick-project)
(defun oni-org-dblock-write-project-steps (_params)
- "Generate backlinks to org headings."
- (let ((current-heading (nth 4 (org-heading-components)))
- (current-heading-id
+ "Generate back-links to org headings."
+ (let ((current-heading-id
(let ((properties (org-entry-properties)))
(or (alist-get "CUSTOM_ID" properties nil nil #'string=)
(org-id-get-create))))
+ (files (org-add-archive-files (list (buffer-file-name))))
backlinks)
(when (not (null current-heading-id))
(save-excursion
- (goto-char (point-min))
- (while (re-search-forward
- (rx (or (seq "[[id:" (literal current-heading-id) "]")
- (seq "#" (literal current-heading-id) "]")))
- nil t)
- (unless (or (oni-org-in-dblock-p)
- (oni-org-at-origin-property-p))
- (let ((components (org-heading-components)))
- (push (list (org-entry-is-done-p) (point) (nth 4 components)) backlinks))))))
+ (mapc (lambda (file)
+ (with-current-buffer (or (get-file-buffer file)
+ (progn
+ (find-file-noselect file)
+ (get-file-buffer file)))
+ (goto-char (point-min))
+ (while (re-search-forward
+ (rx (or (seq "[[id:" (literal current-heading-id) "]")
+ (seq "#" (literal current-heading-id) "]")))
+ nil t)
+ (unless (or (oni-org-in-dblock-p)
+ (oni-org-at-origin-property-p))
+ (let ((components (org-heading-components)))
+ (push (list (org-entry-is-done-p) (point) (nth 4 components)) backlinks))))))
+ files)))
(insert (string-join
(mapcar (lambda (link)
(concat "- " (if (car link) "[X]" "[ ]") " [[*" (caddr link) "][" (caddr link) "]]"))