The following is an example of how to examine the text-properties of the items being generated by org-agenda-list
, and modify the string based on certain criteria. In this example, the value of the text property ts-date
is obtained and compared against the current date -- if it is overdue, we add OLD:
; if it is current, we add CURRENT:
, if its future, we add FUTURE:
. The original poster can customize this example add a new line and/or a divider line at select locations. The customization may vary depending upon the sorting criteria chosen by the original poster in the org-agenda-sorting-strategy
, etc.
In this example, the function org-agenda-finalize-entries
has been modified near the bottom between the sections labeled ;; BEGIN modification
and ;; END modification
.
(require 'org-agenda)
(defun org-agenda-finalize-entries (list &optional type)
"Sort, limit and concatenate the LIST of agenda items.
The optional argument TYPE tells the agenda type."
(let ((max-effort (cond ((listp org-agenda-max-effort)
(cdr (assoc type org-agenda-max-effort)))
(t org-agenda-max-effort)))
(max-todo (cond ((listp org-agenda-max-todos)
(cdr (assoc type org-agenda-max-todos)))
(t org-agenda-max-todos)))
(max-tags (cond ((listp org-agenda-max-tags)
(cdr (assoc type org-agenda-max-tags)))
(t org-agenda-max-tags)))
(max-entries (cond ((listp org-agenda-max-entries)
(cdr (assoc type org-agenda-max-entries)))
(t org-agenda-max-entries))) l)
(when org-agenda-before-sorting-filter-function
(setq list
(delq nil
(mapcar
org-agenda-before-sorting-filter-function list))))
(setq list (mapcar 'org-agenda-highlight-todo list)
list (mapcar 'identity (sort list 'org-entries-lessp)))
(when max-effort
(setq list (org-agenda-limit-entries
list 'effort-minutes max-effort 'identity)))
(when max-todo
(setq list (org-agenda-limit-entries list 'todo-state max-todo)))
(when max-tags
(setq list (org-agenda-limit-entries list 'tags max-tags)))
(when max-entries
(setq list (org-agenda-limit-entries list 'org-hd-marker max-entries)))
;; BEGIN modification
(setq list
(mapcar
(lambda (string)
(let* (
(current-date (time-to-days (current-time)))
(ts-date (get-text-property 0 'ts-date string)) )
(if ts-date
(cond
((< ts-date current-date)
(message "The task dated %s is overdue." ts-date)
;; The new value of `string' is returned/thrown as a result.
(replace-regexp-in-string "^" "OLD: " string))
((= ts-date current-date)
(message "The task dated %s is due today." ts-date)
;; The new value of `string' is returned/thrown as a result.
(replace-regexp-in-string "^" "CURRENT: " string))
((> ts-date current-date)
(message "The task dated %s is not due yet." ts-date)
;; The new value of `string' is returned/thrown as a result.
(replace-regexp-in-string "^" "FUTURE: " string)))
string)))
list))
;; END modification
(mapconcat 'identity list "\n")))
replace-regexp-in-string
(add divider lines and/or newlines as you desire); you can have astring-equals
or matches certain criteria or any other criteria you seek. Examine the existing text-properties with values to familiarize yourself with what is included out-of-the-box, and then use them.org-mode
raw data that doesn't even involve manipulating the data with replacing any portions of the string. I.e, just examine the text properties and if they match your criteria, insert something like a line before or after as the buffer is being populated by themapcar
in the example of the link above. This project could conceivable entail some time to implement to create a customorg-agenda
buffer, and the example does not contemplateorg-search-view
ororg-tags-view
-- i.e., onlyorg-agenda-list
.