Function: erc-button--phantom-users-mode

erc-button--phantom-users-mode is a byte-compiled function defined in erc-button.el.gz.

Signature

(erc-button--phantom-users-mode &optional ARG)

Documentation

Minor mode to recognize unknown speakers.

Expect to be used by module setup code for creating placeholder users on the fly during history playback. Treat an unknown
"PRIVMSG" speaker, like "<bob>", as if they previously
appeared in a prior "353" message and are thus a known member of the channel. However, don't bother creating an actual erc-channel-user object because their status prefix is unknown. Instead, just spoof an erc-server-user and stash it during
"PRIVMSG" handling via erc--cmem-from-nick-function and
retrieve it during buttonizing via erc-button--fallback-cmem-function.

This is a minor mode. If called interactively, toggle the Erc-Button--Phantom-Users 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-button--phantom-users-mode(var)/erc-button--phantom-users-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-button.el.gz
(define-minor-mode erc-button--phantom-users-mode
  "Minor mode to recognize unknown speakers.
Expect to be used by module setup code for creating placeholder
users on the fly during history playback.  Treat an unknown
\"PRIVMSG\" speaker, like \"<bob>\", as if they previously
appeared in a prior \"353\" message and are thus a known member
of the channel.  However, don't bother creating an actual
`erc-channel-user' object because their status prefix is unknown.
Instead, just spoof an `erc-server-user' and stash it during
\"PRIVMSG\" handling via `erc--cmem-from-nick-function' and
retrieve it during buttonizing via
`erc-button--fallback-cmem-function'."
  :interactive nil
  (if erc-button--phantom-users-mode
      (progn
        (add-function :after-until (local 'erc--cmem-from-nick-function)
                      #'erc-button--add-phantom-speaker '((depth . 30)))
        (add-function :after-until (local 'erc-button--fallback-cmem-function)
                      #'erc-button--get-phantom-cmem '((depth . 50)))
        (setq erc-button--phantom-cmems (make-hash-table :test #'equal)))
    (remove-function (local 'erc--cmem-from-nick-function)
                     #'erc-button--add-phantom-speaker)
    (remove-function (local 'erc-button--fallback-cmem-function)
                     #'erc-button--get-phantom-cmem)
    (kill-local-variable 'erc-button--phantom-cmems)))