From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "J.P." Newsgroups: gmane.emacs.bugs Subject: bug#60936: 30.0.50; ERC >5.5: Add erc-fill style based on visual-line-mode Date: Sun, 23 Jul 2023 07:00:07 -0700 Message-ID: <87h6pug23c.fsf__5280.21422667138$1690120889$gmane$org@neverwas.me> References: <87tu0nao77.fsf@neverwas.me> <87msztl4xu.fsf@neverwas.me> <87a5vsjb3q.fsf@neverwas.me> <87351iiueu.fsf@neverwas.me> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12361"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-erc@gnu.org To: 60936@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 23 16:01:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qNZeC-00030z-1b for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Jul 2023 16:01:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNZdx-0003nr-2M; Sun, 23 Jul 2023 10:01:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNZdu-0003nG-Ew for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2023 10:01:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNZdu-00040y-6v for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2023 10:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qNZdu-0004Xy-2a for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2023 10:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Jul 2023 14:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60936 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60936-submit@debbugs.gnu.org id=B60936.169012081817395 (code B ref 60936); Sun, 23 Jul 2023 14:01:02 +0000 Original-Received: (at 60936) by debbugs.gnu.org; 23 Jul 2023 14:00:18 +0000 Original-Received: from localhost ([127.0.0.1]:41084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNZdB-0004WV-9w for submit@debbugs.gnu.org; Sun, 23 Jul 2023 10:00:17 -0400 Original-Received: from mail-108-mta108.mxroute.com ([136.175.108.108]:35399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNZd8-0004WL-RG for 60936@debbugs.gnu.org; Sun, 23 Jul 2023 10:00:16 -0400 Original-Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta108.mxroute.com (ZoneMTA) with ESMTPSA id 189830cf5940004cef.001 for <60936@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 23 Jul 2023 14:00:11 +0000 X-Zone-Loop: ff16db9224b180e914a45018ca13007bc335321c9b7c X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: 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=WnII9XzbeXSrNTa83/1nlxS1NQK3EwKzPbA0Sy+kdJU=; b=QRTktNWfXZT87wa8bxFux9eitb z7phrZvjxXQM3RUWgppCHSQEQnUJsrlQTa6v8LTab/Fbkefaz3DGGKRux4qgC1tjNEDdXRhpjz+EU qLiIWt0L+977rtuvRPC8Rkdl+dAHTV+MDSZS7SxVkvPN3YLsDA83gKBpRFKPcfCvWRiCtrPe3h9OD uQx3tIh/tjqJWQ2Prvy6sZWv8oCYpZkAlN5UlLPW6S8Ib2aUjb+y6IAKSO1aO0IQyJ0ZxkIkGlEha I6NzJF+3OxIpjfSM6VGjmWFTyjCsn7he1+WjVFMSkRKtENAnUUO5kFdjbNTr2LAux5f82fJvJnca+ oY+RyEDw==; In-Reply-To: <87351iiueu.fsf@neverwas.me> (J. P.'s message of "Thu, 20 Jul 2023 06:28:41 -0700") X-Authenticated-Id: masked@neverwas.me X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265909 Archived-At: --=-=-= Content-Type: text/plain "J.P." writes: > v3 (left-margin enhancement). Extend stamp-only text properties to > leading white space on right-sided stamps occupying their own line. This was installed as * 63d8b2a59a4 Make erc-fill-wrap work with left-sided stamps Unfortunately, it introduced a regression involving CTCP ACTIONs from consecutive speakers. To reproduce, say something in a target buffer, then do a "/me something" immediately afterward. You'll see that ERC inserts something something instead of something * nick something or something * nick something The attached patch should fix this. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-5.6-Fix-CTCP-ACTION-regression-in-erc-fill-wrap.patch Content-Transfer-Encoding: quoted-printable >From 0812d0b35e07d36d1747d5483e7da6ca5ac81c1d Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Sat, 22 Jul 2023 14:07:38 -0700 Subject: [PATCH] [5.6] Fix CTCP ACTION regression in erc-fill-wrap * lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Fail when current message is a CTCP ACTION. This fixes a regression introduced by 63d8b2a59a4 "Make erc-fill-wrap work with left-sided stamps". * test/lisp/erc/erc-fill-tests.el: (erc-fill-wrap--merge-action): New test. * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: New test data file. (Bug#60936) --- lisp/erc/erc-fill.el | 3 +- test/lisp/erc/erc-fill-tests.el | 40 +++++++++++++++++++ .../fill/snapshots/merge-wrap-01.eld | 1 + 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el index 17eb0002f08..e2a82582a3f 100644 --- a/lisp/erc/erc-fill.el +++ b/lisp/erc/erc-fill.el @@ -443,12 +443,13 @@ erc-fill--wrap-continued-message-p (cons (get-text-property m 'erc-timestamp) (get-text-property spr 'erc-speaker))))) (ts (pop props)) + (props) ((not (time-less-p (erc-stamp--current-time) ts))) ((time-less-p (time-subtract (erc-stamp--current-time) ts) erc-fill--wrap-max-lull)) (speaker (next-single-property-change (point-min) 'erc-speak= er)) + ((not (eq (get-text-property speaker 'erc-ctcp) 'ACTION))) (nick (get-text-property speaker 'erc-speaker)) - (props) ((erc-nick-equal-p props nick)))) (set-marker erc-fill--wrap-last-msg (point-min)))) =20 diff --git a/test/lisp/erc/erc-fill-tests.el b/test/lisp/erc/erc-fill-tests= .el index 67622da9f3d..b81d0c15558 100644 --- a/test/lisp/erc/erc-fill-tests.el +++ b/test/lisp/erc/erc-fill-tests.el @@ -241,6 +241,46 @@ erc-fill-wrap--merge " " " " " " " " " " " " " ") (erc-fill-tests--compare "merge-02-right"))))) =20 +(ert-deftest erc-fill-wrap--merge-action () + :tags '(:unstable) + (unless (>=3D emacs-major-version 29) + (ert-skip "Emacs version too low, missing `buffer-text-pixel-size'")) + + (erc-fill-tests--wrap-populate + + (lambda () + ;; Set this here so that the first few messages are from 1970 + (let ((erc-fill-tests--time-vals (lambda () 1680332400))) + (erc-fill-tests--insert-privmsg "bob" "zero.") + + (erc-process-ctcp-query + erc-server-process + (make-erc-response + :unparsed ":bob!~u@fake PRIVMSG #chan :\1ACTION one\1" + :sender "bob!~u@fake" :command "PRIVMSG" + :command-args '("#chan" "\1ACTION one\1") :contents "\1ACTION one= \1") + "bob" "~u" "fake") + + (erc-fill-tests--insert-privmsg "bob" "two.") + + ;; Compat switch to opt out of overhanging speaker. + (let (erc-fill--wrap-action-dedent-p) + (erc-process-ctcp-query + erc-server-process + (make-erc-response + :unparsed ":bob!~u@fake PRIVMSG #chan :\1ACTION three\1" + :sender "bob!~u@fake" :command "PRIVMSG" + :command-args '("#chan" "\1ACTION three\1") + :contents "\1ACTION three\1") + "bob" "~u" "fake")) + + (erc-fill-tests--insert-privmsg "bob" "four.")) + + (should (=3D erc-fill--wrap-value 27)) + (erc-fill-tests--wrap-check-prefixes + "*** " " " " " " " "* bob " " " "* " " ") + (erc-fill-tests--compare "merge-wrap-01")))) + (ert-deftest erc-fill-line-spacing () :tags '(:unstable) (unless (>=3D emacs-major-version 29) diff --git a/test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld b/tes= t/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld new file mode 100644 index 00000000000..a3d533c87b5 --- /dev/null +++ b/test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld @@ -0,0 +1 @@ +#("\n\n\n[Thu Jan 1 1970]\n*** This server is in debug mode and is loggin= g all user I/O. If you do not wish for everything you send to be readable b= y the server owner(s), please disconnect.[00:00]\n bob: come, you ar= e a tedious fool: to the purpose. What was done to Elbow's wife, that he ha= th cause to complain of? Come me to what was done to her.\n alice: Eit= her your unparagoned mistress is dead, or she's outprized by a trifle.\n\n[= Sat Apr 1 2023]\n zero.[07:00]\n* bob one\n two.\n* bob three\n<= bob> four.\n" 2 20 (erc-timestamp 0 line-prefix (space :width (- 27 (18))) = field erc-timestamp) 20 21 (erc-timestamp 0 field erc-timestamp) 21 183 (er= c-timestamp 0 wrap-prefix #2=3D(space :width 27) line-prefix #3=3D(space :w= idth (- 27 (4)))) 183 190 (erc-timestamp 0 field erc-timestamp wrap-prefix = #2# line-prefix #3# display #1=3D(#7=3D(margin right-margin) #("[00:00]" 0 = 7 (display #1# invisible timestamp font-lock-face erc-timestamp-face)))) 19= 1 192 (erc-timestamp 0 wrap-prefix #2# line-prefix #4=3D(space :width (- 27= (8))) erc-command PRIVMSG) 192 197 (erc-timestamp 0 wrap-prefix #2# line-p= refix #4# erc-command PRIVMSG) 197 199 (erc-timestamp 0 wrap-prefix #2# lin= e-prefix #4# erc-command PRIVMSG) 199 202 (erc-timestamp 0 wrap-prefix #2# = line-prefix #4# erc-command PRIVMSG) 202 315 (erc-timestamp 0 wrap-prefix #= 2# line-prefix #4# erc-command PRIVMSG) 315 316 (erc-timestamp 0 erc-comman= d PRIVMSG) 316 348 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-com= mand PRIVMSG) 349 350 (erc-timestamp 0 wrap-prefix #2# line-prefix #5=3D(sp= ace :width (- 27 (6))) erc-command PRIVMSG) 350 353 (erc-timestamp 0 wrap-p= refix #2# line-prefix #5# erc-command PRIVMSG) 353 355 (erc-timestamp 0 wra= p-prefix #2# line-prefix #5# erc-command PRIVMSG) 355 360 (erc-timestamp 0 = wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 360 435 (erc-timestamp= 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 436 454 (erc-timest= amp 1680332400 line-prefix (space :width (- 27 (18))) field erc-timestamp) = 454 455 (erc-timestamp 1680332400 field erc-timestamp) 455 456 (erc-timesta= mp 1680332400 wrap-prefix #2# line-prefix #6=3D(space :width (- 27 (6))) er= c-command PRIVMSG) 456 459 (erc-timestamp 1680332400 wrap-prefix #2# line-p= refix #6# erc-command PRIVMSG) 459 466 (erc-timestamp 1680332400 wrap-prefi= x #2# line-prefix #6# erc-command PRIVMSG) 466 473 (erc-timestamp 168033240= 0 field erc-timestamp wrap-prefix #2# line-prefix #6# display #8=3D(#7# #("= [07:00]" 0 7 (display #8# invisible timestamp font-lock-face erc-timestamp-= face)))) 474 476 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9= =3D(space :width (- 27 (6))) erc-ctcp ACTION erc-command PRIVMSG) 476 479 (= erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-ctcp ACTION er= c-command PRIVMSG) 479 483 (erc-timestamp 1680332400 wrap-prefix #2# line-p= refix #9# erc-ctcp ACTION erc-command PRIVMSG) 484 485 (erc-timestamp 16803= 32400 wrap-prefix #2# line-prefix #10=3D(space :width (- 27 (6))) erc-comma= nd PRIVMSG) 485 488 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #= 10# erc-command PRIVMSG) 488 494 (erc-timestamp 1680332400 wrap-prefix #2# = line-prefix #10# erc-command PRIVMSG) 495 497 (erc-timestamp 1680332400 wra= p-prefix #2# line-prefix #11=3D(space :width (- 27 (2))) erc-ctcp ACTION er= c-command PRIVMSG) 497 500 (erc-timestamp 1680332400 wrap-prefix #2# line-p= refix #11# erc-ctcp ACTION erc-command PRIVMSG) 500 506 (erc-timestamp 1680= 332400 wrap-prefix #2# line-prefix #11# erc-ctcp ACTION erc-command PRIVMSG= ) 507 508 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12=3D(spac= e :width (- 27 (6))) erc-command PRIVMSG) 508 511 (erc-timestamp 1680332400= wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 511 518 (erc-timesta= mp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG)) \ No newline at end of file --=20 2.41.0 --=-=-=--