GNU bug report logs - #50005
28.0.50; silence a couple byte-compiler warnings in ERC

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "J.P." <jp@HIDDEN>; Keywords: patch; Done: Lars Ingebrigtsen <larsi@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 28.1, send any further explanations to 50005 <at> debbugs.gnu.org and "J.P." <jp@HIDDEN> Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 50005 <at> debbugs.gnu.org:


Received: (at 50005) by debbugs.gnu.org; 16 Sep 2021 13:25:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 09:25:53 2021
Received: from localhost ([127.0.0.1]:54132 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQrOj-0008B6-3y
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 09:25:53 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36388)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mQrOg-0008Ao-NE
 for 50005 <at> debbugs.gnu.org; Thu, 16 Sep 2021 09:25:51 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=igs4RKd3qP9I8c2T4Eja5x41XZmE1nlRFkH4ud1oRtI=; b=PPPtKImd92jbaNd1kUAMdnnyA3
 aVECeNG1xSE/VdKw4rlI2FjAK1YDVXPYVDu+FZAiphcDa3+TtThJgngL9+JZuYQh9aOcFCqk15WmV
 bv/Iv94pxuIEUQlblw829hMT6KABOGywYDQilxGsmerKZ2+WiNT5FQShMt9Tp25vKrbo=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mQrOX-0004IF-Po; Thu, 16 Sep 2021 15:25:44 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: "J.P." <jp@HIDDEN>
Subject: Re: bug#50005: 28.0.50; silence a couple byte-compiler warnings in ERC
References: <87v94cjd89.fsf@HIDDEN> <87fsuavw4j.fsf@HIDDEN>
Date: Thu, 16 Sep 2021 15:25:41 +0200
In-Reply-To: <87fsuavw4j.fsf@HIDDEN> (J. P.'s message of "Sun, 12 Sep
 2021 05:03:40 -0700")
Message-ID: <87wnng1wkq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  "J.P." <jp@HIDDEN> writes: > v3. Added a missing test
 dependency. Thanks; applied to Emacs 28. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50005
Cc: 50005 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

"J.P." <jp@HIDDEN> writes:

> v3. Added a missing test dependency.

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50005; Package emacs. Full text available.

Message received at 50005 <at> debbugs.gnu.org:


Received: (at 50005) by debbugs.gnu.org; 12 Sep 2021 12:03:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 12 08:03:55 2021
Received: from localhost ([127.0.0.1]:42188 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mPODD-0004gQ-6l
	for submit <at> debbugs.gnu.org; Sun, 12 Sep 2021 08:03:55 -0400
Received: from mail-108-mta5.mxroute.com ([136.175.108.5]:45035)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jp@HIDDEN>) id 1mPOD8-0004g6-2t
 for 50005 <at> debbugs.gnu.org; Sun, 12 Sep 2021 08:03:53 -0400
Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta5.mxroute.com (ZoneMTA) with ESMTPSA id 17bd9e44cd800074ba.001
 for <50005 <at> debbugs.gnu.org>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Sun, 12 Sep 2021 12:03:42 +0000
X-Zone-Loop: d3504d4ce85054c3399e349449a2875faec86fed9225
X-Originating-IP: [149.28.56.236]
From: "J.P." <jp@HIDDEN>
To: 50005 <at> debbugs.gnu.org
Subject: Re: bug#50005: 28.0.50; silence a couple byte-compiler warnings in ERC
References: <87v94cjd89.fsf@HIDDEN>
Date: Sun, 12 Sep 2021 05:03:40 -0700
In-Reply-To: <87v94cjd89.fsf@HIDDEN> (J. P.'s message of "Wed, 11 Aug
 2021 06:57:26 -0700")
Message-ID: <87fsuavw4j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-AuthUser: masked@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 50005
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

v3. Added a missing test dependency.

(Note: the first attachment just shows the changes from the last set and
is not itself a patch.)


--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment; filename=0000-v2-v3.diff
Content-Transfer-Encoding: quoted-printable

From 1b55dcb828093774ebbb83888901644a8c73a67d Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Sun, 12 Sep 2021 02:41:39 -0700
Subject: [PATCH 0/2] *** SUBJECT HERE ***
MIME-Version: 1.0
Content-Type: text/plain; charset=3DUTF-8
Content-Transfer-Encoding: 8bit

*** BLURB HERE ***

F. Jason Park (2):
  Fix mistake in test for erc-ring-previous-command
  Fix a couple byte-compiler warnings in erc.el

 lisp/erc/erc.el            | 25 ++++-------
 test/lisp/erc/erc-tests.el | 91 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 95 insertions(+), 21 deletions(-)

Range-diff:
-:  ---------- > 1:  d3cbfba5d6 Fix mistake in test for erc-ring-previous-c=
ommand
1:  8a85439cc7 ! 2:  1b55dcb828 Fix a couple byte-compiler warnings in erc.=
el
    @@ Commit message
         Fix a couple byte-compiler warnings in erc.el
=20=20=20=20=20
         * lisp/erc/erc.el (erc-lurker-maybe-trim): Prevent warning from
    -    showing up in third-party code re library not loaded by autoloading
    -    rx.el when needed.  Also make function do what it claims to. It now
    -    only removes trailing chars typically appended automatically for
    -    uniquifying purposes when a desired nick is already taken. Special
    -    thanks to Mattias Engdeg=C3=A5rd for making this more
    -    respectable. Bug#50005.
    +    showing up in third-party code using this function by autoloading
    +    rx.el when needed.  Remove trailing chars appended for uniquifying
    +    purposes when a nick is already taken. Special thanks to Mattias
    +    Engdeg=C3=A5rd for making this more respectable. Bug#50005.
=20=20=20=20=20
         (erc-with-all-buffers-of-server): Mute byte compiler warning saying
    -    return value unused. Leave possible optimizations for some future
    -    person.
    +    return value unused. Leave optimizations for future contributors.
    +
    +    * test/lisp/erc/erc-tests.el: add tests for the above and require
    +    erc-networks.
=20=20=20=20=20
      ## lisp/erc/erc.el ##
     @@ lisp/erc/erc.el: erc-with-all-buffers-of-server
    @@ lisp/erc/erc.el: erc-lurker-maybe-trim
      (defcustom erc-lurker-hide-list nil
=20=20=20=20=20
      ## test/lisp/erc/erc-tests.el ##
    +@@
    + (require 'ert)
    + (require 'erc)
    + (require 'erc-ring)
    ++(require 'erc-networks)
    +=20
    + (ert-deftest erc--read-time-period ()
    +   (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "")))
     @@ test/lisp/erc/erc-tests.el: erc--read-time-period
        (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "1d")))
          (should (equal (erc--read-time-period "foo: ") 86400))))
--=20
2.31.1


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Fix-mistake-in-test-for-erc-ring-previous-command.patch

From d3cbfba5d6efe49aa25f7d7dc550e54a36e0d5a1 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Thu, 13 May 2021 02:27:08 -0700
Subject: [PATCH 1/2] Fix mistake in test for erc-ring-previous-command

* test/lisp/erc/erc-tests.el (erc-ring-previous-command):
The variable erc-send-completed-hook was previously set to nil
permanently, which would affect other tests.
---
 test/lisp/erc/erc-tests.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index d13397274a..9efcf4a703 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -61,13 +61,16 @@ erc-ring-previous-command
   (with-current-buffer (get-buffer-create "*#fake*")
     (erc-mode)
     (insert "\n\n")
-    (setq erc-input-marker (make-marker) ; these are all local
-          erc-insert-marker (make-marker)
-          erc-send-completed-hook nil)
+    (should-not (local-variable-if-set-p 'erc-send-completed-hook))
+    (set (make-local-variable 'erc-send-completed-hook) nil) ; skip t (globals)
+    (setq erc-input-marker (make-marker)
+          erc-insert-marker (make-marker))
     (set-marker erc-insert-marker (point-max))
     (erc-display-prompt)
     (should (= (point) erc-input-marker))
-    (add-hook 'erc-pre-send-functions #'erc-add-to-input-ring nil t)
+    ;; Just in case erc-ring-mode is already on
+    (setq-local erc-pre-send-functions nil)
+    (add-hook 'erc-pre-send-functions #'erc-add-to-input-ring)
     ;;
     (cl-letf (((symbol-function 'erc-process-input-line)
                (lambda (&rest _)
-- 
2.31.1


--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
 filename=0002-Fix-a-couple-byte-compiler-warnings-in-erc.el.patch
Content-Transfer-Encoding: quoted-printable

From 1b55dcb828093774ebbb83888901644a8c73a67d Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Wed, 21 Jul 2021 00:26:38 -0700
Subject: [PATCH 2/2] Fix a couple byte-compiler warnings in erc.el
MIME-Version: 1.0
Content-Type: text/plain; charset=3DUTF-8
Content-Transfer-Encoding: 8bit

* lisp/erc/erc.el (erc-lurker-maybe-trim): Prevent warning from
showing up in third-party code using this function by autoloading
rx.el when needed.  Remove trailing chars appended for uniquifying
purposes when a nick is already taken. Special thanks to Mattias
Engdeg=C3=A5rd for making this more respectable. Bug#50005.

(erc-with-all-buffers-of-server): Mute byte compiler warning saying
return value unused. Leave optimizations for future contributors.

* test/lisp/erc/erc-tests.el: add tests for the above and require
erc-networks.
---
 lisp/erc/erc.el            | 25 ++++--------
 test/lisp/erc/erc-tests.el | 80 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 17 deletions(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index e0fda41f8e..0c1db585b8 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1732,20 +1732,11 @@ erc-with-all-buffers-of-server
 where PRED matches or in all buffers of the server process if PRED is
 nil."
   (declare (indent 1) (debug (form form body)))
-  ;; Make the evaluation have the correct order
-  (let ((pre (make-symbol "pre"))
-        (pro (make-symbol "pro")))
-    `(let* ((,pro ,process)
-            (,pre ,pred)
-            (res (mapcar (lambda (buffer)
-                           (with-current-buffer buffer
-                             ,@forms))
-                         (erc-buffer-list ,pre
-                                          ,pro))))
-       ;; Silence the byte-compiler by binding the result of mapcar to
-       ;; a variable.
-       (ignore res)
-       res)))
+  (macroexp-let2 nil pred pred
+    `(erc-buffer-filter (lambda ()
+                          (when (or (not ,pred) (funcall ,pred))
+                            ,@forms))
+                        ,process)))
=20
 (define-obsolete-function-alias 'erc-iswitchb #'erc-switch-to-buffer "25.1=
")
 (defun erc--switch-to-buffer (&optional arg)
@@ -2583,9 +2574,9 @@ erc-lurker-maybe-trim
 Returns NICK unmodified unless `erc-lurker-trim-nicks' is
 non-nil."
   (if erc-lurker-trim-nicks
-      (replace-regexp-in-string
-       (regexp-opt-charset (string-to-list erc-lurker-ignore-chars))
-       "" nick)
+      (string-trim-right
+       nick (rx-to-string `(+ (in ,@(string-to-list
+                                     erc-lurker-ignore-chars)))))
     nick))
=20
 (defcustom erc-lurker-hide-list nil
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 9efcf4a703..0533d04491 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -24,6 +24,7 @@
 (require 'ert)
 (require 'erc)
 (require 'erc-ring)
+(require 'erc-networks)
=20
 (ert-deftest erc--read-time-period ()
   (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "")))
@@ -47,6 +48,85 @@ erc--read-time-period
   (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "1d")))
     (should (equal (erc--read-time-period "foo: ") 86400))))
=20
+(ert-deftest erc-with-all-buffers-of-server ()
+  (let (proc-exnet
+        proc-onet
+        erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook)
+
+    (with-current-buffer (get-buffer-create "OtherNet")
+      (erc-mode)
+      (setq proc-onet (start-process "sleep" (current-buffer) "sleep" "1")
+            erc-server-process proc-onet
+            erc-network 'OtherNet)
+      (set-process-query-on-exit-flag erc-server-process nil))
+
+    (with-current-buffer (get-buffer-create "ExampleNet")
+      (erc-mode)
+      (setq proc-exnet (start-process "sleep" (current-buffer) "sleep" "1")
+            erc-server-process proc-exnet
+            erc-network 'ExampleNet)
+      (set-process-query-on-exit-flag erc-server-process nil))
+
+    (with-current-buffer (get-buffer-create "#foo")
+      (erc-mode)
+      (setq erc-server-process proc-exnet)
+      (setq erc-default-recipients '("#foo")))
+
+    (with-current-buffer (get-buffer-create "#spam")
+      (erc-mode)
+      (setq erc-server-process proc-onet)
+      (setq erc-default-recipients '("#spam")))
+
+    (with-current-buffer (get-buffer-create "#bar")
+      (erc-mode)
+      (setq erc-server-process proc-onet)
+      (setq erc-default-recipients '("#bar")))
+
+    (with-current-buffer (get-buffer-create "#baz")
+      (erc-mode)
+      (setq erc-server-process proc-exnet)
+      (setq erc-default-recipients '("#baz")))
+
+    (should (eq (get-buffer-process "ExampleNet") proc-exnet))
+    (erc-with-all-buffers-of-server (get-buffer-process "ExampleNet")
+      nil
+      (kill-buffer))
+
+    (should-not (get-buffer "ExampleNet"))
+    (should-not (get-buffer "#foo"))
+    (should-not (get-buffer "#baz"))
+    (should (get-buffer "OtherNet"))
+    (should (get-buffer "#bar"))
+    (should (get-buffer "#spam"))
+
+    (let* ((test (lambda () (not (string=3D (buffer-name) "#spam"))))
+           (calls 0)
+           (get-test (lambda () (cl-incf calls) test)))
+
+      (erc-with-all-buffers-of-server proc-onet
+        (funcall get-test)
+        (kill-buffer))
+
+      (should (=3D calls 1)))
+
+    (should-not (get-buffer "OtherNet"))
+    (should-not (get-buffer "#bar"))
+    (should (get-buffer "#spam"))
+    (kill-buffer "#spam")))
+
+(ert-deftest erc-lurker-maybe-trim ()
+  (let (erc-lurker-trim-nicks
+        (erc-lurker-ignore-chars "_`"))
+
+    (should (string=3D "nick`" (erc-lurker-maybe-trim "nick`")))
+
+    (setq erc-lurker-trim-nicks t)
+    (should (string=3D "nick" (erc-lurker-maybe-trim "nick`")))
+    (should (string=3D "ni`_ck" (erc-lurker-maybe-trim "ni`_ck__``")))
+
+    (setq erc-lurker-ignore-chars "_-`") ; set of chars, not character alts
+    (should (string=3D "nick" (erc-lurker-maybe-trim "nick-_`")))))
+
 (ert-deftest erc-ring-previous-command-base-case ()
   (ert-info ("Create ring when nonexistent and do nothing")
     (let (erc-input-ring
--=20
2.31.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50005; Package emacs. Full text available.

Message received at 50005 <at> debbugs.gnu.org:


Received: (at 50005) by debbugs.gnu.org; 12 Aug 2021 13:35:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 12 09:35:44 2021
Received: from localhost ([127.0.0.1]:37838 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mEAs4-0005hn-3Y
	for submit <at> debbugs.gnu.org; Thu, 12 Aug 2021 09:35:44 -0400
Received: from mail-108-mta113.mxroute.com ([136.175.108.113]:41827)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jp@HIDDEN>) id 1mEAs2-0005hY-77
 for 50005 <at> debbugs.gnu.org; Thu, 12 Aug 2021 09:35:43 -0400
Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta113.mxroute.com (ZoneMTA) with ESMTPSA id
 17b3a9341bb00074ba.002 for <50005 <at> debbugs.gnu.org>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Thu, 12 Aug 2021 13:35:34 +0000
X-Zone-Loop: 0be44cd6af8ac5240c7b03dd9677949b7ffacbd70287
X-Originating-IP: [149.28.56.236]
From: "J.P." <jp@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Subject: Re: bug#50005: 28.0.50; silence a couple byte-compiler warnings in ERC
References: <50A0B8E0-2F07-4AAC-8170-27990F9FEAD4@HIDDEN>
 <87a6lngccy.fsf@HIDDEN>
 <DED2F755-91E6-441B-9065-B91732D304CE@HIDDEN>
Date: Thu, 12 Aug 2021 06:35:31 -0700
In-Reply-To: <DED2F755-91E6-441B-9065-B91732D304CE@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Thu, 12 Aug 2021 13:52:16
 +0200")
Message-ID: <87sfzeeqfw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-AuthUser: masked@HIDDEN
X-Zone-Spam-Resolution: no action
X-Zone-Spam-Status: No, score=-0.1, required=15, tests=[ARC_NA=0,
 FROM_HAS_DN=0, RCPT_COUNT_THREE=0, TO_DN_SOME=0, MIME_GOOD=-0.1,
 FROM_EQ_ENVFROM=0, MIME_TRACE=0, RCVD_COUNT_ZERO=0, NEURAL_SPAM=0,
 MID_RHS_MATCH_FROM=0]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50005
Cc: Amin Bandali <bandali@HIDDEN>, 50005 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Mattias Engdeg=C3=A5rd <mattiase@HIDDEN> writes:

> The string made it look like backslash were a special character inside
> [...]. It isn't;

Thanks, and sorry you had to explain that. Sad as it is, I'm fairly
certain I even read as much in the Info manual only moments before
defiling that doc string:

  You cannot use =E2=80=98\=E2=80=99 to escape these three characters, sinc=
e =E2=80=98\=E2=80=99 is not
  special here.

> Most ordinary uses of rx will not even require rx.el to be loaded at
> runtime since the macros are expanded during compilation

Again, thanks. Although I should know this instinctively by now, I too
often forget it when deep in the weeds.

> If you meant (in "a-c") in your first example then yes, quite right

Um, yeah, sure, let's go with that! ;)

> Wish I could but time probably doesn't permit, sorry.

Darn, well I definitely appreciate your insights on this one and the
effort made relating them (frustrating as that might have been).

> Of course I'll be happy to answer specifics about parts that I happen
> to know something about.

You may live to regret those words. (Thanks again.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50005; Package emacs. Full text available.

Message received at 50005 <at> debbugs.gnu.org:


Received: (at 50005) by debbugs.gnu.org; 12 Aug 2021 11:52:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 12 07:52:32 2021
Received: from localhost ([127.0.0.1]:37721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mE9G7-0007FT-VI
	for submit <at> debbugs.gnu.org; Thu, 12 Aug 2021 07:52:31 -0400
Received: from mail200c50.megamailservers.eu ([91.136.10.210]:45528
 helo=mail193c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1mE9G2-0007FF-GR
 for 50005 <at> debbugs.gnu.org; Thu, 12 Aug 2021 07:52:27 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1628769140;
 bh=B3iOmZf56bwdeLJ0pTCUNLgavctcmGaVrB5/8EoStko=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=bgm5mSVK2BENx6hBZGCRoJsh4Fqh6ddvX99/WOZJBAZOZuSw335u4Ey8/+91wb330
 nOV/Rjn+/TeNqiJhgLYJqDV7xnO51R19EMkiUZx/a6sB/e9lD6WsCektnzMQGN6o82
 9v/EI6rJKlJu/OgFeyZq4bQzPidz6EchnKccxCVw=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se
 [83.227.82.185]) (authenticated bits=0)
 by mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 17CBqHMR015095; 
 Thu, 12 Aug 2021 11:52:18 +0000
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\))
Subject: Re: bug#50005: 28.0.50; silence a couple byte-compiler warnings in ERC
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <87a6lngccy.fsf@HIDDEN>
Date: Thu, 12 Aug 2021 13:52:16 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <DED2F755-91E6-441B-9065-B91732D304CE@HIDDEN>
References: <50A0B8E0-2F07-4AAC-8170-27990F9FEAD4@HIDDEN>
 <87a6lngccy.fsf@HIDDEN>
To: "J.P." <jp@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.21)
X-CTCH-RefID: str=0001.0A742F2A.61150B74.0010, ss=1, re=0.000, recu=0.000,
 reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: 0.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=GJV27dFK c=1 sm=1 tr=0 a=von4qPfY+hyqc0zmWf0tYQ==:117
 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=IkcTkHD0fZMA:10 a=M51BFTxLslgA:10
 a=solvC2KCA7hIJrw-nAAA:9 a=QEXdDO2ut3YA:10
X-Origin-Country: SE
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 50005
Cc: Amin Bandali <bandali@HIDDEN>, 50005 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

12 aug. 2021 kl. 12.56 skrev J.P. <jp@HIDDEN>:

> Thanks, I spotted the weird double-quote mismatch thing earlier, but I
> guess I'm still missing something else?

The string made it look like backslash were a special character inside =
[...]. It isn't; only ^, ] and - are special, each with their own quirky =
rules. (Other regexp systems have different rules.)

> So, I take this to mean there's no problem with requiring =
(autoloading)
> rx.el (or regexp-opt.el), right?

Correct. Your original problem was the use of `regexp-opt-charset` which =
is not autoloaded (and somewhat of an internal function to =
regexp-opt.el, but that's debatable). Using plain `regexp-opt` is fine.
Most ordinary uses of rx will not even require rx.el to be loaded at =
runtime since the macros are expanded during compilation, but =
`rx-to-string` is a plain function, autoloaded.

> And I guess the `string-to-list' is necessary because
>=20
>  (rx-to-string '(+ (in "abc")) t)
>   =E2=87=92 "[a-c]+"
>=20
> is still interpreted as a set of character alternatives, whereas
>=20
>  (rx-to-string '(+ (in ?a ?- ?c)) t)
>   =E2=87=92 "[ac-]+"
>=20
> combines individual character args into just such a set.

If you meant (in "a-c") in your first example then yes, quite right -- =
the hyphen is special inside strings of the rx `in` construct, but it's =
not special as a character argument. No other characters are special.

> Do you use ERC, Mattias? If so, are you available to review more
> patches?

I'm afraid I rarely use it and know nothing about its innards so I'm =
probably not the right person to ask -- only came by to help out with =
some regexpy things. I have nothing clever to say about your other =
changes, sorry!

> I'm obviously quite ignorant in the ways of Emacs but am
> pushing hard to improve ERC. Some might say that's a recipe for
> embarrassment/disaster (though I'm pretty sure I already crossed that
> first bridge ages ago).

I'd say it's a good sign! Just dive in.

> So what do you say, can you help?

Wish I could but time probably doesn't permit, sorry. There are much =
more experienced hands about. Of course I'll be happy to answer =
specifics about parts that I happen to know something about.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50005; Package emacs. Full text available.

Message received at 50005 <at> debbugs.gnu.org:


Received: (at 50005) by debbugs.gnu.org; 12 Aug 2021 10:56:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 12 06:56:59 2021
Received: from localhost ([127.0.0.1]:37703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mE8OR-0003nU-5L
	for submit <at> debbugs.gnu.org; Thu, 12 Aug 2021 06:56:59 -0400
Received: from mail-108-mta167.mxroute.com ([136.175.108.167]:40735)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jp@HIDDEN>) id 1mE8ON-0003nF-Sy
 for 50005 <at> debbugs.gnu.org; Thu, 12 Aug 2021 06:56:57 -0400
Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta167.mxroute.com (ZoneMTA) with ESMTPSA id
 17b3a01e4d100074ba.002 for <50005 <at> debbugs.gnu.org>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Thu, 12 Aug 2021 10:56:47 +0000
X-Zone-Loop: 116a75038910392ba7f7ed458702e77624fd0bfb5c69
X-Originating-IP: [149.28.56.236]
From: "J.P." <jp@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Subject: Re: bug#50005: 28.0.50; silence a couple byte-compiler warnings in ERC
References: <50A0B8E0-2F07-4AAC-8170-27990F9FEAD4@HIDDEN>
Date: Thu, 12 Aug 2021 03:56:45 -0700
In-Reply-To: <50A0B8E0-2F07-4AAC-8170-27990F9FEAD4@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Thu, 12 Aug 2021 10:15:45
 +0200")
Message-ID: <87a6lngccy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-AuthUser: masked@HIDDEN
X-Zone-Spam-Resolution: no action
X-Zone-Spam-Status: No, score=-0.1, required=15, tests=[ARC_NA=0,
 FROM_HAS_DN=0, RCPT_COUNT_THREE=0, TO_DN_SOME=0, HAS_ATTACHMENT=0,
 FROM_EQ_ENVFROM=0, MIME_TRACE=0, MIME_GOOD=-0.1, NEURAL_SPAM=0,
 MID_RHS_MATCH_FROM=0, RCVD_COUNT_ZERO=0]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50005
Cc: Amin Bandali <bandali@HIDDEN>, 50005 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Mattias Engdeg=C3=A5rd <mattiase@HIDDEN> writes:

> Oops (two typos), but thanks for illustrating the problems with:

Thanks, I spotted the weird double-quote mismatch thing earlier, but I
guess I'm still missing something else? Sorry, I'm quite blind/dumb, as
I'm sure you've gathered.

Anyway, I suppose, if we're using `rx-to-string' or `regexp-opt', then
that entire line can just be 86ed.

>  (rx-to-string `(+ (in ,@(string-to-list erc-lurker-ignore-chars))) t)
>
> or
>
>  (concat (regexp-opt (mapcar #'char-to-string erc-lurker-ignore-chars)) "=
+")

So, I take this to mean there's no problem with requiring (autoloading)
rx.el (or regexp-opt.el), right? I mean, I'd really like to use rx forms
elsewhere in ERC. So if nobody has a problem with it, let's do it! (Cc.
bandali.)

And I guess the `string-to-list' is necessary because

  (rx-to-string '(+ (in "abc")) t)
   =E2=87=92 "[a-c]+"

is still interpreted as a set of character alternatives, whereas

  (rx-to-string '(+ (in ?a ?- ?c)) t)
   =E2=87=92 "[ac-]+"

combines individual character args into just such a set. Thanks for
pointing that out. I'm sure I would have missed that.

Do you use ERC, Mattias? If so, are you available to review more
patches? I'm obviously quite ignorant in the ways of Emacs but am
pushing hard to improve ERC. Some might say that's a recipe for
embarrassment/disaster (though I'm pretty sure I already crossed that
first bridge ages ago).

So what do you say, can you help? I of course would welcome the
experience and obviously don't mind sharing (or even surrendering
complete) credit for anything. (Guess you'd have to weight any potential
cap feathers/plaudits against the indelible smirch of being associated
with the likes of me.) But let me know either way! Thanks.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Fix-mistake-in-test-for-erc-ring-previous-command.patch

From 552c40c20249bc3d90463e176a623e00a4532c9a Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Thu, 13 May 2021 02:27:08 -0700
Subject: [PATCH 1/2] Fix mistake in test for erc-ring-previous-command

* test/lisp/erc/erc-tests.el (erc-ring-previous-command):
The variable erc-send-completed-hook was previously set to nil
permanently, which would affect other tests.
---
 test/lisp/erc/erc-tests.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index d13397274a..9efcf4a703 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -61,13 +61,16 @@ erc-ring-previous-command
   (with-current-buffer (get-buffer-create "*#fake*")
     (erc-mode)
     (insert "\n\n")
-    (setq erc-input-marker (make-marker) ; these are all local
-          erc-insert-marker (make-marker)
-          erc-send-completed-hook nil)
+    (should-not (local-variable-if-set-p 'erc-send-completed-hook))
+    (set (make-local-variable 'erc-send-completed-hook) nil) ; skip t (globals)
+    (setq erc-input-marker (make-marker)
+          erc-insert-marker (make-marker))
     (set-marker erc-insert-marker (point-max))
     (erc-display-prompt)
     (should (= (point) erc-input-marker))
-    (add-hook 'erc-pre-send-functions #'erc-add-to-input-ring nil t)
+    ;; Just in case erc-ring-mode is already on
+    (setq-local erc-pre-send-functions nil)
+    (add-hook 'erc-pre-send-functions #'erc-add-to-input-ring)
     ;;
     (cl-letf (((symbol-function 'erc-process-input-line)
                (lambda (&rest _)
-- 
2.31.1


--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
 filename=0002-Fix-a-couple-byte-compiler-warnings-in-erc.el.patch
Content-Transfer-Encoding: quoted-printable

From e898612de9e2df42c6a769fa88eb02eaeb8b0b78 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Wed, 21 Jul 2021 00:26:38 -0700
Subject: [PATCH 2/2] Fix a couple byte-compiler warnings in erc.el
MIME-Version: 1.0
Content-Type: text/plain; charset=3DUTF-8
Content-Transfer-Encoding: 8bit

* lisp/erc/erc.el (erc-lurker-maybe-trim): Prevent warning from
showing up in third-party code re library not loaded by autoloading
rx.el when needed.  Also make function do what it claims to. It now
only removes trailing chars typically appended automatically for
uniquifying purposes when a desired nick is already taken. Special
thanks to Mattias Engdeg=C3=A5rd for making this more
respectable. Bug#50005.

(erc-with-all-buffers-of-server): Mute byte compiler warning saying
return value unused. Leave possible optimizations for some future
person.
---
 lisp/erc/erc.el            | 25 ++++--------
 test/lisp/erc/erc-tests.el | 79 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 17 deletions(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 73202016ba..ec3ed354b6 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1732,20 +1732,11 @@ erc-with-all-buffers-of-server
 where PRED matches or in all buffers of the server process if PRED is
 nil."
   (declare (indent 1) (debug (form form body)))
-  ;; Make the evaluation have the correct order
-  (let ((pre (make-symbol "pre"))
-        (pro (make-symbol "pro")))
-    `(let* ((,pro ,process)
-            (,pre ,pred)
-            (res (mapcar (lambda (buffer)
-                           (with-current-buffer buffer
-                             ,@forms))
-                         (erc-buffer-list ,pre
-                                          ,pro))))
-       ;; Silence the byte-compiler by binding the result of mapcar to
-       ;; a variable.
-       (ignore res)
-       res)))
+  (macroexp-let2 nil pred pred
+    `(erc-buffer-filter (lambda ()
+                          (when (or (not ,pred) (funcall ,pred))
+                            ,@forms))
+                        ,process)))
=20
 (define-obsolete-function-alias 'erc-iswitchb #'erc-switch-to-buffer "25.1=
")
 (defun erc--switch-to-buffer (&optional arg)
@@ -2583,9 +2574,9 @@ erc-lurker-maybe-trim
 Returns NICK unmodified unless `erc-lurker-trim-nicks' is
 non-nil."
   (if erc-lurker-trim-nicks
-      (replace-regexp-in-string
-       (regexp-opt-charset (string-to-list erc-lurker-ignore-chars))
-       "" nick)
+      (string-trim-right
+       nick (rx-to-string `(+ (in ,@(string-to-list
+                                     erc-lurker-ignore-chars)))))
     nick))
=20
 (defcustom erc-lurker-hide-list nil
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 9efcf4a703..d1a1405999 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -47,6 +47,85 @@ erc--read-time-period
   (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "1d")))
     (should (equal (erc--read-time-period "foo: ") 86400))))
=20
+(ert-deftest erc-with-all-buffers-of-server ()
+  (let (proc-exnet
+        proc-onet
+        erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook)
+
+    (with-current-buffer (get-buffer-create "OtherNet")
+      (erc-mode)
+      (setq proc-onet (start-process "sleep" (current-buffer) "sleep" "1")
+            erc-server-process proc-onet
+            erc-network 'OtherNet)
+      (set-process-query-on-exit-flag erc-server-process nil))
+
+    (with-current-buffer (get-buffer-create "ExampleNet")
+      (erc-mode)
+      (setq proc-exnet (start-process "sleep" (current-buffer) "sleep" "1")
+            erc-server-process proc-exnet
+            erc-network 'ExampleNet)
+      (set-process-query-on-exit-flag erc-server-process nil))
+
+    (with-current-buffer (get-buffer-create "#foo")
+      (erc-mode)
+      (setq erc-server-process proc-exnet)
+      (setq erc-default-recipients '("#foo")))
+
+    (with-current-buffer (get-buffer-create "#spam")
+      (erc-mode)
+      (setq erc-server-process proc-onet)
+      (setq erc-default-recipients '("#spam")))
+
+    (with-current-buffer (get-buffer-create "#bar")
+      (erc-mode)
+      (setq erc-server-process proc-onet)
+      (setq erc-default-recipients '("#bar")))
+
+    (with-current-buffer (get-buffer-create "#baz")
+      (erc-mode)
+      (setq erc-server-process proc-exnet)
+      (setq erc-default-recipients '("#baz")))
+
+    (should (eq (get-buffer-process "ExampleNet") proc-exnet))
+    (erc-with-all-buffers-of-server (get-buffer-process "ExampleNet")
+      nil
+      (kill-buffer))
+
+    (should-not (get-buffer "ExampleNet"))
+    (should-not (get-buffer "#foo"))
+    (should-not (get-buffer "#baz"))
+    (should (get-buffer "OtherNet"))
+    (should (get-buffer "#bar"))
+    (should (get-buffer "#spam"))
+
+    (let* ((test (lambda () (not (string=3D (buffer-name) "#spam"))))
+           (calls 0)
+           (get-test (lambda () (cl-incf calls) test)))
+
+      (erc-with-all-buffers-of-server proc-onet
+        (funcall get-test)
+        (kill-buffer))
+
+      (should (=3D calls 1)))
+
+    (should-not (get-buffer "OtherNet"))
+    (should-not (get-buffer "#bar"))
+    (should (get-buffer "#spam"))
+    (kill-buffer "#spam")))
+
+(ert-deftest erc-lurker-maybe-trim ()
+  (let (erc-lurker-trim-nicks
+        (erc-lurker-ignore-chars "_`"))
+
+    (should (string=3D "nick`" (erc-lurker-maybe-trim "nick`")))
+
+    (setq erc-lurker-trim-nicks t)
+    (should (string=3D "nick" (erc-lurker-maybe-trim "nick`")))
+    (should (string=3D "ni`_ck" (erc-lurker-maybe-trim "ni`_ck__``")))
+
+    (setq erc-lurker-ignore-chars "_-`") ; set of chars, not character alts
+    (should (string=3D "nick" (erc-lurker-maybe-trim "nick-_`")))))
+
 (ert-deftest erc-ring-previous-command-base-case ()
   (ert-info ("Create ring when nonexistent and do nothing")
     (let (erc-input-ring
--=20
2.31.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50005; Package emacs. Full text available.

Message received at 50005 <at> debbugs.gnu.org:


Received: (at 50005) by debbugs.gnu.org; 12 Aug 2021 08:15:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 12 04:15:58 2021
Received: from localhost ([127.0.0.1]:37435 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mE5sc-0007wO-B6
	for submit <at> debbugs.gnu.org; Thu, 12 Aug 2021 04:15:58 -0400
Received: from mail1450c50.megamailservers.eu ([91.136.14.50]:54098
 helo=mail265c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1mE5sZ-0007w7-US
 for 50005 <at> debbugs.gnu.org; Thu, 12 Aug 2021 04:15:57 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1628756148;
 bh=fJB0WAgp3aHlWPVeoyQeCse0iQh9cUd8bEuK0mbmhnM=;
 h=From:Subject:Date:Cc:To:From;
 b=F6DXD3P6++zZ3094BWxt88WNzh7IzlH33kmPMWYxyKLEHPJDndgbM9qpCubENeGqF
 Z3XYF2grDmsxAOO+gYRS2Zb2/LZCe1/+CFB9ZCJrEU2qCltbBkIcUh0Rdb8XGshA2G
 VDdi28c8rY2WbtzyogBJKA+58cQxVQ+0bzEBm0cc=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se
 [83.227.82.185]) (authenticated bits=0)
 by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 17C8FkUi000588; 
 Thu, 12 Aug 2021 08:15:48 +0000
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\))
Subject: bug#50005: 28.0.50; silence a couple byte-compiler warnings in ERC
Message-Id: <50A0B8E0-2F07-4AAC-8170-27990F9FEAD4@HIDDEN>
Date: Thu, 12 Aug 2021 10:15:45 +0200
To: "J.P." <jp@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.21)
X-CTCH-RefID: str=0001.0A742F27.6114D8B4.0032, ss=1, re=0.000, recu=0.000,
 reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: 0.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=K5pc4BeI c=1 sm=1 tr=0 a=von4qPfY+hyqc0zmWf0tYQ==:117
 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=aWcSrmmd2K7Fbca1LA4A:9 a=CjuIK1q_8ugA:10
X-Origin-Country: SE
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  > (defcustom erc-lurker-ignore-chars "`_" > "Characters at
 the end of a nick to strip for activity tracking purposes. > - > +The usual
 rules regarding ]^\\ and - in \"character alternatives\ apply. Oops (two
 typos), but thanks for illustrating the problems with: 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 50005
Cc: 50005 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

>  (defcustom erc-lurker-ignore-chars "`_"
>    "Characters at the end of a nick to strip for activity tracking =
purposes.
> -
> +The usual rules regarding ]^\\ and - in \"character alternatives\ =
apply.

Oops (two typos), but thanks for illustrating the problems with:

> +      (string-trim-right nick (concat "[" erc-lurker-ignore-chars =
"]+"))

Attempting to construct character alternatives by hand is usually a =
mistake; it's just too error-prone. Better use rx or regexp-opt instead:

 (rx-to-string `(+ (in ,@(string-to-list erc-lurker-ignore-chars))) t)

or

 (concat (regexp-opt (mapcar #'char-to-string erc-lurker-ignore-chars)) =
"+")





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50005; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Aug 2021 13:57:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 11 09:57:43 2021
Received: from localhost ([127.0.0.1]:36179 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mDojm-0005yl-JS
	for submit <at> debbugs.gnu.org; Wed, 11 Aug 2021 09:57:43 -0400
Received: from lists.gnu.org ([209.51.188.17]:49568)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jp@HIDDEN>) id 1mDojl-0005yd-3e
 for submit <at> debbugs.gnu.org; Wed, 11 Aug 2021 09:57:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57838)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jp@HIDDEN>) id 1mDojk-00048L-RB
 for bug-gnu-emacs@HIDDEN; Wed, 11 Aug 2021 09:57:40 -0400
Received: from mail-108-mta175.mxroute.com ([136.175.108.175]:40257)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <jp@HIDDEN>) id 1mDoji-00080e-C1
 for bug-gnu-emacs@HIDDEN; Wed, 11 Aug 2021 09:57:40 -0400
Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta175.mxroute.com (ZoneMTA) with ESMTPSA id
 17b3580f7d300074ba.001 for <bug-gnu-emacs@HIDDEN>
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256);
 Wed, 11 Aug 2021 13:57:29 +0000
X-Zone-Loop: da776d27cd3e802a930ec36ade0511e277d48f4466df
X-Originating-IP: [149.28.56.236]
From: "J.P." <jp@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 28.0.50; silence a couple byte-compiler warnings in ERC
Date: Wed, 11 Aug 2021 06:57:26 -0700
Message-ID: <87v94cjd89.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-AuthUser: masked@HIDDEN
X-Zone-Spam-Resolution: no action
X-Zone-Spam-Status: No, score=-0.1, required=15, tests=[ARC_NA=0,
 NEURAL_SPAM=0, FROM_HAS_DN=0, HAS_ATTACHMENT=0, FROM_EQ_ENVFROM=0,
 MIME_TRACE=0, MIME_GOOD=-0.1, RCPT_COUNT_ONE=0, MID_RHS_MATCH_FROM=0,
 RCVD_COUNT_ZERO=0, TO_DN_NONE=0]
Received-SPF: pass client-ip=136.175.108.175; envelope-from=jp@HIDDEN;
 helo=mail-108-mta175.mxroute.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain

Tags: patch

Hi, the commit log for this bug mentions two warnings. The one
concerning regexp-opt.el doesn't actually show up in make output
currently, but it's emitted under fairly mundane circumstances.
Moreover, the actual offending function, `erc-lurker-maybe-trim',
doesn't really behave as advertised, so I've tried tackling that here
as well.

As for `erc-with-all-buffers-of-server': out of deference to existing
code, I've left the "eval only once" stuff in play, even though a quick
survey of use cases at various call sites shows it's not really needed.
I also didn't bother with other possible tweaks, like (for example)
using `macroexp-copyable-p' for the `macroexp-let2' test param, which
would omit the superfluous let-binding of symbol expressions (variables)
in expanded code.

I guess I figured if we're going that far, we might as well replace the
call to `erc-buffer-filter' with a `dolist' or similar or even redo the
filter itself (and friends) completely. But if you buy into any of the
nonsense I've been spewing in other bugs [1], then you'll agree all of
that can wait because ERC has more pressing concerns. Thanks.

P.S. I also snuck in a tweak to an existing ERC test so it'll play nicer
with others; hope that's okay.


[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48598
    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49860


In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
 of 2021-08-09 built on localhost
Repository revision: aeec97fae0ccfcc4dc406a5e0e4c0a94b834cac4
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Fedora 34 (Workstation Edition)

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 51538 6355)
 (symbols 48 6607 1)
 (strings 32 18255 1368)
 (string-bytes 1 616656)
 (vectors 16 14292)
 (vector-slots 8 185252 10153)
 (floats 8 21 47)
 (intervals 56 205 0)
 (buffers 992 10))

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Fix-mistake-in-test-for-erc-ring-previous-command.patch

From 88475f43ed983a348f9ae3c4e143745e04919065 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Thu, 13 May 2021 02:27:08 -0700
Subject: [PATCH 1/2] Fix mistake in test for erc-ring-previous-command

* test/lisp/erc/erc-tests.el (erc-ring-previous-command):
The variable erc-send-completed-hook was previously set to nil
permanently, which would affect other tests.
---
 test/lisp/erc/erc-tests.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index d13397274a..9efcf4a703 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -61,13 +61,16 @@ erc-ring-previous-command
   (with-current-buffer (get-buffer-create "*#fake*")
     (erc-mode)
     (insert "\n\n")
-    (setq erc-input-marker (make-marker) ; these are all local
-          erc-insert-marker (make-marker)
-          erc-send-completed-hook nil)
+    (should-not (local-variable-if-set-p 'erc-send-completed-hook))
+    (set (make-local-variable 'erc-send-completed-hook) nil) ; skip t (globals)
+    (setq erc-input-marker (make-marker)
+          erc-insert-marker (make-marker))
     (set-marker erc-insert-marker (point-max))
     (erc-display-prompt)
     (should (= (point) erc-input-marker))
-    (add-hook 'erc-pre-send-functions #'erc-add-to-input-ring nil t)
+    ;; Just in case erc-ring-mode is already on
+    (setq-local erc-pre-send-functions nil)
+    (add-hook 'erc-pre-send-functions #'erc-add-to-input-ring)
     ;;
     (cl-letf (((symbol-function 'erc-process-input-line)
                (lambda (&rest _)
-- 
2.31.1


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0002-Fix-a-couple-byte-compiler-warnings-in-erc.el.patch

From d54b99bb722616189d1939038b5d2993f9ccfd6f Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@HIDDEN>
Date: Wed, 21 Jul 2021 00:26:38 -0700
Subject: [PATCH 2/2] Fix a couple byte-compiler warnings in erc.el

* lisp/erc/erc.el (erc-lurker-maybe-trim): Prevent warning from
showing up in third party code re library not loaded.  Also make
function do what it claims to. It now only removes trailing chars
typically appended automatically for uniquifying purposes when a
desired nick is already taken.

(erc-with-all-buffers-of-server): Mute byte compiler warning saying
return value unused. Leave possible optimizations for some future
person.
---
 lisp/erc/erc.el            | 25 ++++--------
 test/lisp/erc/erc-tests.el | 79 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+), 18 deletions(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 73202016ba..16a08a6823 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1732,20 +1732,11 @@ erc-with-all-buffers-of-server
 where PRED matches or in all buffers of the server process if PRED is
 nil."
   (declare (indent 1) (debug (form form body)))
-  ;; Make the evaluation have the correct order
-  (let ((pre (make-symbol "pre"))
-        (pro (make-symbol "pro")))
-    `(let* ((,pro ,process)
-            (,pre ,pred)
-            (res (mapcar (lambda (buffer)
-                           (with-current-buffer buffer
-                             ,@forms))
-                         (erc-buffer-list ,pre
-                                          ,pro))))
-       ;; Silence the byte-compiler by binding the result of mapcar to
-       ;; a variable.
-       (ignore res)
-       res)))
+  (macroexp-let2 nil pred pred
+    `(erc-buffer-filter (lambda ()
+                          (when (or (not ,pred) (funcall ,pred))
+                            ,@forms))
+                        ,process)))
 
 (define-obsolete-function-alias 'erc-iswitchb #'erc-switch-to-buffer "25.1")
 (defun erc--switch-to-buffer (&optional arg)
@@ -2572,7 +2563,7 @@ erc-lurker-trim-nicks
 
 (defcustom erc-lurker-ignore-chars "`_"
   "Characters at the end of a nick to strip for activity tracking purposes.
-
+The usual rules regarding ]^\\ and - in \"character alternatives\ apply.
 See also `erc-lurker-trim-nicks'."
   :group 'erc-lurker
   :type 'string)
@@ -2583,9 +2574,7 @@ erc-lurker-maybe-trim
 Returns NICK unmodified unless `erc-lurker-trim-nicks' is
 non-nil."
   (if erc-lurker-trim-nicks
-      (replace-regexp-in-string
-       (regexp-opt-charset (string-to-list erc-lurker-ignore-chars))
-       "" nick)
+      (string-trim-right nick (concat "[" erc-lurker-ignore-chars "]+"))
     nick))
 
 (defcustom erc-lurker-hide-list nil
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 9efcf4a703..b1d2c2a06a 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -47,6 +47,85 @@ erc--read-time-period
   (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "1d")))
     (should (equal (erc--read-time-period "foo: ") 86400))))
 
+(ert-deftest erc-with-all-buffers-of-server ()
+  (let (proc-exnet
+        proc-onet
+        erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook)
+
+    (with-current-buffer (get-buffer-create "OtherNet")
+      (erc-mode)
+      (setq proc-onet (start-process "sleep" (current-buffer) "sleep" "1")
+            erc-server-process proc-onet
+            erc-network 'OtherNet)
+      (set-process-query-on-exit-flag erc-server-process nil))
+
+    (with-current-buffer (get-buffer-create "ExampleNet")
+      (erc-mode)
+      (setq proc-exnet (start-process "sleep" (current-buffer) "sleep" "1")
+            erc-server-process proc-exnet
+            erc-network 'ExampleNet)
+      (set-process-query-on-exit-flag erc-server-process nil))
+
+    (with-current-buffer (get-buffer-create "#foo")
+      (erc-mode)
+      (setq erc-server-process proc-exnet)
+      (setq erc-default-recipients '("#foo")))
+
+    (with-current-buffer (get-buffer-create "#spam")
+      (erc-mode)
+      (setq erc-server-process proc-onet)
+      (setq erc-default-recipients '("#spam")))
+
+    (with-current-buffer (get-buffer-create "#bar")
+      (erc-mode)
+      (setq erc-server-process proc-onet)
+      (setq erc-default-recipients '("#bar")))
+
+    (with-current-buffer (get-buffer-create "#baz")
+      (erc-mode)
+      (setq erc-server-process proc-exnet)
+      (setq erc-default-recipients '("#baz")))
+
+    (should (eq (get-buffer-process "ExampleNet") proc-exnet))
+    (erc-with-all-buffers-of-server (get-buffer-process "ExampleNet")
+      nil
+      (kill-buffer))
+
+    (should-not (get-buffer "ExampleNet"))
+    (should-not (get-buffer "#foo"))
+    (should-not (get-buffer "#baz"))
+    (should (get-buffer "OtherNet"))
+    (should (get-buffer "#bar"))
+    (should (get-buffer "#spam"))
+
+    (let* ((test (lambda () (not (string= (buffer-name) "#spam"))))
+           (calls 0)
+           (get-test (lambda () (cl-incf calls) test)))
+
+      (erc-with-all-buffers-of-server proc-onet
+        (funcall get-test)
+        (kill-buffer))
+
+      (should (= calls 1)))
+
+    (should-not (get-buffer "OtherNet"))
+    (should-not (get-buffer "#bar"))
+    (should (get-buffer "#spam"))
+    (kill-buffer "#spam")))
+
+(ert-deftest erc-lurker-maybe-trim ()
+  (let (erc-lurker-trim-nicks
+        (erc-lurker-ignore-chars "_`"))
+
+    (should (string= "nick`" (erc-lurker-maybe-trim "nick`")))
+
+    (setq erc-lurker-trim-nicks t)
+    (should (string= "nick" (erc-lurker-maybe-trim "nick`")))
+    (should (string= "ni`_ck" (erc-lurker-maybe-trim "ni`_ck__``")))
+
+    (setq erc-lurker-ignore-chars "_-`") ; 95-96
+    (should (string= "nick-" (erc-lurker-maybe-trim "nick-_`")))))
+
 (ert-deftest erc-ring-previous-command-base-case ()
   (ert-info ("Create ring when nonexistent and do nothing")
     (let (erc-input-ring
-- 
2.31.1


--=-=-=--




Acknowledgement sent to "J.P." <jp@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#50005; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 16 Sep 2021 13:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.