summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob L. Kreuze2022-07-17 18:47:16 -0400
committerJakob L. Kreuze2022-07-17 18:47:16 -0400
commitee62abe23c19fb4c7e20460f93cf02c459a5b9d0 (patch)
treec5e818dc3b64a31ab0237f61c640ff1e2d519cbb
parentda3bcd1cbc69cbc99deb9a65551aeed3ef606ead (diff)
Add dynamic ranking commands
-rw-r--r--lisp/documents.el62
1 files changed, 39 insertions, 23 deletions
diff --git a/lisp/documents.el b/lisp/documents.el
index a140961..af5d4d2 100644
--- a/lisp/documents.el
+++ b/lisp/documents.el
@@ -7,25 +7,6 @@
;;; Spell-checking, and the like.
;;;
-;; TODO: This functionality isn't done.
-
-(defun org-agenda-update-rank ()
- (interactive)
- (save-excursion
- (let ((i 0))
- (message (format "%s" i))
- (goto-char 0)
- (while (= 0 (forward-line 1))
- (move-beginning-of-line 1)
- (let ((orig (get-text-property (point) 'org-marker)))
- (when orig
- (org-with-point-at orig
- (org-entry-put nil "RANK" (number-to-string i))
- (setq i (+ i (expt 10 (- 4 (org-current-level))))))))
- (message (format "%s" (point)))))))
-
-
-
;; Ensure that my Aspell "personal dictionary" is included when invoking ispell.
(setq ispell-personal-dictionary "~/.aspell.en.pws")
@@ -270,7 +251,9 @@ Visits LINK, or if LINK names a subdirectory of
(if (or (string= (org-entry-get nil "STYLE") "habit")
(not (member (org-entry-get nil "TODO")
'("TODO" "IN-PROGRESS")))
- (org-entry-get nil "SCHEDULED")
+ ;; Ignore if scheduled timestamp has range
+ (and (org-entry-get nil "SCHEDULED")
+ (string-match "[[:digit:]][[:digit:]]:[[:digit:]][[:digit:]]-[[:digit:]][[:digit:]]:[[:digit:]][[:digit:]]" (org-entry-get nil "SCHEDULED")))
(cl-search "Inbox.org" (buffer-name)))
subtree-end
nil)))))
@@ -286,6 +269,11 @@ Visits LINK, or if LINK names a subdirectory of
("D" "Daily Todo"
((agenda ""
((org-agenda-span 'day)
+ (org-agenda-skip-function ,subtree-is-not-calendar-item)
+ (org-agenda-overriding-header "Schedule Today:")
+ (org-agenda-prefix-format " %i %-12:c%t %l")))
+ (agenda ""
+ ((org-agenda-span 'day)
(org-agenda-skip-function ,subtree-is-not-habit)
(org-deadline-warning-days 0)
(org-agenda-overriding-header "Habits:")))
@@ -303,11 +291,39 @@ Visits LINK, or if LINK names a subdirectory of
;; persistent. Specifically, we introduce `user-defined-up' to the sorting
;; strategies for `todo'.
(setq org-agenda-sorting-strategy
- '((agenda habit-down time-up priority-down category-keep user-defined-down)
- (todo category-keep user-defined-up priority-down)
+ '((agenda habit-down time-up priority-down category-keep)
+ (todo user-defined-up priority-down category-keep)
(tags priority-down category-keep)
(search category-keep)))
+ (defun org-agenda-update-rank ()
+ "Interactive command to assign a rank to all agenda entries"
+ (interactive)
+ (save-excursion
+ (let ((i 0))
+ (message (format "%s" i))
+ (goto-char 0)
+ (while (= 0 (forward-line 1))
+ (move-beginning-of-line 1)
+ (let ((orig (get-text-property (point) 'org-marker)))
+ (when orig
+ (org-with-point-at orig
+ (org-entry-put nil "RANK" (number-to-string i))
+ (setq i (+ i (expt 10 (- 4 (org-current-level))))))))
+ (message (format "%s" (point)))))))
+
+ (defun org-agenda-clear-rank ()
+ "Interactive command to reset the rank on all agenda entries"
+ (interactive)
+ (save-excursion
+ (goto-char 0)
+ (while (= 0 (forward-line 1))
+ (move-beginning-of-line 1)
+ (let ((orig (get-text-property (point) 'org-marker)))
+ (when orig
+ (org-with-point-at orig
+ (org-entry-delete nil "RANK")))))))
+
(defun org-agenda-sort-by-rank (a b)
(let* ((a-pos (get-text-property 0 'org-marker a))
(b-pos (get-text-property 0 'org-marker b))
@@ -339,7 +355,7 @@ Visits LINK, or if LINK names a subdirectory of
;; Patch in an offset for tag alignment. (Without this, they will warp in a
;; way which I do not like.)
- :config/el-patch
+ :init
(el-patch-defun org-agenda-align-tags (&optional line)
"Align all tags in agenda items to `org-agenda-tags-column'.
When optional argument LINE is non-nil, align tags only on the

© 2015 - 2026 Jakob L. Kreuze