capture denote todo items in org-agenda / todo
This commit is contained in:
parent
603be0a089
commit
de4a8ff543
|
|
@ -137,6 +137,59 @@
|
|||
(use-package org :ensure t
|
||||
:mode (("\\.org$" . org-mode)))
|
||||
|
||||
;; Set up org-agenda-files to include ~/notes and its subdirectories
|
||||
(setq org-agenda-files
|
||||
(directory-files-recursively "~/notes" "\\.org$"))
|
||||
|
||||
;; Configure org-agenda-prefix-format to show minimal information
|
||||
(setq org-agenda-prefix-format
|
||||
'((agenda . " %i ")
|
||||
(todo . " %i ")
|
||||
(tags . " %i ")
|
||||
(search . " %i ")))
|
||||
|
||||
;; Hide the filename in the agenda view
|
||||
(setq org-agenda-hide-tags-regexp ".")
|
||||
|
||||
;; Remove the filename from agenda and TODO items, but keep the keyword
|
||||
(defun my-org-agenda-format-item (item)
|
||||
"Format an agenda or TODO item without the filename, but keep the keyword."
|
||||
(let* ((marker (or (get-text-property 0 'org-marker item)
|
||||
(get-text-property 0 'org-hd-marker item)))
|
||||
(line (when marker
|
||||
(org-with-point-at marker
|
||||
(buffer-substring (line-beginning-position) (line-end-position)))))
|
||||
(todo-keyword (when marker
|
||||
(org-with-point-at marker
|
||||
(org-get-todo-state))))
|
||||
(truncated-line (when line
|
||||
(replace-regexp-in-string "^\\[#[A-Z]\\] " "" line))))
|
||||
(if truncated-line
|
||||
(let ((clean-item (replace-regexp-in-string "^\\(\\*+ \\)" "" truncated-line)))
|
||||
(if todo-keyword
|
||||
(concat todo-keyword " " (replace-regexp-in-string (concat "^" todo-keyword " ?") "" clean-item))
|
||||
clean-item))
|
||||
item)))
|
||||
|
||||
;; Apply our custom formatting to agenda items
|
||||
(advice-add 'org-agenda-format-item-line :filter-return #'my-org-agenda-format-item)
|
||||
|
||||
;; Apply our custom formatting to TODO items
|
||||
(advice-add 'org-agenda-format-item :filter-return #'my-org-agenda-format-item)
|
||||
|
||||
;; Keep the TODO keyword visible in the agenda
|
||||
(setq org-agenda-todo-keyword-format "%s")
|
||||
|
||||
;; Ensure org-agenda is refreshed when files are added or removed
|
||||
(defun refresh-org-agenda-files ()
|
||||
(interactive)
|
||||
(setq org-agenda-files
|
||||
(directory-files-recursively "~/notes" "\\.org$")))
|
||||
|
||||
(run-with-idle-timer 300 t 'refresh-org-agenda-files)
|
||||
|
||||
|
||||
|
||||
(use-package ob-go :ensure t :defer t)
|
||||
|
||||
(use-package ox-hugo :ensure t :defer t) ;; gitlab uses goldmark
|
||||
|
|
@ -213,6 +266,7 @@
|
|||
:jump-to-captured t)))
|
||||
)
|
||||
|
||||
|
||||
;; projects
|
||||
;; ===
|
||||
(use-package projectile :ensure t :defer t
|
||||
|
|
|
|||
Loading…
Reference in New Issue