From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Distinguish between regional undo and undo to the beginning in undo-equiv-table Date: Wed, 3 Mar 2021 16:59:52 -0500 Message-ID: References: <195AF8D0-1BFD-419D-88A1-69EA1FEED4D6@gmail.com> <60DCC8C7-CCA4-4113-88BE-B81A395C494D@gmail.com> <4890CDDF-E0DD-464B-9268-AD404015129D@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_E936EEFD-1788-4503-A4C2-CCC566BBFD68" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17013"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 03 23:10:14 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lHZh8-0004N5-7d for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Mar 2021 23:10:14 +0100 Original-Received: from localhost ([::1]:46682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHZh7-0003Wv-7o for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Mar 2021 17:10:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHZXD-0006pp-41 for emacs-devel@gnu.org; Wed, 03 Mar 2021 16:59:59 -0500 Original-Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:46345) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHZX8-0005S5-UZ for emacs-devel@gnu.org; Wed, 03 Mar 2021 16:59:58 -0500 Original-Received: by mail-qk1-x72c.google.com with SMTP id a9so11184124qkn.13 for ; Wed, 03 Mar 2021 13:59:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=NMtgQAC040Tys//6oQ5Rs1Cp7F/4EqRxbE6rAxvjH8U=; b=C+Z77pOxeuMcncQhzg4iBfsk8oUc+DEy+XewRB9dChfCKG2Jcs8UP0hGEgd1lNsKdL avs7wbGCVfwnbmOL2Us6rciZOl8emhlhnIB1jQjBdZ7N8e//GQzrQeZ4S8LIciB3ODId 66RJquOAqa6SUdBXA8jAjeVF2uLjqgZnK71Si0oWHuqHx1dzWjo+pw4QqUlRgrWr2wWs 2bIkupgohVAThNz81MmucLaJJIDGuUPwsBDFAuDg/hhOmbYOhSb2O4KeeimoAqF2HMta o+dwI7F7UpDEajoIsSYszdISKeR+hOWl5/4jG4hCwaiKdBYfGjZIw3tf8VyhVPtHQDjp p+Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=NMtgQAC040Tys//6oQ5Rs1Cp7F/4EqRxbE6rAxvjH8U=; b=SRgHmj2kmp7xrxQuCs9k/QZU6Jwxn6uGtFi7lyE2KCtC1yNb0fwLJDhYdPZMg4AI8u rVTZ3vq5zGLG+t++YP6ci3d4VNhI9IdmLHxxGDCGmJ4MKbrQz0gBHpRajyoht5ryOZ5K KehVpMiePlv41tpXPupAacBeVdW90e4BuEsW5N4SA6YVld65VE+0Zv5NGNW4zQNjFCHl wItjHb2YDCpREyyioljax8FYVXcVPPrQhc6U1vtfdundiga5pAbkO7EfDGclou5z28Ig Mli18O1bnj6MK71C81jev877T20GGJGltopCSCBMEAJ4DuJ8ecvwczkPlqnacH18LaNh RyHw== X-Gm-Message-State: AOAM532SlKDXlSysKZkZLIgPPiUEhTik7IqWYEPONQz03MF45nAoY1n6 6WalgRoP1ZV8nzyPPPYwpA8= X-Google-Smtp-Source: ABdhPJxTb4tfQsCu2lnNvGnc16GVTPl7mrBQHnMYqMEAvWlva9HvZ3BB6yUEDvnZjKhfpM6KVzAWkQ== X-Received: by 2002:a37:c16:: with SMTP id 22mr1244762qkm.84.1614808793652; Wed, 03 Mar 2021 13:59:53 -0800 (PST) Original-Received: from ?IPv6:2601:98a:4102:3d80:20f7:9d29:1f01:15b8? ([2601:98a:4102:3d80:20f7:9d29:1f01:15b8]) by smtp.gmail.com with ESMTPSA id n67sm18338288qkb.35.2021.03.03.13.59.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Mar 2021 13:59:53 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3654.60.0.2.21) Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=casouri@gmail.com; helo=mail-qk1-x72c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265918 Archived-At: --Apple-Mail=_E936EEFD-1788-4503-A4C2-CCC566BBFD68 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Mar 3, 2021, at 4:29 PM, Stefan Monnier = wrote: >=20 >> This patch applies on top of the first one. I added more docstrings = since >> you seem to appreciate it. >=20 > Great! >=20 >> I couldn=E2=80=99t wrap my head around the original tests so I = started a new >> one below. >=20 > That's perfectly fine. >=20 > Earlier you wrote: >> if you undo-in-region, break the undo chain, then undo-in-region = again >> with undo-only, ulist would be set to t and it breaks at (setq >> undo-elt (car ulist)). >=20 > I don't see which of the tests corresponds to this. > Is it this one: >=20 >> + (should (equal (buffer-string) "abcde"))) >> + ;; Test undo/redo in region. >> + (with-temp-buffer >> + (buffer-enable-undo) >> + (dolist (x '("a" "b" "c" "d" "e")) >> + (insert x) >> + (undo-boundary)) >> (should (equal (buffer-string) "abcde")) >> - )) >> + (simple-tests--exec '(move-beginning-of-line >> + push-mark-command >> + forward-char >> + forward-char >> + undo)) >> + (should (equal (buffer-string) "acde")) >> + (simple-tests--exec '(undo-only)) >> + (should (equal (buffer-string) "cde")) >> + (simple-tests--exec '(undo-redo)) >> + (should (equal (buffer-string) "acde")) >> + (simple-tests--exec '(undo-redo)) >> + (should (equal (buffer-string) "abcde")))) >=20 > ? Yes, that was supposed to be the one. Just to be sure I ran the test = with the old version and it didn=E2=80=99t error. Oops! I fixed the = test, now it errors on the old version and passes after applying my fix = (in the first patch). The test first runs undo in region, then breaks = the undo chain (my 2nd patch failed to do that), then runs undo in = region again. I=E2=80=99m not sure how to write the comment for that = test. Maybe I could write =E2=80=9Ctest for commit xxx=E2=80=9D but = there is no commit number to refer to right now. Yuan --Apple-Mail=_E936EEFD-1788-4503-A4C2-CCC566BBFD68 Content-Disposition: attachment; filename=undo-in-region-3.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="undo-in-region-3.patch" Content-Transfer-Encoding: quoted-printable =46rom=208c4df349dd2b6c214679d44712a5de99e8a04183=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Wed,=20= 3=20Mar=202021=2016:50:08=20-0500=0ASubject:=20[PATCH]=20checkpoint=0A=0A= ---=0A=20test/lisp/simple-tests.el=20|=2015=20++++++++++++---=0A=201=20= file=20changed,=2012=20insertions(+),=203=20deletions(-)=0A=0Adiff=20= --git=20a/test/lisp/simple-tests.el=20b/test/lisp/simple-tests.el=0A= index=20a4816951ce..eb1c0e53e2=20100644=0A---=20= a/test/lisp/simple-tests.el=0A+++=20b/test/lisp/simple-tests.el=0A@@=20= -479,12=20+479,21=20@@=20simple-tests--undo=0A=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20forward-char=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= undo))=0A=20=20=20=20=20(should=20(equal=20(buffer-string)=20"acde"))=0A= -=20=20=20=20(simple-tests--exec=20'(undo-only))=0A-=20=20=20=20(should=20= (equal=20(buffer-string)=20"cde"))=0A+=20=20=20=20(simple-tests--exec=20= '(move-beginning-of-line=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20push-mark-command=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20forward-char=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20forward-char=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20undo-only))=0A+=20=20=20=20(should=20(equal=20= (buffer-string)=20"abcde"))=0A=20=20=20=20=20(simple-tests--exec=20= '(undo-redo))=0A=20=20=20=20=20(should=20(equal=20(buffer-string)=20= "acde"))=0A=20=20=20=20=20(simple-tests--exec=20'(undo-redo))=0A-=20=20=20= =20(should=20(equal=20(buffer-string)=20"abcde"))))=0A+=20=20=20=20= (should=20(equal=20(buffer-string)=20"abcde"))=0A+=20=20=20=20= (deactivate-mark)=0A+=20=20=20=20(simple-tests--exec=20= '(move-beginning-of-line=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20push-mark-command=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20forward-char=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20undo-only))))=0A=20=0A=20(defun=20simple-tests--sans-leading-nil=20= (lst)=0A=20=20=20"Return=20LST=20sans=20the=20leading=20nils."=0A--=20=0A= 2.24.3=20(Apple=20Git-128)=0A=0A= --Apple-Mail=_E936EEFD-1788-4503-A4C2-CCC566BBFD68--