Function: erc-format-privmessage
erc-format-privmessage is a byte-compiled function defined in
erc.el.gz.
Signature
(erc-format-privmessage NICK MSG PRIVP MSGP)
Documentation
Format a PRIVMSG in an insertable fashion.
Note that as of version 5.6, the default client no longer calls this
function. It instead defers to the format-spec-based message-catalog
system to handle all message formatting. Anyone needing to influence
such formatting should describe their use case via M-x erc-bug (erc-bug) or
similar. Please do this instead of resorting to things like modifying
formatting templates to remove speaker brackets (because many modules
rely on their presence, and cleaner ways exist).
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-format-privmessage (nick msg privp msgp)
"Format a PRIVMSG in an insertable fashion.
Note that as of version 5.6, the default client no longer calls this
function. It instead defers to the `format-spec'-based message-catalog
system to handle all message formatting. Anyone needing to influence
such formatting should describe their use case via \\[erc-bug] or
similar. Please do this instead of resorting to things like modifying
formatting templates to remove speaker brackets (because many modules
rely on their presence, and cleaner ways exist)."
(let* ((mark-s (if msgp (if privp "*" "<") "-"))
(mark-e (if msgp (if privp "*" ">") "-"))
(str (format "%s%s%s %s" mark-s nick mark-e msg))
(nick-face (if privp 'erc-nick-msg-face 'erc-nick-default-face))
(nick-prefix-face (get-text-property 0 'font-lock-face nick))
(prefix-len (or (and nick-prefix-face (text-property-not-all
0 (length nick) 'font-lock-face
nick-prefix-face nick))
0))
(msg-face (if privp 'erc-direct-msg-face 'erc-default-face)))
(erc--ensure-spkr-prop nick)
;; add text properties to text before the nick, the nick and after the nick
(erc-put-text-property 0 (length mark-s) 'font-lock-face msg-face str)
(erc-put-text-properties (+ (length mark-s) prefix-len)
(+ (length mark-s) (length nick))
'(font-lock-face erc--speaker) str
(list nick-face
(substring-no-properties nick prefix-len)))
(erc-put-text-property (+ (length mark-s) (length nick)) (length str)
'font-lock-face msg-face str)
str))