mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Store one string per user in erc--spkr msg prop
* lisp/erc/erc.el (erc--msg-props): Mention that the `erc--spkr' msg-prop value is taken from the `nickname' slot of the user's `erc-server-users' entry. (erc--speakerize-nick): Avoid using the provided NICK parameter for the `erc--spkr' property. Instead, use the version from the `nickname' slot of its `erc-server-users' item, which is itself an `erc-server-user' object. These text props were originally introduced in ERC 5.6 as part of bug#67677. * test/lisp/erc/erc-tests.el (erc--refresh-prompt) (erc--check-prompt-input-functions, erc-send-current-line) (erc--check-prompt-input-for-multiline-blanks) (erc-send-whitespace-lines): Use more convenient helper utility to create fake server buffer where possible. (erc--speakerize-nick): New test. * test/lisp/erc/resources/erc-tests-common.el (erc-tests-common-make-server-buf): Don't use ERT temp buffer's name for dialed server, etc., because it contains unwanted chars. (erc-tests-common-with-process-input-spy): Defer to each test to set up its own prompt, etc. (Bug#72736)
This commit is contained in:
parent
8f326e0ba2
commit
b0ebb82076
3 changed files with 81 additions and 28 deletions
|
|
@ -173,7 +173,8 @@ as of ERC 5.6:
|
|||
and help text, and on outgoing messages unless echoed back by
|
||||
the server (assuming future support)
|
||||
|
||||
- `erc--spkr': a string, the nick of the person speaking
|
||||
- `erc--spkr': a string, the non-case-mapped nick of the speaker as
|
||||
stored in the `nickname' slot of its `erc-server-users' item
|
||||
|
||||
- `erc--ctcp': a CTCP command, like `ACTION'
|
||||
|
||||
|
|
@ -6339,20 +6340,18 @@ rely on their presence, and cleaner ways exist)."
|
|||
"Template for a CTCP ACTION status message from current client.")
|
||||
|
||||
(defun erc--speakerize-nick (nick &optional disp)
|
||||
"Propertize NICK with `erc--speaker' if not already present.
|
||||
Do so to DISP instead if it's non-nil. In either case, assign
|
||||
NICK, sans properties, as the `erc--speaker' value. As a side
|
||||
effect, pair the latter string (the same `eq'-able object) with
|
||||
the symbol `erc--spkr' in the \"msg prop\" environment for any
|
||||
imminent `erc-display-message' invocations. While doing so,
|
||||
include any overrides defined in `erc--message-speaker-catalog'."
|
||||
(let ((plain-nick (substring-no-properties nick)))
|
||||
(erc--ensure-spkr-prop plain-nick (get erc--message-speaker-catalog
|
||||
'erc--msg-prop-overrides))
|
||||
(if (text-property-not-all 0 (length (or disp nick))
|
||||
'erc--speaker nil (or disp nick))
|
||||
(or disp nick)
|
||||
(propertize (or disp nick) 'erc--speaker plain-nick))))
|
||||
"Return propertized NICK with canonical NICK in `erc--speaker'.
|
||||
Return propertized DISP instead if given. As a side effect, pair NICK
|
||||
with `erc--spkr' in the \"msg prop\" environment for any imminent
|
||||
`erc-display-message' invocations, and include any overrides defined in
|
||||
`erc--message-speaker-catalog'. Expect NICK (but not necessarily DISP)
|
||||
to be absent of any existing text properties."
|
||||
(when-let ((erc-server-process)
|
||||
(cusr (erc-get-server-user nick)))
|
||||
(setq nick (erc-server-user-nickname cusr)))
|
||||
(erc--ensure-spkr-prop nick (get erc--message-speaker-catalog
|
||||
'erc--msg-prop-overrides))
|
||||
(propertize (or disp nick) 'erc--speaker nick))
|
||||
|
||||
(defun erc--determine-speaker-message-format-args
|
||||
(nick message queryp privmsgp inputp &optional statusmsg prefix disp-nick)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue