unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: odt@dtrx.de (Olaf Dietrich)
Subject: Re: viper-mode: "r <Return>" does not work as expected
Date: 6 May 2005 07:27:15 GMT	[thread overview]
Message-ID: <d5f68j$9tc$1@wsc10.lrz-muenchen.de> (raw)
In-Reply-To: d4q3ib$1s7$1@wsc10.lrz-muenchen.de

Olaf Dietrich <odt@dtrx.de>:
> 
> 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.

By comparing the current CVS version of viper (viper-version "3.11.4
of February 19, 2005") to the one distributed with Emacs 21.4.1
(viper-version "3.11.1 of September 9, 2001"), I found the following
patch for viper-cmd.el the makes "r <Return>" work (only the fourth
insertion seems to be necessary to remove the described problem,
but all four seem to deal with similar ^M stuff).

Thanks to Kevin Rodgers and to Michael Kifer for their help,
Olaf


(crossposted to gnu.emacs.help and comp.emacs;
followups to: gnu.emacs.help;
and apologies in advance if a former version of this post (stupidly
cross-posted to a moderated group) should pop up here)


--- emacs-21.4/lisp/emulation/viper-cmd.el	2002-06-10 15:05:03.000000000 +0200
+++ viper-cmd.el	2005-05-03 10:22:57.860007000 +0200
@@ -789,6 +789,13 @@
 		 ;; The next 2 cmds are intended to prevent the input method
 		 ;; from swallowing ^M, ^Q and other special characters
 		 (setq ch (read-char))
+;; start copy from viper 3.11.4 (2005-02-19)
+		 ;; replace ^M with the newline
+		 (if (eq ch ?\C-m) (setq ch ?\n))
+		 ;; Make sure ^V and ^Q work as quotation chars
+		 (if (memq ch '(?\C-v ?\C-q))
+		     (setq ch (read-char)))
+;; end copy from viper 3.11.4 (2005-02-19)
 		 (viper-set-unread-command-events ch)
 		 (quail-input-method nil)
 
@@ -806,6 +813,13 @@
 	       ;; quail-input-method
 	       (let (unread-command-events)
 		 (setq ch (read-char))
+;; start copy from viper 3.11.4 (2005-02-19)
+		 ;; replace ^M with the newline
+		 (if (eq ch ?\C-m) (setq ch ?\n))
+		 ;; Make sure ^V and ^Q work as quotation chars
+		 (if (memq ch '(?\C-v ?\C-q))
+		     (setq ch (read-char)))
+;; end copy from viper 3.11.4 (2005-02-19)
 		 (viper-set-unread-command-events ch)
 		 (quail-start-translation nil)
 
@@ -818,9 +832,24 @@
 		 ))
 	      ((and (boundp 'iso-accents-mode) iso-accents-mode)
 	       (setq ch (aref (read-key-sequence nil) 0))
+;; start copy from viper 3.11.4 (2005-02-19)
+	       ;; replace ^M with the newline
+	       (if (eq ch ?\C-m) (setq ch ?\n))
+	       ;; Make sure ^V and ^Q work as quotation chars
+	       (if (memq ch '(?\C-v ?\C-q))
+		   (setq ch (aref (read-key-sequence nil) 0)))
+;; end copy from viper 3.11.4 (2005-02-19)
 	       (insert ch))
 	      (t
 	       (setq ch (read-char))
+;; the following 7 lines make "r <Ret>" work as expected
+;; start copy from viper 3.11.4 (2005-02-19)
+	       ;; replace ^M with the newline
+	       (if (eq ch ?\C-m) (setq ch ?\n))
+	       ;; Make sure ^V and ^Q work as quotation chars
+	       (if (memq ch '(?\C-v ?\C-q))
+		   (setq ch (read-char)))
+;; end copy from viper 3.11.4 (2005-02-19)
 	       (insert ch))
 	      )
 	(setq last-command-event
@@ -2554,7 +2583,9 @@
     (or (eq viper-intermediate-command 'viper-repeat)
 	(viper-special-read-and-insert-char))
 
-      (if (eq char ?\C-m) (setq char ?\n))
+;; start copy from viper 3.11.4 (2005-02-19)
+;;      (if (eq char ?\C-m) (setq char ?\n))
+;; end copy from viper 3.11.4 (2005-02-19)
 
       (delete-char 1 t)

      parent reply	other threads:[~2005-05-06  7:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d4861u$28v$1@wsc10.lrz-muenchen.de>
2005-04-28  7:32 ` viper-mode: "r <Return>" does not work as expected Olaf Dietrich
2005-04-28 18:44   ` Kevin Rodgers
     [not found]   ` <mailman.3342.1114714165.2895.help-gnu-emacs@gnu.org>
2005-04-29  7:28     ` Olaf Dietrich
2005-04-29 12:34       ` Olaf Dietrich
2005-04-29 18:55         ` Kevin Rodgers
2005-05-06  7:27   ` Olaf Dietrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='d5f68j$9tc$1@wsc10.lrz-muenchen.de' \
    --to=odt@dtrx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).