Function: erc-stamp--date-mode
erc-stamp--date-mode is a byte-compiled function defined in
erc-stamp.el.gz.
Signature
(erc-stamp--date-mode &optional ARG)
Documentation
When enabled, insert date stamps as standalone messages.
Only do so when erc-insert-timestamp-function is set to
erc-insert-timestamp-left-and-right. On erc-insert-modify-hook,
hold off on inserting a date stamp immediately because that would force
other members of the hook to rely on heuristics and implementation
details to detect a prepended stamp's presence, not to mention
compromise the integrity of the erc-parsed text property. Instead,
tell erc-insert-post-hook, via erc-stamp--deferred-date-stamp, to
schedule a date stamp for insertion on the next go around of
erc-timer-hook, which only runs on server-sent messages. Expect users
to know that non-server-sent messages, such as local informational
messages, won't induce a date stamp's insertion but will instead defer
it until the next arrival, which can include "PING"s or messages that
otherwise don't insert anything, such as those skipped on account of
erc-ignore.
This is a minor mode. If called interactively, toggle the
Erc-Stamp--Date mode mode. If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate the variable erc-stamp--date-mode(var)/erc-stamp--date-mode(fun).
The mode's hook is called both when the mode is enabled and when it is disabled.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-stamp.el.gz
;; This minor mode is hopefully just a placeholder because it's quite
;; unhelpful for managing complexity. A useful version would exist as
;; a standalone module to allow completely decoupling from and
;; possibly deprecating `erc-insert-timestamp-left-and-right'.
(define-minor-mode erc-stamp--date-mode
"When enabled, insert date stamps as standalone messages.
Only do so when `erc-insert-timestamp-function' is set to
`erc-insert-timestamp-left-and-right'. On `erc-insert-modify-hook',
hold off on inserting a date stamp immediately because that would force
other members of the hook to rely on heuristics and implementation
details to detect a prepended stamp's presence, not to mention
compromise the integrity of the `erc-parsed' text property. Instead,
tell `erc-insert-post-hook', via `erc-stamp--deferred-date-stamp', to
schedule a date stamp for insertion on the next go around of
`erc-timer-hook', which only runs on server-sent messages. Expect users
to know that non-server-sent messages, such as local informational
messages, won't induce a date stamp's insertion but will instead defer
it until the next arrival, which can include \"PING\"s or messages that
otherwise don't insert anything, such as those skipped on account of
`erc-ignore'."
:interactive nil
(if erc-stamp--date-mode
(progn
(add-function :around
(local 'erc-networks--transplant-target-buffer-function)
#'erc-stamp--dedupe-date-stamps-from-target-buffer)
(add-hook 'erc-networks--copy-server-buffer-functions
#'erc-stamp--dedupe-date-stamps-from-buffer 0 t)
(add-hook 'erc-insert-post-hook
#'erc-stamp--defer-date-insertion-on-post-insert 0 t)
(add-hook 'erc-send-post-hook
#'erc-stamp--defer-date-insertion-on-post-send 0 t))
(kill-local-variable 'erc-timestamp-last-inserted-left)
(remove-function (local 'erc-networks--transplant-target-buffer-function)
#'erc-stamp--dedupe-date-stamps-from-target-buffer)
(remove-hook 'erc-networks--copy-server-buffer-functions
#'erc-stamp--dedupe-date-stamps-from-buffer t)
(remove-hook 'erc-insert-post-hook
#'erc-stamp--defer-date-insertion-on-post-insert t)
(remove-hook 'erc-send-post-hook
#'erc-stamp--defer-date-insertion-on-post-send t)))