]> git.earman.xyz Git - emacsinit.git/commitdiff
Org-mode comeback, great simplification
authorrearman <rearman@r717.net>
Wed, 4 Mar 2026 17:54:53 +0000 (12:54 -0500)
committerrearman <rearman@r717.net>
Wed, 4 Mar 2026 17:54:53 +0000 (12:54 -0500)
back to the roots of org, focus on agenda and molding to the GTD system.

re/re-org-defuns.el
re/re-org.el
re/re-packages.el

index 44be3b395d44ba81223753fbff4db6ec50a25545..2493d6a34c1d4333e967fc44e5b7546e3c97df74 100644 (file)
@@ -3,37 +3,12 @@
 
 ;;; Code:
 
-(defun re/org-agenda-show-custom (&optional arg)
-  "Show my custom agenda."
-  (interactive "P")
-  (org-agenda arg "g"))
-
-(defun re/org-show-agenda (&optional arg)
-  "Show the main agenda"
-  (interactive "P")
-  (org-agenda arg "a"))
-
-(defun re/org-agenda-new-frame (&optional arg)
-  "Show the main agenda in a new frame"
-  (interactive "P")
-  (re/open-with-new-frame "ORG" #'re/org-show-agenda))
-
-(defun re/org-agenda-custom-new-frame (&optional arg)
-  "Show my custom agenda in a new frame"
-  (interactive "P")
-  (re/open-with-new-frame "ORG" #'re/org-agenda-show-custom))
-
 (defun re/org-auto-generate-ids-in-file ()
   "Add ID properties to all headlines in the current
  file which do not already have one."
   (interactive)
   (org-map-entries 'org-id-get-create))
 
-(defun re/org-auto-clock ()
-  (if (string= org-state "IN-PROGRESS")
-      (org-clock-in)
-    (org-clock-out)))
-
 (defun re/org-save-all ()
   "Save all `org-agenda-files' without user confirmation."
   (interactive)
                       (when (member (buffer-file-name) org-agenda-files) t)))
   (message "Saving all org-agenda-files buffers... done"))
 
+(defun re/org-archive-all ()
+  "Archive all tasks marked `DONE' in agenda files"
+  (interactive)
+  (message "Archiving all completed tasks in org-agenda-files...")
+  (org-map-entries (lambda ()
+                    (org-archive-subtree)
+                    (setq org-map-continue-from (org-element-property :begin
+                                                                      (org-element-at-point))))
+                  "/DONE"
+                  'agenda)
+  (message "Archiving all completed tasks in org-agenda-files... done"))
+
 (provide 're-org-defuns)
 ;;; re-org-defuns.el ends here
index a30a29f184c6a0764cacfce55431a20e2d5b2d5c..83d91cef85ad42dace772c94aee172713c68b215 100644 (file)
@@ -3,86 +3,75 @@
 
 ;;; Code:
 
+;; General options
 (add-to-list 'org-export-backends 'md)
 
 (setq org-startup-indented t
       org-startup-with-inline-images t
-      org-startup-folded 'content
       org-cycle-inline-images-display t
       org-M-RET-may-split-line nil
       org-table-export-default-format "orgtbl-to-csv"
       org-ellipsis "↴")
 
-(setq org-use-fast-todo-selection 'expert
-      org-fast-tag-selection-single-key 'expert
-      org-tags-column 0
+(setq org-tags-column 0
       org-enforce-todo-dependencies t
       org-enforce-todo-checkbox-dependencies t
-      org-fontify-done-headline nil
-      org-fontify-todo-headline nil)
+      org-fontify-done-headline nil)
 
 (setq org-goto-interface 'outline-path-completion
       org-outline-path-complete-in-steps nil
-      org-goto-max-level 20
       org-goto-auto-isearch nil)
 
 (setq org-special-ctrl-a/e t
       org-special-ctrl-k t
       org-yank-adjusted-subtrees t)
+\f
+;; Agenda and capture
+(setq org-agenda-files '("~/org/inbox.org" "~/org/undertakings.org" "~/org/next.org" "~/org/meetings.org"))
 
-(setq org-link-frame-setup
-      '((file . find-file)))
-
-(setq org-directory "~/org"
-      org-agenda-files (mapcar 'file-truename (file-expand-wildcards "~/org/*.org")))
-
-(setq org-refile-targets '((nil :maxlevel . 9) (org-agenda-files :maxlevel . 9))
+;; Allow 9 levels in current file, any other org file, allow toplevel refile, and allow creation of new parents
+(setq org-refile-targets '((nil :maxlevel . 9) ((file-expand-wildcards "~/org/*.org") :maxlevel . 9))
       org-refile-use-outline-path 'file
       org-refile-allow-creating-parent-nodes 'confirm)
 
-(setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n!)" "HOLD(h!)" "|" "DONE(d)" "CANCELLED(c)" "DELEGATED(l)")))
+(setq org-todo-keywords '((sequence "TODO(t)" "WAITING(w)" "UNDERTAKING(u)" "MEETING(m)"
+                                   "|"
+                                   "DONE(d)" "BELAYED(b)" "GIVEN(g)" "MET(M)")))
 
 (setq org-agenda-restore-windows-after-quit t
       org-agenda-start-on-weekday nil
+      org-agenda-remove-tags t
+      org-agenda-span 'week
       org-agenda-window-setup 'current-window)
 
+(setq org-agenda-prefix-format '((agenda . " %-12:c%?-12t% s")
+                                (todo . " %-12:c")
+                                (tags . " %-12:c")
+                                (search . " %-12:c"))
+      org-agenda-scheduled-leaders '("BOOKED: " "In %2dx: ")
+      org-agenda-deadline-leaders '("DEADLINE: " "In %3d d.: " "%2d d. ago: "))
+
 (setq org-agenda-custom-commands
-      '(("g" "Get Things Done (GTD)"
-        ((agenda ""
-                 ((org-agenda-skip-function
-                   '(org-agenda-skip-entry-if 'deadline))
-                  (org-deadline-warning-days 0)))
-         (todo "NEXT"
-               ((org-agenda-skip-function
-                 '(org-agenda-skip-entry-if 'deadline))
-                (org-agenda-prefix-format "  %i %-12:c [%e] ")
-                (org-agenda-overriding-header "\nTasks\n")))
-         (agenda nil
-                 ((org-agenda-entry-types '(:deadline))
-                  (org-agenda-format-date "")
-                  (org-deadline-warning-days 7)
-                  (org-agenda-skip-function
-                   '(org-agenda-skip-entry-if 'regexp "\\* DONE"))
-                  (org-agenda-overriding-header "\nDeadlines\n")))
-         (tags "inbox"
-               ((org-agenda-prefix-format "  %?-12t% s")
-                (org-agenda-overriding-header "\nInbox\n")))
-         (tags "CLOSED>=\"<today>\""
-               ((org-agenda-overriding-header "\nCompleted today\n")))))))
+      '(("i" "Inbox" tags "inbox")
+       ("n" "Next Actions" todo "TODO")
+       ("u" "Undertakings" todo "UNDERTAKING")
+       ("w" "Waiting" todo "WAITING")
+       ("s" "Someday" tags "someday" ((org-agenda-files "~/org/someday.org")))))
+
+;; Configure stuck projects
+(setq org-stuck-projects '("+TODO=\"UNDERTAKING\"" ("TODO") nil ""))
 
 (setq  org-agenda-start-with-log-mode t
+       org-agenda-log-mode-items '(closed clock state)
        org-log-done 'time)
 
 (setq org-capture-templates
-      `(("i" "Inbox" entry  (file "inbox.org")
-        ,(concat "* %?\n"
-                 "/Entered on/ %U"))
-       ("m" "Meeting" entry  (file+headline "agenda.org" "Future")
-        ,(concat "* %? :meeting:\n"
-                 "<%<%Y-%m-%d %a %H:00>>"))
-       ("n" "Note" entry  (file "notes.org")
-        ,(concat "* Note (%a)\n"
-                 "/Entered on/ %U\n" "\n" "%?"))))
+      '(("i" "Inbox" entry
+        (file "inbox.org")
+        "* %^{Brief Description}\nAdded: %U\n%?")
+       ("m" "Meeting" entry
+        (file "agenda.org")
+        "* %^{Brief Description}\n%^{Scheduled:}T\n%?")))
 
 (setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id
       org-id-method 'ts
@@ -90,6 +79,9 @@
                                            org-attach-id-uuid-folder-format))
 
 (advice-add 'org-refile :after (lambda (&rest _) (re/org-save-all)))
+\f
+;; Archiving (use re/org-archive-all periodically)
+(setq org-archive-location (concat "~/org/" (format-time-string "%Y" (current-time)) ".org::datetree/"))
 
 (provide 're-org)
 ;;; re-org.el ends here
index 620b5109ab8cf49fe3b01803a886813d50071c8f..c3a4c2adee95f5e220afa48da0e1e7cbf1e62dbe 100644 (file)
 
 (use-package org
   :config
-  (require 're-org)
   (require 're-org-defuns)
+  (require 're-org)
   :bind
   (("C-c l" . org-store-link)
    ("C-c a" . org-agenda)
    ("C-c c" . org-capture)
    ("C-c b" . org-switchb)
-   ;; ("<f6>" . re/org-show-agenda)
-   ;; ("S-<f6>" . re/org-agenda-new-frame)
-   ;; ("<f8>" . re/org-agenda-show-custom)
-   ;; ("S-<f8>" . re/org-agenda-custom-new-frame)
    :map
    org-mode-map
    ("M-<right>" . org-shiftmetaright)