From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: odt@dtrx.de (Olaf Dietrich) Newsgroups: gmane.emacs.help Subject: Re: viper-mode: "r " does not work as expected Date: 29 Apr 2005 12:34:04 GMT Organization: -- Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1114777816 9840 80.91.229.2 (29 Apr 2005 12:30:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Apr 2005 12:30:16 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 29 14:30:11 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DRUcn-0004ja-K5 for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Apr 2005 14:29:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DRUj7-0000cg-Nm for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Apr 2005 08:36:13 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!informatik.tu-muenchen.de!lrz.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Original-NNTP-Posting-Host: hydra1.fw.med.uni-muenchen.de Original-X-Trace: wsc10.lrz-muenchen.de 1114778044 19088 138.245.10.1 (29 Apr 2005 12:34:04 GMT) Original-X-Complaints-To: news@lrz-muenchen.de Original-NNTP-Posting-Date: 29 Apr 2005 12:34:04 GMT User-Agent: tin/1.7.9-20050415 ("Hellisay") (UNIX) (Linux/2.6.8.olaf10 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:130563 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:26135 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26135 Olaf Dietrich : > Kevin Rodgers : >> Olaf Dietrich wrote: >>> >>> 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 version of viper-cmd.el distributed with Emacs 21.3 has this snippet >> in the viper-replace-char-subr function: >> >> (if (eq char ?\C-m) (setq char ?\n)) > > This line is in my viper-cmd.el as well: I've just played a little bit with viper-cmd.el; the original function is | (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) | )) Since I have never work with (emacs) lisp before, I don't know whether my attempts made any sense, but if I (simple enough) changed e.g. "(delete-char 1 t)" to "(delete-char 3 t)" than 3 instead of 1 character were replaced by a single new one. But I wasn't able to find out whether the line | (if (eq char ?\C-m) (setq char ?\n)) is executed at all. Adding something like "(insert ?A)" inserted an additional "A", but I wasn't able to change char by e.g. "(setq char ?A)". Any ideas what to try next? Olaf