feat: improve org-capture templates
Some checks are pending
Flake check / Check flake (push) Waiting to run

This commit is contained in:
Leon Schwarzäugl 2025-08-09 14:31:45 +02:00
parent 37686e3a1e
commit ae2126f363
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
3 changed files with 819 additions and 584 deletions

View file

@ -18902,6 +18902,22 @@ This part of the configuration mostly makes some aesthetic changes, enables neat
#+begin_src emacs-lisp #+begin_src emacs-lisp
(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 (use-package org
;;:diminish (org-indent-mode) ;;:diminish (org-indent-mode)
:hook (org-mode . swarsel/org-mode-setup) :hook (org-mode . swarsel/org-mode-setup)
@ -18928,11 +18944,18 @@ This part of the configuration mostly makes some aesthetic changes, enables neat
"/home/swarsel/Nextcloud/Org/Archive.org" "/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 (setq org-refile-targets
'((swarsel-archive-org-file :maxlevel . 1) '((swarsel-archive-org-file :maxlevel . 1)
(swarsel-tasks-org-file :maxlevel . 1))) (swarsel-tasks-org-file :maxlevel . 1)))
) )
#+end_src #+end_src
**** org-appear **** org-appear
:PROPERTIES: :PROPERTIES:

View file

@ -804,6 +804,22 @@ create a new one."
(setq auth-sources '( "~/.emacs.d/.authinfo") (setq auth-sources '( "~/.emacs.d/.authinfo")
auth-source-cache-expiry nil) 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 (use-package org
;;:diminish (org-indent-mode) ;;:diminish (org-indent-mode)
:hook (org-mode . swarsel/org-mode-setup) :hook (org-mode . swarsel/org-mode-setup)
@ -830,6 +846,12 @@ create a new one."
"/home/swarsel/Nextcloud/Org/Archive.org" "/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 (setq org-refile-targets
'((swarsel-archive-org-file :maxlevel . 1) '((swarsel-archive-org-file :maxlevel . 1)
(swarsel-tasks-org-file :maxlevel . 1))) (swarsel-tasks-org-file :maxlevel . 1)))

1358
index.html

File diff suppressed because it is too large Load diff