diff options
| author | bh <qn+git@excalibur.computer> | 2026-05-25 00:47:05 +0800 |
|---|---|---|
| committer | bh <qn+git@excalibur.computer> | 2026-05-25 00:47:05 +0800 |
| commit | 9b947bd0e899f929b9c1bc30c25104107e551bbd (patch) | |
| tree | c3944678f5c47469453cfcd6eb1bec1b0e8f2370 | |
| parent | d08a6e2e64101241a674824417c1c125f482753a (diff) | |
Tweak more stuff in org-mode
| -rw-r--r-- | config/evil.el | 8 | ||||
| -rw-r--r-- | config/org.el | 32 |
2 files changed, 27 insertions, 13 deletions
diff --git a/config/evil.el b/config/evil.el index 0e40002..e3297f3 100644 --- a/config/evil.el +++ b/config/evil.el @@ -31,3 +31,11 @@ :files (:defaults "modes")) :config (evil-collection-init)) ;; Provides Evil bindings for many Emacs modes + +(use-package evil-org + :after (evil org) + :hook (org-mode . evil-org-mode) + :config + (evil-org-set-key-theme '(navigation insert textobjects additional calendar)) + (require 'evil-org-agenda) + (evil-org-agenda-set-keys)) diff --git a/config/org.el b/config/org.el index 88be8e8..cdb3156 100644 --- a/config/org.el +++ b/config/org.el @@ -18,7 +18,7 @@ ;; TODO workflow states (setq org-todo-keywords - '((sequence "TODO" "DOING" "|" "DONE"))) + '((sequence "TODO" "|" "DONE"))) ;; Log timestamp when task is marked DONE (setq org-log-done 'time) @@ -28,20 +28,25 @@ ;; ===================================== (defun org-update-deadline-properties () - "Update DAYS and URGENCY properties for all TODO entries with deadlines." + "Update DAYS and URGENCY properties for all entries with deadlines." (interactive) (org-map-entries (lambda () - (let ((deadline (org-get-deadline-time (point)))) + (let ((deadline (org-get-deadline-time (point))) + (done (org-entry-is-done-p))) (when deadline - (let* ((days (- (time-to-days deadline) (time-to-days (current-time)))) - (urgency (cond - ((< days 0) "OVERDUE") - ((<= days 7) "CLOSE") - (t "OK")))) - (org-set-property "DAYS" (number-to-string days)) - (org-set-property "URGENCY" urgency))))) - "/!TODO|DOING" 'file)) + (if done + (progn + (org-set-property "DAYS" "0") + (org-set-property "URGENCY" "DONE")) + (let* ((days (- (time-to-days deadline) (time-to-days (current-time)))) + (urgency (cond + ((< days 0) "OVERDUE") + ((<= days 7) "CLOSE") + (t "OK")))) + (org-set-property "DAYS" (number-to-string days)) + (org-set-property "URGENCY" urgency)))))) + "/TODO|DONE" 'file)) ;; Auto-update when opening org files (add-hook 'org-mode-hook @@ -79,8 +84,9 @@ ;; ===================================== (use-package calfw - :commands cfw:open-calendar-buffer) + :demand t) (use-package calfw-org + :demand t :after calfw - :commands cfw:open-org-calendar) +) |