aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMichael Kifer <[email protected]>2001-09-09 22:33:38 +0000
committerMichael Kifer <[email protected]>2001-09-09 22:33:38 +0000
commit02f34c7046309acb4772efc0d847a93e752f5b4e (patch)
tree1475778284148b185e5fda55d7e83a86cbbf33f6 /lisp/emulation
parentcfc697a2beffc0b0e50e83609cc86df0ec306330 (diff)
2001-09-09 Michael Kifer <[email protected]>
* ediff-init.el (ediff-highest-priority): bug fix. * viper-cmd.el (viper-special-read-and-insert-char): new function that reads a character and uses the current input method or iso-accents when appropriate. * viper.el and all others: corrections to the comment blocks at the top.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-cmd.el176
-rw-r--r--lisp/emulation/viper-ex.el2
-rw-r--r--lisp/emulation/viper-init.el2
-rw-r--r--lisp/emulation/viper-keym.el2
-rw-r--r--lisp/emulation/viper-macs.el2
-rw-r--r--lisp/emulation/viper-mous.el2
-rw-r--r--lisp/emulation/viper-util.el2
-rw-r--r--lisp/emulation/viper.el8
8 files changed, 131 insertions, 65 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index d457477941..a7bfb3bd2b 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -1,6 +1,9 @@
;;; viper-cmd.el --- Vi command support for Viper
+
;; Copyright (C) 1997 Free Software Foundation, Inc.
+;; Author: Michael Kifer <[email protected]>
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -758,6 +761,81 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
;; set state in the new buffer
(viper-set-mode-vars-for viper-current-state))
+;; This is used in order to allow reading characters according to the input
+;; method. The character is read in emacs and inserted into the buffer.
+;; If an input method is in effect, this might
+;; cause several characters to be combined into one.
+;; Also takes care of the iso-accents mode
+(defun viper-special-read-and-insert-char ()
+ (viper-set-mode-vars-for 'emacs-state)
+ (viper-normalize-minor-mode-map-alist)
+ (if viper-special-input-method
+ (viper-set-input-method t))
+ (if viper-automatic-iso-accents
+ (viper-set-iso-accents-mode t))
+ (condition-case nil
+ (let (viper-vi-kbd-minor-mode
+ viper-insert-kbd-minor-mode
+ viper-emacs-kbd-minor-mode
+ ch)
+ (cond ((and viper-special-input-method
+ viper-emacs-p
+ (fboundp 'quail-input-method))
+ ;; (let ...) is used to restore unread-command-events to the
+ ;; original state. We don't want anything left in there after
+ ;; key translation. (Such left-overs are possible if the user
+ ;; types a regular key.)
+ (let (unread-command-events)
+ ;; The next 2 cmds are intended to prevent the input method
+ ;; from swallowing ^M, ^Q and other special characters
+ (setq ch (read-char))
+ (viper-set-unread-command-events ch)
+ (quail-input-method nil)
+
+ (if (and ch (string= quail-current-str ""))
+ (insert ch)
+ (insert quail-current-str))
+ (setq ch (or ch
+ (aref quail-current-str
+ (1- (length quail-current-str)))))
+ ))
+ ((and viper-special-input-method
+ viper-xemacs-p
+ (fboundp 'quail-start-translation))
+ ;; same as above but for XEmacs, which doesn't have
+ ;; quail-input-method
+ (let (unread-command-events)
+ (setq ch (read-char))
+ (viper-set-unread-command-events ch)
+ (quail-start-translation nil)
+
+ (if (and ch (string= quail-current-str ""))
+ (insert ch)
+ (insert quail-current-str))
+ (setq ch (or ch
+ (aref quail-current-str
+ (1- (length quail-current-str)))))
+ ))
+ ((and (boundp 'iso-accents-mode) iso-accents-mode)
+ (setq ch (aref (read-key-sequence nil) 0))
+ (insert ch))
+ (t
+ (setq ch (read-char))
+ (insert ch))
+ )
+ (setq last-command-event
+ (viper-copy-event (if viper-xemacs-p
+ (character-to-event ch) ch)))
+ ) ; let
+ (error)
+ ) ; condition-case
+
+ (viper-set-input-method nil)
+ (viper-set-iso-accents-mode nil)
+ (viper-set-mode-vars-for viper-current-state)
+ )
+
+
(defun viper-exec-form-in-vi (form)
"Execute FORM in Vi state, regardless of the Ccurrent Vi state."
(let ((buff (current-buffer))
@@ -2064,7 +2142,8 @@ problems."
(interactive "P")
(viper-set-complex-command-for-undo)
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)))
+ ;;(com (viper-getcom arg))
+ )
(viper-set-destructive-command (list 'viper-insert val ?r nil nil nil))
(if (eq viper-intermediate-command 'viper-repeat)
(viper-loop val (viper-yank-last-insertion))
@@ -2075,7 +2154,8 @@ problems."
(interactive "P")
(viper-set-complex-command-for-undo)
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)))
+ ;;(com (viper-getcom arg))
+ )
(viper-set-destructive-command (list 'viper-append val ?r nil nil nil))
(if (not (eolp)) (forward-char))
(if (eq viper-intermediate-command 'viper-repeat)
@@ -2087,7 +2167,8 @@ problems."
(interactive "P")
(viper-set-complex-command-for-undo)
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)))
+ ;;(com (viper-getcom arg))
+ )
(viper-set-destructive-command (list 'viper-Append val ?r nil nil nil))
(end-of-line)
(if (eq viper-intermediate-command 'viper-repeat)
@@ -2099,7 +2180,8 @@ problems."
(interactive "P")
(viper-set-complex-command-for-undo)
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)))
+ ;;(com (viper-getcom arg))
+ )
(viper-set-destructive-command (list 'viper-Insert val ?r nil nil nil))
(back-to-indentation)
(if (eq viper-intermediate-command 'viper-repeat)
@@ -2111,7 +2193,8 @@ problems."
(interactive "P")
(viper-set-complex-command-for-undo)
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)))
+ ;;(com (viper-getcom arg))
+ )
(viper-set-destructive-command (list 'viper-open-line val ?r nil nil nil))
(let ((col (current-indentation)))
(if (eq viper-intermediate-command 'viper-repeat)
@@ -2130,7 +2213,8 @@ problems."
(interactive "P")
(viper-set-complex-command-for-undo)
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)))
+ ;;(com (viper-getcom arg))
+ )
(viper-set-destructive-command (list 'viper-Open-line val ?r nil nil nil))
(let ((col (current-indentation)))
(if (eq viper-intermediate-command 'viper-repeat)
@@ -2149,7 +2233,8 @@ problems."
(interactive "P")
(viper-set-complex-command-for-undo)
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)))
+ ;;(com (viper-getcom arg))
+ )
(viper-set-destructive-command
(list 'viper-open-line-at-point val ?r nil nil nil))
(if (eq viper-intermediate-command 'viper-repeat)
@@ -2164,7 +2249,8 @@ problems."
"Substitute characters."
(interactive "P")
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)))
+ ;;(com (viper-getcom arg))
+ )
(push-mark nil t)
(forward-char val)
(if (eq viper-intermediate-command 'viper-repeat)
@@ -2389,7 +2475,8 @@ These keys are ESC, RET, and LineFeed"
"Begin overwrite mode."
(interactive "P")
(let ((val (viper-p-val arg))
- (com (viper-getcom arg)) (len))
+ ;;(com (viper-getcom arg))
+ (len))
(viper-set-destructive-command (list 'viper-overwrite val ?r nil nil nil))
(if (eq viper-intermediate-command 'viper-repeat)
(progn
@@ -2461,60 +2548,27 @@ These keys are ESC, RET, and LineFeed"
))
(defun viper-replace-char-subr (com arg)
- (let (char)
- (setq char (if (eq viper-intermediate-command 'viper-repeat)
- viper-d-char
- (read-char)))
- (let (inhibit-quit) ; preserve consistency of undo-list and iso-accents
- (if (and viper-automatic-iso-accents
- (viper-memq-char char '(?' ?\" ?^ ?~)))
- ;; get European characters
- (progn
- (viper-set-iso-accents-mode t)
- (viper-set-unread-command-events char)
- (setq char (aref (read-key-sequence nil) 0))
- (viper-set-iso-accents-mode nil)))
- (viper-set-complex-command-for-undo)
+ (let (char inhibit-quit)
+ (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))
- (if (and viper-special-input-method (fboundp 'quail-start-translation))
- ;; get Intl. characters
- (progn
- (viper-set-input-method t)
- (setq last-command-event
- (viper-copy-event
- (if viper-xemacs-p (character-to-event char) char)))
- (delete-char 1 t)
- (condition-case nil
- (if com
- (insert char)
- (if viper-emacs-p
- (quail-start-translation 1)
- (quail-start-translation)))
- (error))
- ;; quail translation failed
- (if (and (not (stringp quail-current-str))
- (not (viper-characterp quail-current-str)))
- (progn
- (viper-adjust-undo)
- (undo-start)
- (undo-more 1)
- (viper-set-input-method nil)
- (error "Composing character failed, changes undone")))
- ;; quail translation seems ok
- (or com
- ;;(setq char quail-current-str))
- (setq char (viper-char-at-pos 'backward)))
- (setq viper-d-char char)
- (viper-loop (1- (if (> arg 0) arg (- arg)))
- (delete-char 1 t)
- (insert char))
- (viper-set-input-method nil))
- (delete-char arg t)
- (setq viper-d-char char)
- (viper-loop (if (> arg 0) arg (- arg))
- (insert char)))
+
+ (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))))
+ (backward-char arg)
+ ))
;; basic cursor movement. j, k, l, h commands.
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index 398e5a937c..1ae136a067 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -2,6 +2,8 @@
;; Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+;; Author: Michael Kifer <[email protected]>
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 0ed9a63247..8f0b99f297 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -2,6 +2,8 @@
;; Copyright (C) 1997 Free Software Foundation, Inc.
+;; Author: Michael Kifer <[email protected]>
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el
index 73155a0579..cad5f34389 100644
--- a/lisp/emulation/viper-keym.el
+++ b/lisp/emulation/viper-keym.el
@@ -2,6 +2,8 @@
;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Author: Michael Kifer <[email protected]>
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index 4eaf843f27..f438dc0613 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -2,6 +2,8 @@
;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Author: Michael Kifer <[email protected]>
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el
index b603665685..cb9ad3ee8d 100644
--- a/lisp/emulation/viper-mous.el
+++ b/lisp/emulation/viper-mous.el
@@ -2,6 +2,8 @@
;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Author: Michael Kifer <[email protected]>
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index f5d4eb355a..ab63232d84 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -2,6 +2,8 @@
;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Author: Michael Kifer <[email protected]>
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 277ae0c408..416c6236be 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -2,13 +2,13 @@
;; a VI Plan for Emacs Rescue,
;; and a venomous VI PERil.
;; Viper Is also a Package for Emacs Rebels.
-;;
-;; Keywords: emulations
-;; Author: Michael Kifer <[email protected]>
;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01 Free Software Foundation, Inc.
-(defconst viper-version "3.11 of July 18, 2001"
+;; Author: Michael Kifer <[email protected]>
+;; Keywords: emulations
+
+(defconst viper-version "3.11.1 of September 9, 2001"
"The current version of Viper")
;; This file is part of GNU Emacs.