]> git.eshelyaron.com Git - emacs.git/commit
Align date stamps to whole days in ERC
authorF. Jason Park <jp@neverwas.me>
Fri, 3 Nov 2023 00:05:48 +0000 (17:05 -0700)
committerF. Jason Park <jp@neverwas.me>
Sat, 4 Nov 2023 22:41:55 +0000 (15:41 -0700)
commitf99a0dae7ca1c5fe5232dafd7b1290b3435ad526
tree922d67b10f39b669d5151da9d6b9b9e865f69b55
parent4c8510857693812ff7ff635cd0d70f97022792db
Align date stamps to whole days in ERC

* lisp/erc/erc-stamp.el (erc-stamp--current-time): Ditch overriding
precedence of the `erc--ts' property in `:around' method because the
variable `erc-stamp--current-time' fills that role well enough.
(erc-stamp--current-datestamp-left): Remove unused variable.
(erc-stamp--insert-date-stamp-as-phony-message): Assume
`erc-timestamp-last-inserted-left' has already been assigned the
updated rendered stamp for the current time.
(erc-stamp--lr-date-on-pre-modify): Use the variable
`erc-stamp--current-time' instead of the `erc-ts' property to convey
an overriding time value for `erc-add-timestamp'.  Set
`erc-timestamp-last-inserted-left' instead of fiddling with another
temporary variable to hack around these ill-fitting interfaces.  Use
day-aligned time value for the `erc-ts' property assigned to date
stamps.
(erc-stamp--date-mode): New internal minor mode.
(erc-insert-timestamp-left-and-right): Defer to `erc-stamp--date-mode'
for setting up date-stamp specific hooks.
(erc-stamp--time-as-day): New function to "round" a date stamp to
start of local day.
(erc-stamp--setup): Defer to `erc-stamp--date-mode' for date-stamp
specific teardown.  (Bug#60936)
* test/lisp/erc/erc-fill-tests.el
(erc-fill-tests--current-time-value): Change default value to nil.
(erc-stamp--current-time): New method for test cases.
(erc-fill-tests--insert-privmsg): Use realistic value for `unparsed'
slot.
(erc-fill-tests--wrap-populate): Bind
`erc-fill-tests--current-time-value' to 0.  Don't mock the function
`erc-stamp--current-time' because doing so inhibits normal polymorphic
dispatch, which test cases rely on for delivering correct timestamp
values in varied contexts.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
lisp/erc/erc-stamp.el
test/lisp/erc/erc-fill-tests.el
test/lisp/erc/resources/fill/snapshots/merge-01-start.eld
test/lisp/erc/resources/fill/snapshots/merge-02-right.eld
test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld