[oni-org] Search through the archive for project tasks
When I archive tasks I still want them to show up in the projects.
This commit is contained in:
parent
c63f5f0fec
commit
df3396bd8f
1 changed files with 19 additions and 13 deletions
|
@ -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) "]]"))
|
||||
|
|
Loading…
Reference in a new issue