Variable: erc-stamp--date-mode-hook

erc-stamp--date-mode-hook is a customizable variable defined in erc-stamp.el.gz.

Value

nil

Documentation

Hook run after entering or leaving erc-stamp--date-mode(var)/erc-stamp--date-mode(fun).

No problems result if this variable is not bound. add-hook automatically binds it. (This is true for all hook variables.)

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)))