* bug#24672: 26.0.50; viper-mode + c-mode: "ce" fails in cpp-continued stmt
@ 2016-10-12 3:59 Jim Meyering
2016-10-26 5:09 ` bug#24672: writing a test for Bug#24672 (viper mode malfunction while inserting a paren in continued cpp directive) Jim Meyering
0 siblings, 1 reply; 2+ messages in thread
From: Jim Meyering @ 2016-10-12 3:59 UTC (permalink / raw)
To: 24672
This is with an emacs binary I built from "master" yesterday.
Reproduce with this:
printf '%s\n' '#define abcde \\' x > k.c; emacs -q -f viper-mode k.c
Then, hit "n" at the viperize prompt and you'll see this
on the first line:
#define abcde \
Hit "W" to move the cursor to the "a". Then type "ce(" to
change the 5-byte "abcde" to a "(". I was surprised to see
the "abcde" still there, and an additional backslash appended:
#define (abcde \ \
I expected to see this:
#define ( \
In GNU Emacs 26.0.50.1 (x86_64-unknown-linux-gnu)
of 2016-10-10 built on hx.meyering.net
Repository revision: 8b1be820ce02379c9ebd124703e04eee65779662
Configured using:
'configure --prefix=/p/p/emacs-2016-10-10.08h35 --without-gpm
--without-x --with-x-toolkit=no --with-png=no --with-jpeg=no
--with-sound=no'
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#24672: writing a test for Bug#24672 (viper mode malfunction while inserting a paren in continued cpp directive)
2016-10-12 3:59 bug#24672: 26.0.50; viper-mode + c-mode: "ce" fails in cpp-continued stmt Jim Meyering
@ 2016-10-26 5:09 ` Jim Meyering
0 siblings, 0 replies; 2+ messages in thread
From: Jim Meyering @ 2016-10-26 5:09 UTC (permalink / raw)
To: emacs-devel, 24672
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 <meyering@fb.com>
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?
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-26 5:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-12 3:59 bug#24672: 26.0.50; viper-mode + c-mode: "ce" fails in cpp-continued stmt Jim Meyering
2016-10-26 5:09 ` bug#24672: writing a test for Bug#24672 (viper mode malfunction while inserting a paren in continued cpp directive) Jim Meyering
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).