aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-16 14:35:56 -0500
committerCraig Jennings <c@cjennings.net>2026-07-16 14:35:56 -0500
commit7e0ac9d9fd2d7f539e07d785e4c26aa520513195 (patch)
treeb73e1439e8c04a50e35c2fae76d7aba5a1db44aa /modules
parentf6942685fb9202a6b85e264043ec2d179675d608 (diff)
downloaddotemacs-7e0ac9d9fd2d7f539e07d785e4c26aa520513195.tar.gz
dotemacs-7e0ac9d9fd2d7f539e07d785e4c26aa520513195.zip
fix(org-agenda): hoist cj/timeformat out of the defun it was buried in
cj/timeformat was defvar'd inside cj/add-timestamp-to-org-entry, so the symbol wasn't special until the command had run once. Until then a let around the call bound it lexically and never reached the function. I moved it to top level with a docstring. It has no other callers. The nested defvar also poisons tests. ERT runs alphabetically, so an earlier test that calls the command makes the symbol special retroactively. A later special-variable-p check then passes on test ordering rather than on the code, reading green in a full-file run and red in isolation. The new guard snapshots special-variable-p into a defconst at load, before any test body runs. I filled in the missing coverage: point and the following line survive the insert, empty and unicode time strings, an empty buffer, and a read-only buffer signalling rather than dropping the stamp. The empty-string case pins a trailing space (current behavior, characterized rather than changed).
Diffstat (limited to 'modules')
-rw-r--r--modules/org-agenda-config.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/org-agenda-config.el b/modules/org-agenda-config.el
index d4407b28..632184e5 100644
--- a/modules/org-agenda-config.el
+++ b/modules/org-agenda-config.el
@@ -383,11 +383,14 @@ The agenda is rebuilt from all sources before display, including:
;; ------------------------- Add Timestamp To Org Entry ------------------------
;; simply adds a timestamp to put the org entry on an agenda
+(defvar cj/timeformat "%Y-%m-%d %a"
+ "Date format for the stamp `cj/add-timestamp-to-org-entry' inserts.
+Must stay an org-readable date so the stamped line reaches the agenda.")
+
(defun cj/add-timestamp-to-org-entry (s)
"Add an event with time S to appear underneath the line-at-point.
This allows a line to show in an agenda without being scheduled or a deadline."
(interactive "sTime: ")
- (defvar cj/timeformat "%Y-%m-%d %a")
(org-end-of-line)
(save-excursion
(open-line 1)