mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 00:57:22 +01:00
feat: improve org-capture templates
Some checks are pending
Flake check / Check flake (push) Waiting to run
Some checks are pending
Flake check / Check flake (push) Waiting to run
This commit is contained in:
parent
37686e3a1e
commit
ae2126f363
3 changed files with 819 additions and 584 deletions
|
|
@ -804,6 +804,22 @@ create a new one."
|
|||
(setq auth-sources '( "~/.emacs.d/.authinfo")
|
||||
auth-source-cache-expiry nil)
|
||||
|
||||
(defun swarsel/org-agenda-done-and-archive ()
|
||||
"Mark TODO at point as DONE, archive it, and save all agenda files."
|
||||
(interactive)
|
||||
(let ((org-archive-location "~/Nextcloud/Org/Archive.org::Archive"))
|
||||
(org-agenda-todo "DONE")
|
||||
(org-agenda-archive)
|
||||
(dolist (buf (buffer-list))
|
||||
(with-current-buffer buf
|
||||
(when (and buffer-file-name
|
||||
(string-prefix-p (expand-file-name "~/Nextcloud/Org/") (file-truename buffer-file-name))
|
||||
(derived-mode-p 'org-mode))
|
||||
(save-buffer))))))
|
||||
|
||||
(with-eval-after-load 'org-agenda
|
||||
(define-key org-agenda-mode-map (kbd "C-a") #'swarsel/org-agenda-done-and-archive))
|
||||
|
||||
(use-package org
|
||||
;;:diminish (org-indent-mode)
|
||||
:hook (org-mode . swarsel/org-mode-setup)
|
||||
|
|
@ -830,6 +846,12 @@ create a new one."
|
|||
"/home/swarsel/Nextcloud/Org/Archive.org"
|
||||
))
|
||||
|
||||
(setq org-capture-templates
|
||||
'(("t" "Todo" entry (file+headline "~/Nextcloud/Org/Tasks.org" "Inbox")
|
||||
"* TODO %?\n %i\n %a")
|
||||
("j" "Journal" entry (file+datetree "~/Nextcloud/Org/Journal.org")
|
||||
"* %?\nEntered on %U\n %i\n %a")))
|
||||
|
||||
(setq org-refile-targets
|
||||
'((swarsel-archive-org-file :maxlevel . 1)
|
||||
(swarsel-tasks-org-file :maxlevel . 1)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue