From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jim Meyering Newsgroups: gmane.emacs.bugs Subject: bug#24672: writing a test for Bug#24672 (viper mode malfunction while inserting a paren in continued cpp directive) Date: Tue, 25 Oct 2016 22:09:40 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1477458686 30637 195.159.176.226 (26 Oct 2016 05:11:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Oct 2016 05:11:26 +0000 (UTC) To: emacs-devel , 24672@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 26 07:11:22 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzGUa-000649-BV for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Oct 2016 07:11:12 +0200 Original-Received: from localhost ([::1]:59711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzGUc-0005xv-NZ for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Oct 2016 01:11:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzGUV-0005xE-KG for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 01:11:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzGUQ-0002DL-L9 for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 01:11:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41514) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bzGUQ-0002DD-HU for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 01:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bzGUQ-0004dw-6m for bug-gnu-emacs@gnu.org; Wed, 26 Oct 2016 01:11:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Oct 2016 05:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24672 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24672-submit@debbugs.gnu.org id=B24672.147745860817632 (code B ref 24672); Wed, 26 Oct 2016 05:11:02 +0000 Original-Received: (at 24672) by debbugs.gnu.org; 26 Oct 2016 05:10:08 +0000 Original-Received: from localhost ([127.0.0.1]:56913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzGTY-0004aK-0Z for submit@debbugs.gnu.org; Wed, 26 Oct 2016 01:10:08 -0400 Original-Received: from mail-it0-f67.google.com ([209.85.214.67]:32941) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzGTW-0004Zo-EH for 24672@debbugs.gnu.org; Wed, 26 Oct 2016 01:10:06 -0400 Original-Received: by mail-it0-f67.google.com with SMTP id e187so205425itc.0 for <24672@debbugs.gnu.org>; Tue, 25 Oct 2016 22:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to; bh=eBx8JsoaJVlyG0rxSAfigMaGNAvtuLT/6018hbM0+DE=; b=mYGjfGdzGKKlvPTkYizZffCk718jpdxFyPs/Mr/qXz8gvElQL0j8uQ8NEsHqEWYfdN ze86bH5gK/YdHDHFZYmUbtTG2/a7UTN3aaqsK6y+YvcXkA/LbFaG4GjzvIpVk/eTJ1Ke 5qYgbotlbThAGkGKSvwPqWqrqx4uBKIIWVFvSZRTLSLQlNpljakrCVmvr71TySiDxo4f qKAKgR/TtlT+kbYvLi46VvgQE91+FgKf7NuUYTqEGQG59bGxmmVrIWnKDvvCulETmSpU elFnTrC+31RZf+boi8RqPUrbLHH430wZhKYlWS92wWkmi+niWe57iEJV4P1GgyjsGLof MUbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=eBx8JsoaJVlyG0rxSAfigMaGNAvtuLT/6018hbM0+DE=; b=QA9tUtni8STuoojZvYWhLvj3JalWzt4GHY7EAfgZkXRQKnNc7CX+3g5Mv8APgumeHG mmjBB9Do2C3yLFMXYJcIbf5zGNs08Md+dM9ffrKdPII2JenQ++Z8R2nevG9LzAvr812C LhyDdZcwgUnnJbdpxXpm4WBwNBCIV5/4joxxftyYEz/7UNWapaACXiXxnbSSEGNbU6Sc zjQKft8c9P1Z9ZylfPsxQIhcTe4Mk6p19UlzpZwjZziXviKB1w+vd50NZdOtQOFJOL6s E9C1KB3YYzqicDYD6o6BhEADtGfPVnjd8Sopc2xRKiwILaMVWhdj07d1nEUQBqP8LT28 tscA== X-Gm-Message-State: ABUngveOyA9rqBckwuD3xrvJD1zwegVb3laefDWTK3CqGYQm6yrCk3my8ywUOi73jgfiHPqI2Xsv6/iV9k6XzA== X-Received: by 10.107.132.88 with SMTP id g85mr659124iod.29.1477458600811; Tue, 25 Oct 2016 22:10:00 -0700 (PDT) Original-Received: by 10.107.174.21 with HTTP; Tue, 25 Oct 2016 22:09:40 -0700 (PDT) X-Google-Sender-Auth: xPK-SpbdaWBUDLhqwyyZXIScQSI 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:125027 Archived-At: This is a corner case. When I start in viper mode with this file contents: #define z_b\ and then change the "z" to a parenthesis (either one), I get this: #define (z_b^I^I^I^I^I\$ [I have represented each TAB as "^I", of course] Rather surprising to see all of those TAB characters inserted. To reproduce, run this: mkdir ~/empty && printf '#define z_b\\\n' > k.c \ && HOME=$HOME/empty /bin/emacs -Q -f viper-mode k.c hit "n", "n", and "5" at the successive prompts, then e.g., "fzs(" to perform the change and to see the surprising result. I tried to write a test case to encapsulate the above, but so far have failed, because when run via the test, viper-mode does what one would expect. commit 3309c37d8c42b2fd002b0d965dafc4be3b6d3e44 Author: Jim Meyering Date: Wed Oct 12 08:57:48 2016 -0700 viper-tests.el: add a test for bug #24672 diff --git a/test/lisp/emulation/viper-tests.el b/test/lisp/emulation/viper-tests.el index 2c63b24..85d83aa 100644 --- a/test/lisp/emulation/viper-tests.el +++ b/test/lisp/emulation/viper-tests.el @@ -99,6 +99,19 @@ viper-test-undo-kmacro ] )))) +(ert-deftest viper-test-insert-paren-on-cpp-continued-line() + "Test for bug #24672: +Insert '#define z_b\', then change the 'z' to a parenthesis (open or closed)" + (should + (equal + "#define (_b\\\n" + (viper-test-undo-kmacro + [ + ?i ?# ?d ?e ?f ?i ?n ?e ? ?z ?_ ?b ?\\ escape + ?F ?z ?s ?\( escape + ]) + ))) + (ert-deftest viper-test-undo-2 () "Test for VI like undo behavior. Is there some test set-up I can perform to make that test work like what I outlined above?