Function: erc-stamp--manage-local-options-state
erc-stamp--manage-local-options-state is a byte-compiled function
defined in erc-stamp.el.gz.
Signature
(erc-stamp--manage-local-options-state)
Documentation
Perform local setup and teardown for stamp-owned options.
For erc-timestamp-intangible, toggle cursor-intangible-mode(var)/cursor-intangible-mode(fun).
For erc-echo-timestamps, integrate with cursor-sensor-mode(var)/cursor-sensor-mode(fun).
For `erc-hide-timestamps, modify buffer-invisibility-spec.
Aliases
erc-munge-invisibility-spec (obsolete since 30.1)
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-stamp.el.gz
(defun erc-stamp--manage-local-options-state ()
"Perform local setup and teardown for `stamp'-owned options.
For `erc-timestamp-intangible', toggle `cursor-intangible-mode'.
For `erc-echo-timestamps', integrate with `cursor-sensor-mode'.
For `erc-hide-timestamps, modify `buffer-invisibility-spec'."
(if erc-timestamp-intangible
(cursor-intangible-mode +1) ; idempotent
(when (bound-and-true-p cursor-intangible-mode)
(cursor-intangible-mode -1)))
(if erc-echo-timestamps
(progn
(unless erc-stamp--permanent-cursor-sensor-functions
(dolist (hook '(erc-insert-post-hook erc-send-post-hook))
(add-hook hook #'erc-stamp--add-csf-on-post-modify nil t))
(setq erc-stamp--csf-props-updated-p
(alist-get 'erc-stamp--csf-props-updated-p
(or erc--server-reconnecting erc--target-priors)))
(unless erc-stamp--csf-props-updated-p
(setq erc-stamp--csf-props-updated-p t)
;; Spoof `erc--ts' as being non-nil.
(let ((erc--msg-props (map-into '((erc--ts . t)) 'hash-table)))
(with-silent-modifications
(erc--traverse-inserted
(point-min) erc-insert-marker
#'erc-stamp--add-csf-on-post-modify)))))
(cursor-sensor-mode +1) ; idempotent
(when (>= emacs-major-version 29)
(add-function :before-until (local 'clear-message-function)
#'erc-stamp--on-clear-message)))
(dolist (hook '(erc-insert-post-hook erc-send-post-hook))
(remove-hook hook #'erc-stamp--add-csf-on-post-modify t))
(kill-local-variable 'erc-stamp--csf-props-updated-p)
(when (bound-and-true-p cursor-sensor-mode)
(cursor-sensor-mode -1))
(remove-function (local 'clear-message-function)
#'erc-stamp--on-clear-message))
(if erc-hide-timestamps
(add-to-invisibility-spec 'timestamp)
(remove-from-invisibility-spec 'timestamp)))