From: "J.P." <jp@neverwas.me>
To: 50008@debbugs.gnu.org
Subject: bug#50008: [J.P.] Re: bug#50008: 28.0.50; ERC sends empty lines with user input
Date: Tue, 22 Mar 2022 01:50:41 -0700 [thread overview]
Message-ID: <87lex2l6am.fsf@neverwas.me> (raw)
In-Reply-To: <877dgsjcez.fsf@neverwas.me>
[-- Attachment #1: Type: text/plain, Size: 350 bytes --]
Prior attempt was blocked (archived).
-------------------- Start of forwarded message --------------------
From: "J.P." <jp@neverwas.me>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 50008@debbugs.gnu.org, bandali@gnu.org, emacs-erc@gnu.org
Subject: Re: bug#50008: 28.0.50; ERC sends empty lines with user input
Date: Tue, 22 Mar 2022 01:37:20 -0700
[-- Attachment #2.1: Type: text/plain, Size: 690 bytes --]
Lars Ingebrigtsen <larsi@gnus.org> writes:
> "J.P." <jp@neverwas.me> writes:
>
>> Subject: [PATCH] Don't send empty lines for implicit targets in ERC
>
> Makes sense to me, and testing it a bit doesn't seem to show any
> regressions, so I've now pushed this to Emacs 29.
I just noticed a regression that remained hidden all this while
because I failed to call the function realistically in its unit test.
Luckily, this only affects master.
I've attached a fix here just to have something for the record. But I
figure there's little harm in deferring and tossing it in with some
other stuff I'm preparing (in a new bug report) to try and simplify the
input processing situation. Thanks.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.2: 0001-Fix-regression-in-erc-send-input-line.patch --]
[-- Type: text/x-patch, Size: 2446 bytes --]
> From dc7005fe509f573e86aef0a87ec8b650a1aacec4 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Mon, 21 Mar 2022 19:21:57 -0700
Subject: [PATCH] Fix regression in erc-send-input-line
* lisp/erc/erc.el (erc-send-input-line): Restore remedial single-space
padding to ensure empty messages typed at the prompt without an
explicit /msg aren't rejected by the server. This behavior is only
noticeable when `erc-send-whitespace-lines' is active.
* test/lisp/erc/erc-tests.el (erc-process-input-line): Add trailing
newline to more correctly simulate how it's actually called by
`erc-send-input'. (Bug#50008)
---
lisp/erc/erc.el | 2 ++
test/lisp/erc/erc-tests.el | 10 +++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 52fe106f2d..d8ef62cf93 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2817,6 +2817,8 @@ erc-send-input-line-function
(defun erc-send-input-line (target line &optional force)
"Send LINE to TARGET."
+ (when (string= line "\n")
+ (setq line " \n"))
(erc-message "PRIVMSG" (concat target " " line) force))
(defun erc-get-arglist (fun)
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 520f10dd4e..10e3c16dfc 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -340,19 +340,19 @@ erc-process-input-line
(ert-info ("Implicit cmd via `erc-send-input-line-function'")
(ert-info ("Baseline")
- (erc-process-input-line "hi")
+ (erc-process-input-line "hi\n")
(should (equal (pop erc-server-flood-queue)
'("PRIVMSG #chan :hi\r\n" . utf-8))))
(ert-info ("Spaces preserved")
- (erc-process-input-line "hi you")
+ (erc-process-input-line "hi you\n")
(should (equal (pop erc-server-flood-queue)
'("PRIVMSG #chan :hi you\r\n" . utf-8))))
- (ert-info ("Empty line transmitted without injected-space kludge")
- (erc-process-input-line "")
+ (ert-info ("Empty line transmitted with injected-space kludge")
+ (erc-process-input-line "\n")
(should (equal (pop erc-server-flood-queue)
- '("PRIVMSG #chan :\r\n" . utf-8))))
+ '("PRIVMSG #chan : \r\n" . utf-8))))
(should-not calls))))))
--
2.35.1
[-- Attachment #3: Type: text/plain, Size: 67 bytes --]
-------------------- End of forwarded message --------------------
prev parent reply other threads:[~2022-03-22 8:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 14:15 bug#50008: 28.0.50; ERC sends empty lines with user input J.P.
2021-09-19 16:36 ` Stefan Kangas
2021-11-06 2:10 ` Lars Ingebrigtsen
2022-03-22 8:50 ` J.P. [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lex2l6am.fsf@neverwas.me \
--to=jp@neverwas.me \
--cc=50008@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).