]> git.eshelyaron.com Git - emacs.git/commit
Consolidate status-prefix slots of erc-channel-user
authorF. Jason Park <jp@neverwas.me>
Sun, 30 Apr 2023 14:45:01 +0000 (07:45 -0700)
committerEshel Yaron <me@eshelyaron.com>
Thu, 21 Dec 2023 20:53:55 +0000 (21:53 +0100)
commit8c4461cb98d63b2d47d7bb84d91bda84f006cec5
treef57d4532f6ec1e7ae3d6c02c35903cb154de7b23
parent54264d8a94903647377baf49cc952ca363f6b49c
Consolidate status-prefix slots of erc-channel-user

* etc/ERC-NEWS: Mention change even though the API remains
undisturbed.
* lisp/erc/erc-common.el (erc-channel-user): "Encode" status prefix
slots `voice', `halfop', `op', `admin', and `owner' as single `status'
slot.  Add backward-compatible constructor.  Although the old layout
was overly sparse, since the vast majority of users have no membership
status at all, the point here is not to trade time for space but
rather to improve human readability of ERC buffer substrings
containing text props that reference `erc-channel-user' objects.
* lisp/erc/erc.el (erc--define-channel-user-status-compat-getter):
Helper macro for declaring compat-oriented "getters" for status-prefix
slots of `erc-channel-user'.
(erc-channel-user-voice, erc-channel-user-halfop, erc-channel-user-op,
erc-channel-user-admin, erc-channel-user-owner): Add compat getters.
These are not new functions.  They were previously defined by the
`erc-channel-user' `cl-defstruct' in erc-common.el.
(erc--update-cusr-status-if-changed): New helper macro to make
`erc-update-current-channel-member' more readable.
(erc-update-current-channel-member): Collapse some overly verbose
"unrolled" forms using helper macro and more compact expressions.
* test/lisp/erc/erc-tests.el (erc-channel-user): New test.

(cherry picked from commit 6e4417eaa7e8554ce54960180e938e3f5ac560dc)
etc/ERC-NEWS
lisp/erc/erc-common.el
lisp/erc/erc.el
test/lisp/erc/erc-tests.el