1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

Restore predicate for detecting date stamps in ERC

* etc/ERC-NEWS: Mention function `erc-stamp-inserting-date-stamp-p'.
* lisp/erc/erc-stamp.el (erc-stamp-inserting-date-stamp-p): New
function for third parties to detect whether the message being
inserted is a date stamp.  Date stamps as independent messages were
originally introduced as part of bug#60936.
This commit is contained in:
F. Jason Park 2023-12-30 16:39:18 -08:00
parent 4eda77ed33
commit 8513ecc8a3
2 changed files with 10 additions and 1 deletions

View File

@ -474,7 +474,9 @@ also not appreciate that 'erc-timestamp-last-inserted-left' no longer
records the final trailing newline in 'erc-timestamp-format-left'. If
these inconveniences prove too encumbering to deal with right away,
see the escape hatch 'erc-stamp-prepend-date-stamps-p', which should
help ease the transition.
help ease the transition. As for detecting these new stamp-only
messages from members of 'erc-insert-modify-hook' and friends, see the
function 'erc-stamp-inserting-date-stamp-p'.
*** The role of a module's Custom group is now more clearly defined.
Associating built-in modules with Custom groups and "provided" library

View File

@ -678,6 +678,13 @@ value of t means the option's value doesn't require trimming.")
0 erc-stamp--date-format-end)
erc-timestamp-format-left))))
(defun erc-stamp-inserting-date-stamp-p ()
"Return non-nil if the narrowed buffer contains a date stamp.
Expect to be called by members of `erc-insert-modify-hook' and
`erc-insert-post-hook' to detect whether the message being
inserted is a date stamp."
(erc--check-msg-prop 'erc--msg 'datestamp))
;; Calling `erc-display-message' from within a hook it's currently
;; running is roundabout, but it's a definite means of ensuring hooks
;; can act on the date stamp as a standalone message to do things like