From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#37700: 27.0.50; undo mouse-drag-and-drop-region ineffective Date: Wed, 16 Oct 2019 17:27:05 +0200 Message-ID: <37DDF48D-FC37-47A8-8CEC-C6EB66AB2BF7@acm.org> References: <3311689D-B1DF-4BAC-86BA-E3D2C6D2ECF1@acm.org> <94D2DE0C-8BD0-4CCF-B77D-5606A1D227DD@acm.org> <5be797bb-9d6b-cebe-edf4-21b4a5944595@gmx.at> <60b5bfa7-0aaf-40c0-3a1d-d0c0c5c662c6@gmx.at> <354ABF35-C5D0-4045-B9F0-5615A64408E6@acm.org> <83k199nasx.fsf@gnu.org> <83ftjxn94q.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_E55E1877-CC02-44CD-A1F1-A7B4AC3D6594" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="115221"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 37700@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp, homeros.misasa@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 16 17:28:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iKlDg-000Tpc-1i for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Oct 2019 17:28:12 +0200 Original-Received: from localhost ([::1]:44486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKlDe-00043U-RY for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Oct 2019 11:28:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51955) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKlDX-00041T-VR for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2019 11:28:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKlDW-0004tv-W4 for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2019 11:28:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37558) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKlDW-0004tm-Sf for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2019 11:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iKlDW-00039o-Na for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2019 11:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Oct 2019 15:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37700 X-GNU-PR-Package: emacs Original-Received: via spool by 37700-submit@debbugs.gnu.org id=B37700.157123963412061 (code B ref 37700); Wed, 16 Oct 2019 15:28:02 +0000 Original-Received: (at 37700) by debbugs.gnu.org; 16 Oct 2019 15:27:14 +0000 Original-Received: from localhost ([127.0.0.1]:46378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iKlCk-00038T-Er for submit@debbugs.gnu.org; Wed, 16 Oct 2019 11:27:14 -0400 Original-Received: from mail173c50.megamailservers.eu ([91.136.10.183]:46510 helo=mail56c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iKlCh-00038J-OC for 37700@debbugs.gnu.org; Wed, 16 Oct 2019 11:27:12 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1571239629; bh=QHid3I5d/BCEiOP9eGhzkRw5bV0qEYW2I49kg0zgFA0=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=qePqaPA9WNE0BDNPhP2s+Ff5aVjkWH/l6/ZIMkjB89NtYRFEb7IeCRxu+MJfWKcqz +F1BxQ8C5k3u6lc1e8AUztO4Oq1FNrPKX/kXsOiRp0XfN+DIowFr0tLRK4/OTJFuDX 7YnRrhYgedn8SsR+D0w6ZJFDID75TXCxX3xpXY5g= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.1.64] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail56c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x9GFR6YE001634; Wed, 16 Oct 2019 15:27:08 +0000 In-Reply-To: <83ftjxn94q.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0209.5DA736CD.0065, 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-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Hc1qsRM8 c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=XwWOB90QfDHLYLrzteQA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=CjuIK1q_8ugA:10 a=y2fPTyxOXttb7gH-QJsA:9 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22 a=pHzHmUro8NiASowvMSCR:22 a=xoEH_sTeL_Rfw54TyV31:22 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:169456 Archived-At: --Apple-Mail=_E55E1877-CC02-44CD-A1F1-A7B4AC3D6594 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 12 okt. 2019 kl. 19.53 skrev Eli Zaretskii : >=20 > Or maybe have those commands have an 'undo' property which would tell > 'undo' to treat them specially. Like we do with delete-selection. After trying various approaches, the attached patch looks somewhat = promising. It adds a new element type to buffer-undo-list, `unconfined', = which disables selective undo for one record. Consider it a = proof-of-concept. While it has the advantage of not requiring the user to change any = settings, I still prefer the first approach (an option to disable undo = confinement), as it's less intrusive and more generally useful. However, = this should work as well. --Apple-Mail=_E55E1877-CC02-44CD-A1F1-A7B4AC3D6594 Content-Disposition: attachment; filename=0001-Don-t-confine-undo-of-mouse-drag-and-drop-to-the-reg.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Don-t-confine-undo-of-mouse-drag-and-drop-to-the-reg.patch" Content-Transfer-Encoding: quoted-printable =46rom=20307e5c6a19eda9d464e75f73b73f57fc1cf9e42e=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=2016=20Oct=202019=2015:32:22=20+0200=0A= Subject:=20[PATCH]=20Don't=20confine=20undo=20of=20mouse-drag-and-drop=20= to=20the=20region=0A=20(bug#37700)=0AMIME-Version:=201.0=0AContent-Type:=20= text/plain;=20charset=3DUTF-8=0AContent-Transfer-Encoding:=208bit=0A=0A= Since=20the=20region=20is=20active=20after=20a=20mouse-drag-and-drop,=20= the=20change=0Acannot=20immediately=20be=20undone.=20=20To=20get=20= around=20this,=20tell=20the=20undo=0Amachinery=20to=20ignore=20the=20= region=20confinement=20for=20this=20operation.=0A=0A*=20lisp/simple.el=20= (primitive-undo,=20undo-make-selective-list):=0A*=20src/buffer.c=20= (buffer-undo-list):=0ANew=20`buffer-undo-list=E2=80=99=20element=20= `unconfined'.=0A*=20lisp/mouse.el=20(mouse-drag-and-drop-region):=0AMark=20= the=20operation=20as=20unconfined=20upon=20undo.=0A---=0A=20= lisp/mouse.el=20=20|=207=20++++++-=0A=20lisp/simple.el=20|=209=20= +++++++--=0A=20src/buffer.c=20=20=20|=203=20+++=0A=203=20files=20= changed,=2016=20insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/mouse.el=20b/lisp/mouse.el=0Aindex=2076fec507e7..533ad606fb=20= 100644=0A---=20a/lisp/mouse.el=0A+++=20b/lisp/mouse.el=0A@@=20-2657,7=20= +2657,12=20@@=20mouse-drag-and-drop-region=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(let=20(deactivate-mark)=0A=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(dolist=20(overlay=20= mouse-drag-and-drop-overlays)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(delete-region=20(overlay-start=20overlay)=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= =20=20=20=20=20=20=20=20(overlay-end=20overlay)))))=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=20=20=20=20= =20=20=20=20(overlay-end=20overlay))))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20;;=20Since=20we=20will=20leave=20the=20destination=20text=20= selected,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20make=20= sure=20an=20undo=20operation=20disregards=20the=20region=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20;;=20or=20the=20operation=20will=20only=20= be=20partially=20undone.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(when=20(consp=20buffer-undo-list)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(push=20'unconfined=20buffer-undo-list)))=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20;;=20When=20source=20buffer=20and=20= destination=20buffer=20are=20different,=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20;;=20keep=20(set=20back=20the=20original=20text=20as=20region)=20= or=20remove=20the=0A=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20original=20= text.=0Adiff=20--git=20a/lisp/simple.el=20b/lisp/simple.el=0Aindex=20= b733f76ac7..ea580f651d=20100644=0A---=20a/lisp/simple.el=0A+++=20= b/lisp/simple.el=0A@@=20-2748,6=20+2748,7=20@@=20primitive-undo=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(set-marker=20marker=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(-=20marker=20= offset)=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(marker-buffer=20marker))))=0A+=20=20=20=20=20=20=20=20=20= =20(unconfined)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;=20= Ignore=20this=20directive=20here.=0A=20=20=20=20=20=20=20=20=20=20=20(_=20= (error=20"Unrecognized=20entry=20in=20undo=20list=20%S"=20next))))=0A=20=20= =20=20=20=20=20(setq=20arg=20(1-=20arg)))=0A=20=20=20=20=20;;=20Make=20= sure=20an=20apply=20entry=20produces=20at=20least=20one=20undo=20entry,=0A= @@=20-2850,6=20+2851,7=20@@=20undo-make-selective-list=0A=20=20=20(let=20= ((ulist=20buffer-undo-list)=0A=20=20=20=20=20=20=20=20=20;;=20A=20list=20= of=20position=20adjusted=20undo=20elements=20in=20the=20region.=0A=20=20=20= =20=20=20=20=20=20(selective-list=20(list=20nil))=0A+=20=20=20=20=20=20=20= =20(unconfined=20nil)=20=20=20;=20Whether=20to=20include=20whole=20= record=20unconditionally.=0A=20=20=20=20=20=20=20=20=20;;=20A=20list=20= of=20undo-deltas=20for=20out=20of=20region=20undo=20elements.=0A=20=20=20= =20=20=20=20=20=20undo-deltas=0A=20=20=20=20=20=20=20=20=20undo-elt)=0A= @@=20-2862,7=20+2864,10=20@@=20undo-make-selective-list=0A=20=20=20=20=20= =20=20=20((null=20undo-elt)=0A=20=20=20=20=20=20=20=20=20;;=20Don't=20= put=20two=20nils=20together=20in=20the=20list=0A=20=20=20=20=20=20=20=20=20= (when=20(car=20selective-list)=0A-=20=20=20=20=20=20=20=20=20=20(push=20= nil=20selective-list)))=0A+=20=20=20=20=20=20=20=20=20=20(push=20nil=20= selective-list))=0A+=20=20=20=20=20=20=20=20(setq=20unconfined=20nil))=0A= +=20=20=20=20=20=20=20((eq=20undo-elt=20'unconfined)=0A+=20=20=20=20=20=20= =20=20(setq=20unconfined=20t))=0A=20=20=20=20=20=20=20=20((and=20(consp=20= undo-elt)=20(eq=20(car=20undo-elt)=20t))=0A=20=20=20=20=20=20=20=20=20;;=20= This=20is=20a=20"was=20unmodified"=20element.=20=20Keep=20it=0A=20=20=20=20= =20=20=20=20=20;;=20if=20we=20have=20kept=20everything=20thus=20far.=0A= @@=20-2875,7=20+2880,7=20@@=20undo-make-selective-list=0A=20=20=20=20=20=20= =20=20(t=0A=20=20=20=20=20=20=20=20=20(let=20((adjusted-undo-elt=20= (undo-adjust-elt=20undo-elt=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=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20undo-deltas)))=0A-=20=20=20=20=20=20=20=20= =20=20(if=20(undo-elt-in-region=20adjusted-undo-elt=20start=20end)=0A+=20= =20=20=20=20=20=20=20=20=20(if=20(or=20(undo-elt-in-region=20= adjusted-undo-elt=20start=20end)=20unconfined)=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(progn=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(setq=20end=20(+=20end=20(cdr=20(undo-delta=20= adjusted-undo-elt))))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (push=20adjusted-undo-elt=20selective-list)=0Adiff=20--git=20= a/src/buffer.c=20b/src/buffer.c=0Aindex=208cb28d8aa7..978d4576df=20= 100644=0A---=20a/src/buffer.c=0A+++=20b/src/buffer.c=0A@@=20-6128,6=20= +6128,9=20@@=20from=20(abs=20POSITION).=20=20If=20POSITION=20is=20= positive,=20point=20was=20at=20the=20front=0A=20Entries=20with=20value=20= nil=20mark=20undo=20boundaries.=20=20The=20undo=20command=20treats=0A=20= the=20changes=20between=20two=20undo=20boundaries=20as=20a=20single=20= step=20to=20be=20undone.=0A=20=0A+An=20entry=20with=20the=20value=20= `unconfined'=20disables=20selective=20undo=20until=20the=0A+next=20undo=20= boundary=20even=20if=20the=20region=20is=20active.=0A+=0A=20If=20the=20= value=20of=20the=20variable=20is=20t,=20undo=20information=20is=20not=20= recorded.=20=20*/);=0A=20=0A=20=20=20DEFVAR_PER_BUFFER=20("mark-active",=20= &BVAR=20(current_buffer,=20mark_active),=20Qnil,=0A--=20=0A2.21.0=20= (Apple=20Git-122)=0A=0A= --Apple-Mail=_E55E1877-CC02-44CD-A1F1-A7B4AC3D6594--