[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 4ed6ba90e7c 6/9: Allow opting out of empty message padding in ERC
From: |
F. Jason Park |
Subject: |
master 4ed6ba90e7c 6/9: Allow opting out of empty message padding in ERC |
Date: |
Sun, 12 Nov 2023 23:56:29 -0500 (EST) |
branch: master
commit 4ed6ba90e7c4d2148a7bb1d2ff1027ebc765f606
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
Allow opting out of empty message padding in ERC
* lisp/erc/erc.el (erc--allow-empty-outgoing-lines-p): New internal
variable.
(erc-send-input-line, erc--run-send-hooks): Don't pad output when
`erc--allow-empty-outgoing-lines-p' is non-nil. (Bug#67031)
---
lisp/erc/erc.el | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index c9c24f2642f..6d7251f0677 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -3684,6 +3684,11 @@ This is for special cases in which a \"slash\" command
needs
details about the input it's handling or needs to detect whether
it's been dispatched by `erc-send-current-line'.")
+(defvar erc--allow-empty-outgoing-lines-p nil
+ "Flag to opt out of last-minute padding of empty lines.
+Useful to extensions, like `multiline', and for interop with
+IRC-adjacent protocols.")
+
(defvar-local erc-send-input-line-function #'erc-send-input-line
"Function for sending lines lacking a leading \"slash\" command.
When prompt input starts with a \"slash\" command, like \"/MSG\",
@@ -3697,7 +3702,7 @@ for other purposes.")
(defun erc-send-input-line (target line &optional force)
"Send LINE to TARGET."
- (when (string= line "\n")
+ (when (and (not erc--allow-empty-outgoing-lines-p) (string= line "\n"))
(setq line " \n"))
(erc-message "PRIVMSG" (concat target " " line) force))
@@ -7033,9 +7038,11 @@ queue. Expect LINES-OBJ to be an `erc--input-split'
object."
(erc--input-split-insertp lines-obj) (erc-input-insertp state)
;; See note in test of same name re trailing newlines.
(erc--input-split-lines lines-obj)
- (cl-nsubst " " "" (split-string (erc-input-string state)
- erc--input-line-delim-regexp)
- :test #'equal))
+ (let ((lines (split-string (erc-input-string state)
+ erc--input-line-delim-regexp)))
+ (if erc--allow-empty-outgoing-lines-p
+ lines
+ (cl-nsubst " " "" lines :test #'equal))))
(when (erc-input-refoldp state)
(erc--split-lines lines-obj)))))
(when (and (erc--input-split-cmdp lines-obj)
- master updated (52afc64bad7 -> ece62f5c1c3), F. Jason Park, 2023/11/12
- master 29029529cb2 1/9: Don't use func-arity to trigger API warning in url-irc, F. Jason Park, 2023/11/12
- master ece62f5c1c3 9/9: ; Prepare for ERC 5.6 release, F. Jason Park, 2023/11/12
- master beb60a9027c 3/9: Make ERC's error-notice formatting more consistent, F. Jason Park, 2023/11/12
- master e2130fe9272 4/9: Always run erc-server-send-queue via timer, F. Jason Park, 2023/11/12
- master 174b3dd9bd7 5/9: Make nested input handling more robust in ERC, F. Jason Park, 2023/11/12
- master 5baa0f61f8d 2/9: Offer alternate pool-creation strategies in erc-nicks, F. Jason Park, 2023/11/12
- master 4ed6ba90e7c 6/9: Allow opting out of empty message padding in ERC,
F. Jason Park <=
- master 583d73e9a0e 7/9: Simplify default text props for ERC input, F. Jason Park, 2023/11/12
- master 1d2aa130cae 8/9: Revive erc-command-indicator as new module, F. Jason Park, 2023/11/12