[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8513ecc8a38 2/7: Restore predicate for detecting date stamps in E
From: |
F. Jason Park |
Subject: |
master 8513ecc8a38 2/7: Restore predicate for detecting date stamps in ERC |
Date: |
Sun, 31 Dec 2023 10:07:49 -0500 (EST) |
branch: master
commit 8513ecc8a38f76b497348bbae61ae4c5ac5a9995
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
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.
---
etc/ERC-NEWS | 4 +++-
lisp/erc/erc-stamp.el | 7 +++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index 6dc8af3c514..f19255f8d75 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -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
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index a65b564ba6c..cfd756ce625 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -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
- master updated (91f316d2931 -> 4939f413939), F. Jason Park, 2023/12/31
- master 2560d81351c 4/7: Don't discard trimmed args in erc-cmd-MODE, F. Jason Park, 2023/12/31
- master 6c899525571 5/7: Make erc-update-channel-current-member stricter, F. Jason Park, 2023/12/31
- master 8513ecc8a38 2/7: Restore predicate for detecting date stamps in ERC,
F. Jason Park <=
- master 4eda77ed335 1/7: Fix regression in erc-keep-place-indicator-mode, F. Jason Park, 2023/12/31
- master d5f6e911a99 3/7: Use format-prompt in erc-select-read-args, F. Jason Park, 2023/12/31
- master 2534a4737f7 6/7: Fix regression in erc-button-add-button, F. Jason Park, 2023/12/31
- master 4939f413939 7/7: Use advertised PREFIX when formatting nicks in ERC, F. Jason Park, 2023/12/31