1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Add replacement-text field to erc-input struct

* etc/ERC-NEWS: Promote `refoldp' slot from simulated to real.
Mention new `substxt' slot of `erc-input' struct.
* lisp/erc/erc-common.el (erc-input): Add `substxt' and `refoldp'
slots.
(erc--input-split): Move `refoldp' to "superclass".
* lisp/erc/erc-goodies.el (erc--command-indicator-permit-insertion):
Use `substxt' field instead of overloading `insertp'.
(erc--command-indicator-display): Accept extra lines for
compatibility.
* lisp/erc/erc.el (erc-pre-send-functions): Revise doc.
(erc--input-ensure-hook-context, erc-input-refoldp): Remove unused
functions, originally meant to be new in ERC 5.6.
(erc--run-send-hooks): Copy data from additional fields of `erc-input'
object to `erc--input-split' workspace object.
(erc--send-input-lines): Handle `substxt' field of `erc-input' object
when it's non-nil.  (Bug#68265)
This commit is contained in:
F. Jason Park 2024-01-01 06:37:25 -08:00
parent aae131b8dd
commit d6be068ffe
4 changed files with 74 additions and 55 deletions

View file

@ -50,7 +50,23 @@
(declare-function widget-type "wid-edit" (widget))
(cl-defstruct erc-input
string insertp sendp)
"Object shared among members of `erc-pre-send-functions'.
Any use outside of the hook is not supported."
( string "" :type string
:documentation "String to send and, without `substxt', insert.
ERC treats separate lines as separate messages.")
( insertp nil :type boolean
:documentation "Whether to insert outgoing message.
When nil, ERC still sends `string'.")
( sendp nil :type boolean
:documentation "Whether to send and (for compat reasons) insert.
To insert without sending, define a (slash) command.")
( substxt nil :type (or function string null)
:documentation "Alternate string to insert without splitting.
The function form is for internal use.")
( refoldp nil :type boolean
:documentation "Whether to resplit a possibly overlong `string'.
ERC only refolds `string', never `substxt'."))
(cl-defstruct (erc--input-split (:include erc-input
(string "" :read-only t)
@ -58,7 +74,6 @@
(sendp (with-suppressed-warnings
((obsolete erc-send-this))
erc-send-this))))
(refoldp nil :type boolean)
(lines nil :type (list-of string))
(abortp nil :type (list-of symbol))
(cmdp nil :type boolean))