[Top][All Lists]

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

viper-mode: viper-replace-char-subr

From: Olaf Dietrich
Subject: viper-mode: viper-replace-char-subr
Date: Mon, 02 May 2005 09:36:57 +0200

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 address@hidden 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 <Return>"
(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: <address@hidden>
and <address@hidden>)
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.


Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <menu-bar> <help-menu> <report-emacs-bug>

Recent messages:
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

reply via email to

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