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.

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."
  (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))
         (msg-face (if privp 'erc-direct-msg-face 'erc-default-face)))
    ;; 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-property (length mark-s) (+ (length mark-s) (length nick))
                           'font-lock-face nick-face str)
    (erc-put-text-property (+ (length mark-s) (length nick)) (length str)
                           'font-lock-face msg-face str)
    str))