[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: viper-mode: "r <Return>" does not work as expected

From: Olaf Dietrich
Subject: Re: viper-mode: "r <Return>" does not work as expected
Date: 29 Apr 2005 12:34:04 GMT
User-agent: tin/1.7.9-20050415 ("Hellisay") (UNIX) (Linux/2.6.8.olaf10 (i686))

Olaf Dietrich <address@hidden>:
> Kevin Rodgers <address@hidden>:
>> Olaf Dietrich wrote:
>>> Inserting a new line break in an existing line by "r <Return>"
>>> (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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]