From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Olaf Dietrich Newsgroups: gmane.emacs.bugs Subject: viper-mode: viper-replace-char-subr Date: Mon, 02 May 2005 09:36:57 +0200 Message-ID: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1115065412 17163 80.91.229.2 (2 May 2005 20:23:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 2 May 2005 20:23:32 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 02 22:23:27 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DShRJ-0006sl-Bi for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 May 2005 22:22:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DShXx-0002j4-Oi for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 May 2005 16:29:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DSfkB-0006eE-O4 for bug-gnu-emacs@gnu.org; Mon, 02 May 2005 14:34:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DSfk8-0006dh-PY for bug-gnu-emacs@gnu.org; Mon, 02 May 2005 14:34:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DSfib-0005vu-HX for bug-gnu-emacs@gnu.org; Mon, 02 May 2005 14:32:33 -0400 Original-Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_ARCFOUR_SHA:16) (Exim 4.34) id 1DSeuo-0002HE-IX for bug-gnu-emacs@gnu.org; Mon, 02 May 2005 13:41:06 -0400 Original-Received: from [138.245.10.1] (helo=mailout.med.uni-muenchen.de) by mx20.gnu.org with esmtp (Exim 4.34) id 1DSVUo-0005hb-8R for bug-gnu-emacs@gnu.org; Mon, 02 May 2005 03:37:38 -0400 Original-Received: from OITZ2N.helios.med.uni-muenchen.de (unknown [192.168.79.231]) by mailout.med.uni-muenchen.de (Postfix) with ESMTP id 7763C23127; Mon, 2 May 2005 09:36:10 +0200 (CEST) Original-Received: from gracvn.ikra.med.uni-muenchen.de ([172.16.33.20]) by OITZ2N.helios.med.uni-muenchen.de with Microsoft SMTPSVC(5.0.2195.6713); Mon, 2 May 2005 09:36:10 +0200 Original-Received: from olaf by gracvn.ikra.med.uni-muenchen.de with local (Exim 4.50) id 1DSVU9-0000wJ-4Q; Mon, 02 May 2005 09:36:57 +0200 Original-To: bug-gnu-emacs@gnu.org X-OriginalArrivalTime: 02 May 2005 07:36:10.0229 (UTC) FILETIME=[9C0BC250:01C54EE9] X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:11277 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:11277 This bug report will be sent to the Free Software Foundation, not to your local site managers! Please write in English, because the Emacs maintainers do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list, and to the gnu.emacs.bug news group. In GNU Emacs 21.4.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2005-04-20 on gracvn configured using `configure --prefix=/var/autofs/misc/apps/DIR/emacs-21.4' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: C locale-coding-system: nil default-enable-multibyte-characters: t Please describe exactly what actions triggered the bug and the precise symptoms of the bug: This may be a bug of viper-mode: Inserting a new line break in an existing line by "r " (more exactly: replacing the current character by a newline) does not work; instead, '^M' appears as replacement text. (The alternative "r C-j" _does_ work, but is not what my fingers are used to do in vi.) It seems that the function | (defun viper-replace-char-subr (com arg) | (let ((inhibit-quit t) | char) | (viper-set-complex-command-for-undo) | (or (eq viper-intermediate-command 'viper-repeat) | (viper-special-read-and-insert-char)) | | (if (eq char ?\C-m) (setq char ?\n)) | | (delete-char 1 t) | | (setq char (if com viper-d-char (viper-char-at-pos 'backward))) | (if com (insert char)) | | (setq viper-d-char char) | | (viper-loop (1- (if (> arg 0) arg (- arg))) | (delete-char 1 t) | (insert char)) | | (viper-adjust-undo) | (backward-char arg) | )) should avoid this, see in particular the line | (if (eq char ?\C-m) (setq char ?\n)) but this doesn't work. In a Usenet discussion (e.g., Message-ID: and ) in gnu.emacs.help, Kevin Rodgers remarked about this: : The first problem is that the (if (eq char ?\C-m) (setq char ?\n)) form : occurs before char has been set. The second problem is that when that : form is evaluated and char is reset, it has already been inserted; but : no attempt is made to undo that and re-insert the proper newline : character. Olaf Recent input: Recent messages: (emacs /var/autofs/misc/apps/DIR/emacs-21.4/share/emacs/21.4/lisp/emulation/viper-cmd.el) Loading disp-table...done Loading tool-bar...done Loading image...done Loading tooltip...done For information about the GNU Project and its goals, type C-h C-p. Loading emacsbug...done Loading view...done