changeset 20343:4327dd36b71b

new version
author Michael Kifer <kifer@cs.stonybrook.edu>
date Tue, 25 Nov 1997 02:10:08 +0000
parents 3739e4f90a55
children 229f31952731
files lisp/ediff-diff.el lisp/ediff-init.el lisp/ediff-mult.el lisp/ediff-vers.el lisp/emulation/viper-cmd.el lisp/emulation/viper-ex.el lisp/emulation/viper.el
diffstat 7 files changed, 197 insertions(+), 125 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ediff-diff.el	Mon Nov 24 20:16:20 1997 +0000
+++ b/lisp/ediff-diff.el	Tue Nov 25 02:10:08 1997 +0000
@@ -133,14 +133,24 @@
 ;;; General
 
 (defvar ediff-diff-ok-lines-regexp  
-  "^\\([0-9,]+[acd][0-9,]+$\\|[<>] \\|---\\|.*Warning *:\\|.*No +newline\\|.*missing +newline\\|^\C-m$\\)"
+  (concat
+   "^\\("
+   "[0-9,]+[acd][0-9,]+\C-m?$"
+   "\\|[<>] "
+   "\\|---"
+   "\\|.*Warning *:"
+   "\\|.*No +newline"
+   "\\|.*missing +newline"
+   "\\|^\C-m?$"
+   "\\)")
   "Regexp that matches normal output lines from `ediff-diff-program'.
 This is mostly lifted from Emerge, except that Ediff also considers
 warnings and `Missing newline'-type messages to be normal output.
 Lines that do not match are assumed to be error messages.")
 
-(defvar ediff-match-diff-line (let ((x "\\([0-9]+\\)\\(\\|,\\([0-9]+\\)\\)"))
-				(concat "^" x "\\([acd]\\)" x "$"))
+(defvar ediff-match-diff-line
+  (let ((x "\\([0-9]+\\)\\(\\|,\\([0-9]+\\)\\)"))
+    (concat "^" x "\\([acd]\\)" x "\C-m?$"))
   "Pattern to match lines produced by diff that describe differences.")
 
 (ediff-defvar-local ediff-setup-diff-regions-function nil
--- a/lisp/ediff-init.el	Mon Nov 24 20:16:20 1997 +0000
+++ b/lisp/ediff-init.el	Tue Nov 25 02:10:08 1997 +0000
@@ -1048,12 +1048,13 @@
 widget to customize the actual face object `ediff-fine-diff-face-A'
 this variable represents.")
 (ediff-hide-face 'ediff-fine-diff-face-A)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-fine-diff-face-A "gray3"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-fine-diff-face-A "gray3"))
 
 ;;(defvar ediff-fine-diff-face-B
 ;;  (if (ediff-has-face-support-p)
@@ -1084,12 +1085,13 @@
 widget to customize the actual face object `ediff-fine-diff-face-B'
 this variable represents.")
 (ediff-hide-face 'ediff-fine-diff-face-B)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-fine-diff-face-B "gray3"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-fine-diff-face-B "gray3"))
     
 ;;(defvar ediff-fine-diff-face-C
 ;;  (if (ediff-has-face-support-p)
@@ -1121,12 +1123,13 @@
 widget to customize the actual face object `ediff-fine-diff-face-C'
 this variable represents.")
 (ediff-hide-face 'ediff-fine-diff-face-C)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-fine-diff-face-C "gray3"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-fine-diff-face-C "gray3"))
 
 ;;(defvar ediff-fine-diff-face-Ancestor
 ;;  (if (ediff-has-face-support-p)
@@ -1159,13 +1162,13 @@
 widget to customize the actual face object `ediff-fine-diff-face-Ancestor'
 this variable represents.")
 (ediff-hide-face 'ediff-fine-diff-face-Ancestor)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap
-     'ediff-fine-diff-face-Ancestor "gray3"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-fine-diff-face-Ancestor "gray3"))
     
 ;;(defvar ediff-even-diff-face-A
 ;;  (if (ediff-has-face-support-p)
@@ -1198,12 +1201,13 @@
 widget to customize the actual face object `ediff-even-diff-face-A'
 this variable represents.")
 (ediff-hide-face 'ediff-even-diff-face-A)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-even-diff-face-A "Stipple"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-even-diff-face-A "Stipple"))
       
 ;;(defvar ediff-even-diff-face-B
 ;;  (if (ediff-has-face-support-p)
@@ -1236,12 +1240,13 @@
 widget to customize the actual face object `ediff-even-diff-face-B'
 this variable represents.")
 (ediff-hide-face 'ediff-even-diff-face-B)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-even-diff-face-B "Stipple"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-even-diff-face-B "Stipple"))
     
 ;;(defvar ediff-even-diff-face-C
 ;;  (if (ediff-has-face-support-p)
@@ -1269,12 +1274,13 @@
 widget to customize the actual face object `ediff-even-diff-face-C'
 this variable represents.")
 (ediff-hide-face 'ediff-even-diff-face-C)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-even-diff-face-C "Stipple"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-even-diff-face-C "Stipple"))
 
 ;;(defvar ediff-even-diff-face-Ancestor
 ;;  (if (ediff-has-face-support-p)
@@ -1303,13 +1309,13 @@
 widget to customize the actual face object `ediff-even-diff-face-Ancestor'
 this variable represents.")
 (ediff-hide-face 'ediff-even-diff-face-Ancestor)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap
-     'ediff-even-diff-face-Ancestor "Stipple"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-even-diff-face-Ancestor "Stipple"))
 
 ;; Association between buffer types and even-diff-face symbols
 (defconst ediff-even-diff-face-alist
@@ -1349,12 +1355,13 @@
 widget to customize the actual face object `ediff-odd-diff-face-A'
 this variable represents.")
 (ediff-hide-face 'ediff-odd-diff-face-A)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-odd-diff-face-A "gray1"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-odd-diff-face-A "gray1"))
       
 ;;(defvar ediff-odd-diff-face-B
 ;;  (if (ediff-has-face-support-p)
@@ -1388,12 +1395,13 @@
 widget to customize the actual face object `ediff-odd-diff-face-B'
 this variable represents.")
 (ediff-hide-face 'ediff-odd-diff-face-B)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-odd-diff-face-B "gray1"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-odd-diff-face-B "gray1"))
     
 ;;(defvar ediff-odd-diff-face-C
 ;;  (if (ediff-has-face-support-p)
@@ -1420,12 +1428,13 @@
 widget to customize the actual face object `ediff-odd-diff-face-C'
 this variable represents.")
 (ediff-hide-face 'ediff-odd-diff-face-C)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-odd-diff-face-C "gray1"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-odd-diff-face-C "gray1"))
 
 ;;(defvar ediff-odd-diff-face-Ancestor 
 ;;  (if (ediff-has-face-support-p)
@@ -1452,12 +1461,13 @@
 widget to customize the actual face object `ediff-odd-diff-face-Ancestor'
 this variable represents.")
 (ediff-hide-face 'ediff-odd-diff-face-Ancestor)
-;; Until custom.el for XEmacs starts supporting :stipple we do this.
-;; This means that some use customization may be trashed.
-(if (and ediff-xemacs-p
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p))) 
-    (ediff-set-face-pixmap 'ediff-odd-diff-face-Ancestor "gray1"))
+
+;;;; Until custom.el for XEmacs starts supporting :stipple we do this.
+;;;; This means that some user customization may be trashed.
+;;(if (and ediff-xemacs-p
+;;	 (ediff-has-face-support-p)
+;;	 (not (ediff-color-display-p))) 
+;;    (ediff-set-face-pixmap 'ediff-odd-diff-face-Ancestor "gray1"))
 
 ;; Association between buffer types and odd-diff-face symbols
 (defconst ediff-odd-diff-face-alist
--- a/lisp/ediff-mult.el	Mon Nov 24 20:16:20 1997 +0000
+++ b/lisp/ediff-mult.el	Tue Nov 25 02:10:08 1997 +0000
@@ -1456,7 +1456,7 @@
 	 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid
 	 (info (ediff-get-meta-info meta-buf pos))
 	 (session-buf (ediff-get-session-buffer info))
-	 (session-number (ediff-get-session-number-at-pos pos))
+	 (session-number (ediff-get-session-number-at-pos pos meta-buf))
 	 merge-autostore-dir file1 file2 file3 regexp)
 
     (setq file1 (ediff-get-session-objA-name info)
@@ -1897,9 +1897,13 @@
 	      overl (car overl-list)))
       overl)))
 
-(defsubst ediff-get-session-number-at-pos (point)
-  (ediff-overlay-get
-   (ediff-get-meta-overlay-at-pos point) 'ediff-meta-session-number))
+(defsubst ediff-get-session-number-at-pos (point &optional meta-buffer)
+  (setq meta-buffer (if (ediff-buffer-live-p meta-buffer)
+			meta-buffer
+		      (current-buffer)))
+  (ediff-with-current-buffer meta-buffer
+    (ediff-overlay-get
+     (ediff-get-meta-overlay-at-pos point) 'ediff-meta-session-number)))
 
 
 ;; Return location of the next meta overlay after point
--- a/lisp/ediff-vers.el	Mon Nov 24 20:16:20 1997 +0000
+++ b/lisp/ediff-vers.el	Tue Nov 25 02:10:08 1997 +0000
@@ -337,6 +337,8 @@
 	 (type (cvs-fileinfo->type fileinfo))
 	 (tmp-file
 	  (cvs-retrieve-revision-to-tmpfile fileinfo))
+	 (default-directory
+ 	   (file-name-as-directory (cvs-fileinfo->dir fileinfo)))
 	 ancestor-file)
     
     (or (memq type '(MERGED CONFLICT MODIFIED))
@@ -356,11 +358,11 @@
 	    nil ; startup-hooks
 	    'ediff-merge-revisions-with-ancestor))
 	  ((eq type 'MODIFIED)
-	   (ediff-merge-buffers
+	   (ediff-buffers
 	    (find-file-noselect tmp-file)
 	    (find-file-noselect (cvs-fileinfo->full-path fileinfo))
 	    nil ; startup-hooks
-	    'ediff-merge-revisions)))
+	    'ediff-revisions)))
     (if (stringp tmp-file) (delete-file tmp-file))
     (if (stringp ancestor-file) (delete-file ancestor-file))))
 
--- a/lisp/emulation/viper-cmd.el	Mon Nov 24 20:16:20 1997 +0000
+++ b/lisp/emulation/viper-cmd.el	Tue Nov 25 02:10:08 1997 +0000
@@ -1720,21 +1720,32 @@
 
 ;; Quote region by each line with a user supplied string.
 (defun viper-quote-region ()
-  (setq viper-quote-string
-	(viper-read-string-with-history
-	 "Quote string: "
-	 nil
-	 'viper-quote-region-history
-	 viper-quote-string))
-  (viper-enlarge-region (point) (mark t))
-  (if (> (point) (mark t)) (exchange-point-and-mark))
-  (insert viper-quote-string)
-  (beginning-of-line)
-  (forward-line 1)
-  (while (and (< (point) (mark t)) (bolp))
-    (insert viper-quote-string)
+  (let ((quote-str viper-quote-string)
+	(donot-change-dafault t))
+    (setq quote-str
+	  (viper-read-string-with-history
+	   "Quote string: "
+	   nil
+	   'viper-quote-region-history
+	   (cond ((string-match "tex.*-mode" (symbol-name major-mode)) "%%")
+		 ((string-match "java.*-mode" (symbol-name major-mode)) "//")
+		 ((string-match "perl.*-mode" (symbol-name major-mode)) "#")
+		 ((string-match "lisp.*-mode" (symbol-name major-mode)) ";;")
+		 ((memq major-mode '(c-mode cc-mode c++-mode)) "//")
+		 ((memq major-mode '(sh-mode shell-mode)) "#")
+		 (t (setq donot-change-dafault nil)
+		    quote-str))))
+    (or donot-change-dafault
+	(setq viper-quote-string quote-str))
+    (viper-enlarge-region (point) (mark t))
+    (if (> (point) (mark t)) (exchange-point-and-mark))
+    (insert quote-str)
     (beginning-of-line)
-    (forward-line 1)))
+    (forward-line 1)
+    (while (and (< (point) (mark t)) (bolp))
+      (insert quote-str)
+      (beginning-of-line)
+      (forward-line 1))))
 
 ;;  Tells whether BEG is on the same line as END.
 ;;  If one of the args is nil, it'll return nil.
@@ -1870,15 +1881,21 @@
 ;;; Reading string with history  
     
 (defun viper-read-string-with-history (prompt &optional initial 
-					    history-var default keymap)
+					      history-var default keymap
+					      init-message)
   ;; Read string, prompting with PROMPT and inserting the INITIAL
   ;; value. Uses HISTORY-VAR. DEFAULT is the default value to accept if the
-  ;; input is an empty string. Use KEYMAP, if given, or the
-  ;; minibuffer-local-map.
+  ;; input is an empty string.
   ;; Default value is displayed until the user types something in the
   ;; minibuffer. 
+  ;; KEYMAP is used, if given, instead of minibuffer-local-map.
+  ;; INIT-MESSAGE is the message temporarily displayed after entering the
+  ;; minibuffer.
   (let ((minibuffer-setup-hook 
-	 '(lambda ()
+	 (function
+	  (lambda ()
+	    (if (stringp init-message)
+		(viper-tmp-insert-at-eob init-message))
 	    (if (stringp initial)
 		(progn
 		  ;; don't wait if we have unread events or in kbd macro
@@ -1887,7 +1904,7 @@
 		      (sit-for 840))
 		  (erase-buffer)
 		  (insert initial)))
-	    (viper-minibuffer-setup-sentinel)))
+	    (viper-minibuffer-setup-sentinel))))
 	(val "")
 	(padding "")
 	temp-msg)
--- a/lisp/emulation/viper-ex.el	Mon Nov 24 20:16:20 1997 +0000
+++ b/lisp/emulation/viper-ex.el	Tue Nov 25 02:10:08 1997 +0000
@@ -524,8 +524,8 @@
     
 
 ;; Read Ex commands 
-(defun viper-ex (&optional string)
-  (interactive)
+(defun viper-ex (arg &optional string)
+  (interactive "P")
   (or string
       (setq ex-g-flag nil
 	    ex-g-variant nil))
@@ -533,16 +533,40 @@
 	 (address nil)
 	 (cont t)
 	 (dot (point))
+	 reg-beg-line reg-end-line
+	 reg-beg reg-end
+	 initial-str
 	 prev-token-type com-str)
-	 
     (viper-add-keymap viper-ex-cmd-map map)
+
+    (if arg
+	(progn
+	  (viper-enlarge-region (mark t) (point))
+	  (if (> (point) (mark t))
+	      (setq reg-beg (mark t)
+		    reg-end (point))
+	    (setq reg-end (mark t)
+		  reg-beg (point)))
+	  (save-excursion
+	    (goto-char reg-beg)
+	    (setq reg-beg-line (1+ (count-lines (point-min) (point)))
+		  reg-end-line
+		  (+ reg-beg-line (count-lines reg-beg reg-end) -1)))))
+    (if reg-beg-line
+	(setq initial-str (format "%d,%d" reg-beg-line reg-end-line)))
     
-    (setq com-str (or string (viper-read-string-with-history
-			      ":" 
-			      nil
-			      'viper-ex-history
-			      (car viper-ex-history)
-			      map)))
+    (setq com-str 
+	  (or string (viper-read-string-with-history
+		      ":" 
+		      initial-str
+		      'viper-ex-history
+		      ;; no default when working on region
+		      (if initial-str
+			  "none"
+			(car viper-ex-history))
+		      map
+		      (if initial-str
+			  " [Type command to execute on current region]"))))
     (save-window-excursion
       ;; just a precaution
       (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) 
--- a/lisp/emulation/viper.el	Mon Nov 24 20:16:20 1997 +0000
+++ b/lisp/emulation/viper.el	Tue Nov 25 02:10:08 1997 +0000
@@ -8,7 +8,7 @@
 
 ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
-(defconst viper-version "3.002 (Polyglot) of October 23, 1997"
+(defconst viper-version "3.004 (Polyglot) of November 11, 1997"
   "The current version of Viper")
 
 ;; This file is part of GNU Emacs.
@@ -531,7 +531,7 @@
    (viper-standard-value
     'mode-line-buffer-identification viper-saved-non-viper-variables)
    global-mode-string
-   (viper-standard-value 'global-mode-string viper-saved-non-viper-variables))
+   (delq 'viper-mode-string global-mode-string))
 
   (if viper-emacs-p
       (setq-default
@@ -576,6 +576,9 @@
   (viper-delocalize-var 'viper-emacs-global-user-minor-mode)
   (viper-delocalize-var 'viper-emacs-state-modifier-minor-mode)
 
+  (viper-delocalize-var 'viper-current-state)
+  (viper-delocalize-var 'viper-mode-string)
+
   (setq-default viper-vi-minibuffer-minor-mode	       nil
 		viper-insert-minibuffer-minor-mode     nil
 		viper-vi-intercept-minor-mode	       nil
@@ -602,6 +605,9 @@
 		viper-emacs-kbd-minor-mode             nil
 		viper-emacs-global-user-minor-mode     nil
 		viper-emacs-state-modifier-minor-mode  nil
+
+		viper-current-state		       'emacs-state
+		viper-mode-string		       viper-emacs-state-id
 		)
 
   ;; remove all hooks set by viper
@@ -1218,18 +1224,17 @@
   viper-insert-intercept-map "\C-c\\" 'viper-escape-to-vi)
 
 (if viper-mode
-    (progn
-      (setq viper-emacs-intercept-minor-mode t
-	    viper-emacs-local-user-minor-mode t
-	    viper-emacs-global-user-minor-mode t
-	    viper-emacs-kbd-minor-mode t
-	    viper-emacs-state-modifier-minor-mode t)
-      (setq-default viper-emacs-intercept-minor-mode t
-		    viper-emacs-local-user-minor-mode t
-		    viper-emacs-global-user-minor-mode t
-		    viper-emacs-kbd-minor-mode t
-		    viper-emacs-state-modifier-minor-mode t)
-      ))
+    (setq-default viper-emacs-intercept-minor-mode t
+		  viper-emacs-local-user-minor-mode t
+		  viper-emacs-global-user-minor-mode t
+		  viper-emacs-kbd-minor-mode t
+		  viper-emacs-state-modifier-minor-mode t))
+(if (and viper-mode (eq viper-current-state 'emacs-state))
+    (setq viper-emacs-intercept-minor-mode t
+	  viper-emacs-local-user-minor-mode t
+	  viper-emacs-global-user-minor-mode t
+	  viper-emacs-kbd-minor-mode t
+	  viper-emacs-state-modifier-minor-mode t))
 
 
 (if (and viper-mode