organize org-mode feature, split org denote

This commit is contained in:
Levi Neely 2024-09-15 18:19:55 +02:00
parent 9cb7935d24
commit aeebec61e1
3 changed files with 83 additions and 74 deletions

View File

@ -0,0 +1,23 @@
;;; feature-org-denote.el --- denote extensions for org-mode
;;; Commentary:
;;; Setup org-mode denote extensions.
;;;
;;; Code:
(require 'feature-org)
(with-eval-after-load 'denote
(defvar denote-org-capture-specifiers)
(setq denote-org-capture-specifiers "%l\n%i\n%?")
(add-to-list 'org-capture-templates
'("n" "New note (with denote.el)" plain
(file denote-last-path)
#'denote-org-capture
:no-save t
:immediate-finish nil
:kill-buffer t
:jump-to-captured t)))
(provide 'feature-org-denote)
;;; feature-org-denote.el ends here.

View File

@ -7,6 +7,27 @@
(require 'feature-pkg) (require 'feature-pkg)
(pkg/require 'org) (pkg/require 'org)
(require 'org)
(require 'org-agenda)
(require 'org-capture)
(defun my/visit-todo ()
"Visit TODO.org in home."
(interactive)
(find-file "~/alioth/TODO.org"))
(defun my/kill-all-org-agenda-buffers ()
"Close all org-agenda-related buffers."
(interactive)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(when (or (derived-mode-p 'org-agenda-mode)
(and (buffer-file-name)
(member (buffer-file-name) (org-agenda-files))))
(kill-buffer buffer))))
(message "Closed all org-agenda-related buffers."))
(defun my-org-agenda-format-item (item) (defun my-org-agenda-format-item (item)
"Format an agenda or to-do ITEM without the filename, but keep the keyword." "Format an agenda or to-do ITEM without the filename, but keep the keyword."
(let* ((marker (or (get-text-property 0 'org-marker item) (let* ((marker (or (get-text-property 0 'org-marker item)
@ -33,83 +54,48 @@
(setq org-agenda-files (setq org-agenda-files
(list "~/alioth/TODO.org")))) (list "~/alioth/TODO.org"))))
(defun my/org-config ()
"Setup personal 'org-mode' configuration."
(setq org-agenda-inhibit-startup t
org-adapt-indentation nil
org-todo-keywords '((sequence "HOLD(h)" "TODO(t)" "WAIT(w)" "|"
"DONE(d)" "CNCL(x)"))
org-todo-keyword-faces
'(("HOLD" . (:foreground "orange" :weight bold))
("TODO" . (:foreground "red" :weight bold))
("DONE" . (:foreground "green" :weight bold))
("CNCL" . (:foreground "gray" :weight bold)))
org-agenda-prefix-format '((agenda . "%i %?-12t% s ")
(todo . " %i ")
(tags . " %i ")
(search . " %i "))
org-agenda-hide-tags-regexp "."
org-agenda-todo-keyword-format "%s"
org-archive-location "%s_archive::datetree/"
org-log-done 'note
org-agenda-hide-tags-regexp nil
org-agenda-tags-column -80
org-log-into-drawer t)
(setq org-stuck-projects
'("+prj/-maybe-someday" ("TODO" "WAIT" "CNCL" "prj") nil ""))
(setq org-tags-exclude-from-inheritance '("prj")))
(defun my/org-refile-config () ;; org-mode general settings
"Setup org-refile targets." (setq org-adapt-indentation nil
(defvar org-refile-targets) org-archive-location "%s_archive::datetree/"
(defvar org-refile-use-outline-path) org-log-done 'note
(defvar org-outline-path-complete-in-steps) org-log-into-drawer t
(defvar org-refile-allow-creating-parent-nodes) org-outline-path-complete-in-steps nil
(setq org-refile-targets org-stuck-projects '("+prj/-maybe-someday"
'((nil :maxlevel . 9) ("TODO" "WAIT" "CNCL" "prj")
("~/alioth/lkn/TODO.org" :maxlevel . 9)) nil
org-refile-use-outline-path 'file "")
org-outline-path-complete-in-steps nil org-tags-exclude-from-inheritance '("prj")
org-refile-allow-creating-parent-nodes 'confirm)) org-todo-keywords '((sequence "HOLD(h)" "TODO(t)" "WAIT(w)" "|"
"DONE(d)" "CNCL(x)"))
org-todo-keyword-faces
'(("HOLD" . (:foreground "orange" :weight bold))
("TODO" . (:foreground "red" :weight bold))
("DONE" . (:foreground "green" :weight bold))
("CNCL" . (:foreground "gray" :weight bold))))
(defun my/org-capture-config () ;; org-agenda settings
"Setup org-capture." (setq org-agenda-prefix-format '((agenda . "%i %?-12t% s ")
(setq org-capture-templates (todo . " %i ")
'(("t" "TODO" entry (file "~/alioth/TODO.org") (tags . " %i ")
"* TODO %?\n %i" :prepend t))) (search . " %i "))
(with-eval-after-load 'denote org-agenda-inhibit-startup t
(defvar denote-org-capture-specifiers) org-agenda-hide-tags-regexp "."
(setq denote-org-capture-specifiers "%l\n%i\n%?") org-agenda-todo-keyword-format "%s"
(add-to-list 'org-capture-templates org-agenda-hide-tags-regexp nil
'("n" "New note (with denote.el)" plain org-agenda-tags-column -80)
(file denote-last-path)
#'denote-org-capture
:no-save t
:immediate-finish nil
:kill-buffer t
:jump-to-captured t))))
(defun my/reload-org-config () ;; org-refile settings
"Reload the org configuration." (setq org-refile-targets
(interactive) '((nil :maxlevel . 9)
(my/org-config) ("~/alioth/lkn/TODO.org" :maxlevel . 9))
(message "Org configuration reloaded")) org-refile-use-outline-path 'file
org-refile-allow-creating-parent-nodes 'confirm)
(defun my/visit-todo () ;; org-capture settings
"Visit TODO.org in home." (setq org-capture-templates
(interactive) '(("t" "TODO" entry (file "~/alioth/TODO.org")
(find-file "~/alioth/TODO.org")) "* TODO %?\n %i" :prepend t)))
(defun my/kill-all-org-agenda-buffers ()
"Close all org-agenda-related buffers."
(interactive)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(when (or (derived-mode-p 'org-agenda-mode)
(and (buffer-file-name)
(member (buffer-file-name) (org-agenda-files))))
(kill-buffer buffer))))
(message "Closed all org-agenda-related buffers."))
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(advice-add 'org-agenda :before #'my/add-remote-todo-file) (advice-add 'org-agenda :before #'my/add-remote-todo-file)
@ -120,7 +106,6 @@
(org-babel-do-load-languages 'org-babel-load-languages (org-babel-do-load-languages 'org-babel-load-languages
'((shell . t))) '((shell . t)))
;; key bindings ;; key bindings
(global-set-key (kbd "C-x c O") 'my/reload-org-config) (global-set-key (kbd "C-x c O") 'my/reload-org-config)
(global-set-key (kbd "C-x O a") 'org-agenda) (global-set-key (kbd "C-x O a") 'org-agenda)

View File

@ -28,6 +28,7 @@
(require 'feature-which-key) ; memorization is for the birds (require 'feature-which-key) ; memorization is for the birds
(require 'feature-multi-cursor) ; do repeat yourself (require 'feature-multi-cursor) ; do repeat yourself
(require 'feature-org) ; when markdown isn't good enough (require 'feature-org) ; when markdown isn't good enough
(require 'feature-org-denote) ; denote extensions for org
(require 'feature-ctags) ; a fork for your spaghetti (require 'feature-ctags) ; a fork for your spaghetti
(require 'feature-detached) ; attachment causes suffering (require 'feature-detached) ; attachment causes suffering
(require 'feature-denote) ; a second brain (require 'feature-denote) ; a second brain