"J.P." writes: >>From ef4974d8e232b0d5e5df31a30f2fd904f970c60f Mon Sep 17 00:00:00 2001 > From: "F. Jason Park" > Date: Thu, 21 Sep 2023 23:54:31 -0700 > Subject: [PATCH 6/7] [5.6] Manage meta-data text props for ERC hook members > > * etc/ERC-NEWS: Mention that `cursor-sensor-functions' is only added > when `erc-echo-timestamps' is enabled, and mention that date stamps > are now inserted as separate messages. > [...] > > (erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp): > New function and auxiliary variable to apply date stamp properties at > the post-modify stage. Add text property `erc-stamp-type' to inserted > date stamps to help folks distinguish between them and other > left-sided stamps. > (erc-stamp-date-left-p): New public function for third-party code to > detect whether a message is a date stamp. > (erc-stamp--current-datestamp-left, > erc-stamp--insert-date-stamp-as-phony-message, > erc-stamp--lr-date-on-pre-modify): New functions and state variable to > help ERC treat date stamps as separate messages while working within > the established mechanism for processing inserted messages. Shadow > `erc-stamp--invisible-property' when calling `erc-format-timestamp' in > order to prevent date stamps from inheriting other `invisible' props. > These date stamps are special in that they have no business being > hidden along with the current message. > (erc-insert-timestamp-left-and-right): On initial run in any buffer, > record whether date stamp needs massaging on insertion. Move all > business for inserting date stamps to post-modify hooks, but run them > forcibly if this is the very first date stamp in the current buffer. The above patch, which was installed as commit c68dc7786fc808b1ff7deb32d9964ae860e26f1e Manage some text props for ERC insertion-hook members (along with various fixups that followed) were meant to outfit date stamps with foundational elements supporting what's sometimes referred to as "buffer mutability" by IRC people. What they're referring to are support mechanisms (like message traversal, deletion, insertion, hiding, etc.) that enable rich and dynamic next-generation features rather than a simplistic, append-only display log. The changes referenced above tackled this by moving date stamps to separate messages, which was seen as superior to other ideas, like intervening overlays between messages, because it allowed existing formatting-related code to detect and affect date stamps with minimal added fuss. However, the chosen implementation was imperfect and arguably nullified those advantages by effectively "nesting" calls to display hooks, which some third-party hook members may not find agreeable. The justification for this was "a lesser of two evils" hand wave aimed at avoiding the alternative, which was more maintenance intensive on account of various concurrency and data-coordination complications. Despite this, the benefit of hindsight has changed my view on the matter, and I'm now of the opinion the additional maintenance pains are worth enduring if the associated gains come with less risk of third-party breakage, even if no one has yet complained. The attached patch attempts to switch tacks to this more complicated but less risky approach by deferring date insertions to ephemeral, single-shot `erc-timer-hook' and `erc-send-completed-hook' members. Comments welcome.