[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org c305bb7 69/85: org-agenda: Allow org-agenda-overrid
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org c305bb7 69/85: org-agenda: Allow org-agenda-overriding-header to be a function |
Date: |
Mon, 27 Sep 2021 15:57:53 -0400 (EDT) |
branch: externals/org
commit c305bb74181242a9f4bd1d7ce4f28bb159869631
Author: Christopher League <league@contrapunctus.net>
Commit: Bastien <bzg@gnu.org>
org-agenda: Allow org-agenda-overriding-header to be a function
* org-agenda.el (org-agenda--insert-overriding-header): Allow
`org-agenda-overriding-header' to be a function in addition to a
string or nil. When the custom agenda is created or updated, call that
function and insert the string it returns as the agenda header.
This allows custom commands to produce dynamic headers that include
up-to-date information. For example, this produces a header with a
current timestamp:
(push '("DHD" "Dynamic header demo"
((alltodo
""
((org-agenda-overriding-header
(lambda ()
(propertize
(format-time-string "-- Get crackin’, it’s %H:%M:%S!!\n")
'face 'org-agenda-structure)))))))
org-agenda-custom-commands)
User is free to add any face properties, use Org links, and include a
blank line or not. I am using this to count how many items are in
various inboxes and display them in an agenda.
---
lisp/org-agenda.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index e9ca5f2..1a3bfab 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2132,7 +2132,8 @@ works you probably want to add it to
`org-agenda-custom-commands' for good."
The inserted header depends on `org-agenda-overriding-header'.
If the empty string, don't insert a header. If any other string,
insert it as a header. If nil, insert DEFAULT, which should
-evaluate to a string."
+evaluate to a string. If a function, call it and insert the
+string that it returns."
(declare (debug (form)) (indent defun))
`(cond
((not org-agenda-overriding-header) (insert ,default))
@@ -2141,6 +2142,8 @@ evaluate to a string."
(insert (propertize org-agenda-overriding-header
'face 'org-agenda-structure)
"\n"))
+ ((functionp org-agenda-overriding-header)
+ (insert (funcall org-agenda-overriding-header)))
(t (user-error "Invalid value for `org-agenda-overriding-header': %S"
org-agenda-overriding-header))))
@@ -5052,10 +5055,11 @@ used by user-defined selections using
`org-agenda-skip-function'.")
(defvar org-agenda-overriding-header nil
"When set during agenda, todo and tags searches it replaces the header.
If an empty string, no header will be inserted. If any other
-string, it will be inserted as a header. If nil, a header will
-be generated automatically according to the command. This
-variable should not be set directly, but custom commands can bind
-it in the options section.")
+string, it will be inserted as a header. If a function, insert
+the string returned by the function as a header. If nil, a
+header will be generated automatically according to the command.
+This variable should not be set directly, but custom commands can
+bind it in the options section.")
(defun org-agenda-skip-entry-if (&rest conditions)
"Skip entry if any of CONDITIONS is true.
- [elpa] externals/org 777c1c3 27/85: Merge branch 'bugfix', (continued)
- [elpa] externals/org 777c1c3 27/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 74a5af6 31/85: Fix byte-comp function warnings, ELPA Syncer, 2021/09/27
- [elpa] externals/org 4d1a77a 32/85: org-attach: Fix byte-comp function warning, ELPA Syncer, 2021/09/27
- [elpa] externals/org 18f6ef8 33/85: ox.el: add smart quotes for greek, ELPA Syncer, 2021/09/27
- [elpa] externals/org 1c83f6f 47/85: Allow sexps with nested parenthesis in org-agenda-prefix-format, ELPA Syncer, 2021/09/27
- [elpa] externals/org d3d80c5 46/85: Add test checking org-log-done specs, ELPA Syncer, 2021/09/27
- [elpa] externals/org df51e93 53/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 72c9f1b 43/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org acc49d5 41/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 1f3722c 65/85: Backport commit c78e16962 from Emacs, ELPA Syncer, 2021/09/27
- [elpa] externals/org c305bb7 69/85: org-agenda: Allow org-agenda-overriding-header to be a function,
ELPA Syncer <=
- [elpa] externals/org 2db02f9 70/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 177745e 73/85: doc/org-manual.org (Citations handling): New section, ELPA Syncer, 2021/09/27
- [elpa] externals/org 1f2c26a 15/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 815c0b3 19/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org f5392c4 08/85: Merge branch 'km/from-emacs-master', ELPA Syncer, 2021/09/27
- [elpa] externals/org 4063d4c 06/85: org: Rename for more consistency, ELPA Syncer, 2021/09/27
- [elpa] externals/org 9a4a24a 12/85: mk/targets.mk: Fix ORGVERSION in tag-less repos, ELPA Syncer, 2021/09/27
- [elpa] externals/org 2311677 13/85: mk/server.mk: Use a new path, ELPA Syncer, 2021/09/27
- [elpa] externals/org ce99b55 14/85: Merge commit '986341bd08', ELPA Syncer, 2021/09/27
- [elpa] externals/org 26b0297 20/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27