]> git.eshelyaron.com Git - emacs.git/commit
Add erc--spkr text property to chat messages
authorF. Jason Park <jp@neverwas.me>
Tue, 5 Dec 2023 06:13:02 +0000 (22:13 -0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 21 Dec 2023 20:53:54 +0000 (21:53 +0100)
commit19782fdbc8ee05e2bc83cb2722a33227f7d7499b
treece9da4f7a79fb3684953a5ede54d2ae862165b23
parent2bca77754905192da89b13f2c941faa9d1c86b29
Add erc--spkr text property to chat messages

* etc/ERC-NEWS: Mention combined face ordering for "/me" messages.
* lisp/erc/erc-backend.el (erc-server-PRIVMSG): Bind
`erc--msg-prop-overrides' for the extent of this function's execution,
which means a large amount of code will see this variable as being
non-nil.  However, no calls to `erc-display-message' or
`erc-display-msg' should occur other than the one handling the final
insertion.  Code needing to influence the current message's "msg
props" can push new pairs onto this value, which will override any
existing collisions.
* lisp/erc/erc-fill.el (erc-fill): Switch to `erc--spkr' as sentinel
property.
(erc-fill--wrap-continued-message-p): Look for `erc--spkr' property
instead of `erc-speaker'.
* lisp/erc/erc.el (erc--msg-props): Mention `erc--spkr' in doc.
(erc--send-action-perform-ctcp): Add `erc--spkr' property.  Fix bug in
which `erc-my-nick-face' appeared below `erc-input-face' in the
speaker portion.
(erc--ensure-spkr-prop): New helper function to propagate speaker
metadata.
(erc--ranked-properties): Add `erc--spkr', `erc--ctcp', and
`erc--ephemeral'.
(erc-display-message): Use default hash table size when initializing.
Remove unnecessary assignment of `msg' to `erc--msg' for PRIVMSG and
NOTICE commands.  Bind `string' below `erc--msg-props' so that
implementers of the function form of the `erc-format-message'
templating interface can read and write the current context's "msg
props".
(erc--own-property-names): Add all `erc--msg-props' props by
subsumation.
(erc--get-speaker-bounds): Use `erc--spkr' instead of `erc--msg' as a
sentinel to detect a chat message guaranteed to have an `erc--speaker'
text-property interval.
(erc-format-privmessage, erc-format-my-nick, erc-ctcp-query-ACTION):
Add `erc--spkr' to `erc--msg-prop-overrides' when available.
* test/lisp/erc/erc-fill-tests.el: (erc-fill-tests--insert-privmsg):
Bind `erc--msg-prop-overrides'.
(erc-fill-tests--compare): Require environment variable value to match
current test name exactly when saving snapshots.  Add `erc--msg-props'
individually to white list.
* test/lisp/erc/erc-tests.el (erc--order-text-properties-from-hash):
Include `erc--spkr'.  (Bug#60936)  (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.

(cherry picked from commit 236a416be76cbb0b79ad46c06652f6cbf8788fcb)
17 files changed:
etc/ERC-NEWS
lisp/erc/erc-backend.el
lisp/erc/erc-fill.el
lisp/erc/erc.el
test/lisp/erc/erc-fill-tests.el
test/lisp/erc/erc-tests.el
test/lisp/erc/resources/fill/snapshots/merge-01-start.eld
test/lisp/erc/resources/fill/snapshots/merge-02-right.eld
test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld
test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld
test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld
test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld
test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld
test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld
test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld
test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld
test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld