Emacs : agenda configuration☠

This commit is contained in:
2022-05-19 17:14:10 +09:00
parent ef091d74d0
commit e298e2a328
3 changed files with 84 additions and 2 deletions

View File

@ -2,7 +2,7 @@
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
(setq default-input-method "korean-hangul")
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
@ -156,6 +156,87 @@ same directory as the org-buffer and insert a link to this file."
(add-to-list 'org-structure-template-alist '("vl" . "src verilog"))
(add-to-list 'org-structure-template-alist '("vh" . "src vhdl")))
;; --------------------------------------------------------------------------------------------
;; - Org Agenda
;; --------------------------------------------------------------------------------------------
(use-package! org-super-agenda
:after org
:config
(org-super-agenda-mode 1)
(my/org-roam-refresh-agenda-list)
(setq org-super-agenda-groups
'(;; Each group has an implicit boolean OR operator between its selectors.
(:name "Today" ; Optionally specify section name
:time-grid t ; Items that appear on the time grid
:todo "NEXT") ; Items that have this TODO keyword
(:name "Important"
;; Single arguments given alone
:priority "A")
)))
(defun my/org-roam-list-notes-by-tag (tag-name)
(mapcar #'org-roam-node-file
(seq-filter
(my/org-roam-filter-by-tag tag-name)
(org-roam-node-list))))
(defun my/org-roam-refresh-agenda-list ()
(interactive)
(setq org-agenda-files (my/org-roam-list-notes-by-tag "Project"))
(add-to-list 'org-agenda-files "~/org/agenda/agenda.org"))
(defun my/org-roam-filter-by-tag (tag-name)
(lambda (node)
(member tag-name (org-roam-node-tags node))))
(with-eval-after-load 'org-roam
(defun my/org-roam-project-finalize-hook ()
"Adds the captured project file to `org-agenda-files' if the
capture was not aborted."
;; Remove the hook since it was added temporarily
(remove-hook 'org-capture-after-finalize-hook #'my/org-roam-project-finalize-hook)
;; Add project file to the agenda list if the capture was confirmed
(unless org-note-abort
(with-current-buffer (org-capture-get :buffer)
(add-to-list 'org-agenda-files (buffer-file-name)))))
(defun my/org-roam-find-project ()
(interactive)
;; Add the project file to the agenda after capture is finished
(add-hook 'org-capture-after-finalize-hook #'my/org-roam-project-finalize-hook)
;; Select a project file to open, creating it if necessary
(org-roam-node-find
nil
nil
(my/org-roam-filter-by-tag "Project")
:templates
'(("p" "project" plain "* Goals\n\n%?\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+category: ${title}\n#+filetags: Project")
:unnarrowed t))))
(defun my/org-roam-capture-inbox ()
(interactive)
(org-roam-capture- :node (org-roam-node-create)
:templates '(("i" "inbox" plain "* %?"
:if-new (file+head "Inbox.org" "#+title: Inbox\n")))))
(defun my/org-roam-copy-todo-to-today ()
(interactive)
(let ((org-refile-keep t) ;; Set this to nil to delete the original!
(org-roam-dailies-capture-templates
'(("t" "tasks" entry "%?"
:if-new (file+head+olp "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n" ("Tasks")))))
(org-after-refile-insert-hook #'save-buffer)
today-file
pos)
(save-window-excursion
(org-roam-dailies--capture (current-time) t)
(setq today-file (buffer-file-name))
(setq pos (point)))
;; Only refile if the target file is different than the current file
(unless (equal (file-truename today-file)
(file-truename (buffer-file-name)))
(org-refile nil nil (list "Tasks" today-file nil pos))))))
;; --------------------------------------------------------------------------------------------
;; - Org Mode extra configuration
;; --------------------------------------------------------------------------------------------
(setq org-odt-preferred-output-format "docx")

View File

@ -55,3 +55,4 @@
(package! nov)
;;(package! org-caldav)
(package! openwith)
(package! org-super-agenda)

2
.zshrc
View File

@ -1,6 +1,6 @@
export ZSH="/home/jaeus/.oh-my-zsh"
ZSH_THEME="random"
plugins=(git)
#plugins=(git)
source $ZSH/oh-my-zsh.sh
prompt_context(){}
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh