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
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -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
1358
index.html
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue