From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Kifer Newsgroups: gmane.emacs.bugs Subject: bug#22295: viper-mode undo bug introduced between Nov 10 and Nov 14 Date: Sat, 14 May 2016 16:50:07 -0400 Message-ID: <57378F7F.2040803@cs.stonybrook.edu> References: <83vb2h6lfq.fsf@gnu.org> <83r3d56jrg.fsf@gnu.org> <87poso7nf5.fsf@russet.org.uk> <57378626.8060205@cs.stonybrook.edu> <87vb2g9xx5.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1463259098 18676 80.91.229.3 (14 May 2016 20:51:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 May 2016 20:51:38 +0000 (UTC) Cc: 22295@debbugs.gnu.org, jim@meyering.net To: Phillip Lord Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 14 22:51:23 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b1gWl-0004np-E9 for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 May 2016 22:51:11 +0200 Original-Received: from localhost ([::1]:38878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1gWk-0007SU-Kv for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 May 2016 16:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1gWg-0007O8-EC for bug-gnu-emacs@gnu.org; Sat, 14 May 2016 16:51:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1gWc-0002mB-56 for bug-gnu-emacs@gnu.org; Sat, 14 May 2016 16:51:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1gWc-0002m7-0s for bug-gnu-emacs@gnu.org; Sat, 14 May 2016 16:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b1gWb-0007Wm-PP for bug-gnu-emacs@gnu.org; Sat, 14 May 2016 16:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Kifer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 May 2016 20:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22295 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22295-submit@debbugs.gnu.org id=B22295.146325901628880 (code B ref 22295); Sat, 14 May 2016 20:51:01 +0000 Original-Received: (at 22295) by debbugs.gnu.org; 14 May 2016 20:50:16 +0000 Original-Received: from localhost ([127.0.0.1]:51745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b1gVs-0007Vj-1w for submit@debbugs.gnu.org; Sat, 14 May 2016 16:50:16 -0400 Original-Received: from mail-qg0-f46.google.com ([209.85.192.46]:36650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b1gVq-0007VW-Bm for 22295@debbugs.gnu.org; Sat, 14 May 2016 16:50:14 -0400 Original-Received: by mail-qg0-f46.google.com with SMTP id w36so73772727qge.3 for <22295@debbugs.gnu.org>; Sat, 14 May 2016 13:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs-stonybrook-edu.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=QyjrEZ90uGdC2AmjAr4KAJGrSBcatvTXeyF4l1YEL/c=; b=Wedy5gKlGgeceAfwt1HV8k9kqiQC/9NQkBHj9HlU+/Rmsk2+gfTHSE92iuemappaqj MeXSWUywy6WNzJIZJ7dvj8UGnDgAoqhPaaDzwj/S1idTmJgIsLZQEy0mYq830859jrZY Xo3+8vkGXgqyWsCA9UTvTa7BCSvnxadn/FftF5BZdAXMkfc7rV/NLpV2kiKE8kaBL2BJ 8aTwXp7vScpTg4lDQlIFZ1ySksJZV26AXxQQ0rjs2VFdStRxoJr2F9sfS4DabT77vbrr qZX+JUwe+JyvXehrqPbQNLGDnvZYrvkp0K1xlD7fHj8bDDejxSFZa+gQPo1PWmHuqnXo U7DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=QyjrEZ90uGdC2AmjAr4KAJGrSBcatvTXeyF4l1YEL/c=; b=V4RLTwTSxh6N5QTJqc/2fnJRZNKXYKWxduUWsiYzWGvrTDTDDta9V734vlf/4tnm/n HxP6uj3x1CKPqjcpw+2nFLJCoOIf0CujMJRhy/LuoXZJXv5iEdKKMuK9gkYTA8WCS2R3 XJI4Xml1X4RIXJNgBpz8qJyORyniHQ7JKL0LcgWZ7nzmQUmNg69AHmnQOBJ8i0BDj6sr vfoQN9c66+MnV0/21UilM3tYMFPHmhDF1kvJrLmI3ynQ5eIf0OiNsy/5Dql58xY5TdpW toox7ywRKwqY/QaorC5ViO8qmqdzuVqWNHSUtM6c48F2gdBMhhHvhSFW3wNIJeFhkjvE rNyQ== X-Gm-Message-State: AOPr4FXWf/O+U33LFHp3euPVQ5WuWeM6oR88c7jCSJTPqGA3wl69tHqPFlXEhBZuO/u+zPNQ X-Received: by 10.141.3.66 with SMTP id f63mr23595540qhd.55.1463259008920; Sat, 14 May 2016 13:50:08 -0700 (PDT) Original-Received: from [192.168.1.106] (ool-18ba1846.dyn.optonline.net. [24.186.24.70]) by smtp.gmail.com with ESMTPSA id s66sm11165955qha.44.2016.05.14.13.50.08 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 14 May 2016 13:50:08 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 In-Reply-To: <87vb2g9xx5.fsf@russet.org.uk> 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: 208.118.235.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:118245 Archived-At:

On 05/14/2016 04:39 PM, Phillip Lord wrote:
Michael Kifer <kifer@cs.stonybrook.edu> writes:

On 05/14/2016 09:57 AM, Phillip Lord wrote:
Eli Zaretskii <eliz@gnu.org> writes:

Date: Sat, 14 May 2016 12:25:13 +0300
From: Eli Zaretskii <eliz@gnu.org>
Cc: 22295@debbugs.gnu.org, Jim Meyering <jim@meyering.net>
Sorry for slow response -- was travelling.

Yep, viper is doing strange things to undo -- it adds a symbol ('viper)
to the undo list, then removes it later, amalgamating everything upto
'viper.
I don't remember much myself, but the issue is this (and it is documented):
It's commented rather documented:-)

Well, there is no technical documentation like for most other packages. The code is documented though (more or less :-)


In VI, the granularity of undoing is much coarser than in Emacs.
Several ops that Emacs undoes in multiple steps are supposed to be
undone with just one "undo" in VI. Viper simulates this by inserting
viper-buffer-undo-list-mark onto buffer-undo-list to mark the point to
which the Emacs undo's are to be run in order to accomplish one
VI-style undo. In Emacs, as I vaguely remember, this role is played by
nil(?), but VI-style undos are coarser than that, so viper requires
its own marker on the unfo list.
Yes, you are correct -- boundaries are nil.

Viper puts it's own mark in, yes, but then deletes it later on and
replaces it with nil in this bit of code.


(setq tmp2 (cdr tmp)) ; the part after mark

;; cut tail from buffer-undo-list temporarily by direct
;; manipulation with pointers in buffer-undo-list
(setcdr tmp nil)

(setq buffer-undo-list (delq nil buffer-undo-list))
(setq buffer-undo-list
      (delq viper-buffer-undo-list-mark buffer-undo-list))
;; restore tail of buffer-undo-list
(setq buffer-undo-list (nconc buffer-undo-list tmp2)))

Essentially, it just kills the standard boundary handling and does it's
own thing.

Right, it has to do its own marking.  When something gets viper-undone, the latest viper-buffer-undo-list-mark is deleted and is replaced with a nil, so that things can be further viper-undone.



Hope this helps.
You don't by any chance remember why viper mode appears to turns itself
off in noninteractive mode? Turns out to be rather painful for testing.


I am not sure what you are referring to here.



Phil
Sorry that I don't have much time these days to work on viper.  :-(
Too busy doing all logic and semantics?



Something like that.
Viper is not the only open-source thing out there :-)

--

       --- michael