From 55d7ff38f14396444ef366bfe74eee6dadcf9853 Mon Sep 17 00:00:00 2001
From: Michael Kifer <kifer@cs.stonybrook.edu>
Date: Mon, 28 Feb 2000 06:16:44 +0000
Subject: * viper-cmd.el (viper-envelop-ESC-key): added the option to 
 translate all ESC key sequences. 	(viper-goto-mark-subr): restore
 markers for files for which 	they were saved. 	* viper-init.el
 (viper-translate-all-ESC-keysequences): new variable. 	* viper-util.el
 (viper-set-replace-overlay-glyphs, 	viper-set-replace-overlay): always
 check if the replacement 	overlay is live. 	* viper.el
 (viper-vi-state-mode-list): added major modes. 	* ediff-wind.el: minor
 comment changes. 	* ediff.el: copyright notice date fix.

---
 lisp/emulation/viper-cmd.el  | 18 +++++++++++++++++-
 lisp/emulation/viper-init.el | 13 +++++++++++++
 lisp/emulation/viper-util.el |  6 +++++-
 lisp/emulation/viper.el      |  4 +++-
 4 files changed, 38 insertions(+), 3 deletions(-)

(limited to 'lisp/emulation')

diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index a2b94552204..91be4cf7765 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -890,7 +890,8 @@ as a Meta key and any number of multiple escapes is allowed."
 		;; ESC-sequences).
 		(let* ((first-key (elt keyseq 0))
 		       (key-mod (event-modifiers first-key)))
-		  (cond ((viper-ESC-event-p first-key)
+		  (cond ((and (viper-ESC-event-p first-key)
+			      (not viper-translate-all-ESC-keysequences))
 			 ;; put keys following ESC on the unread list
 			 ;; and return ESC as the key-sequence
 			 (viper-set-unread-command-events (subseq keyseq 1))
@@ -1857,6 +1858,8 @@ Undo previous insertion and inserts new."
 
 ;; Thie is a temp hook that uses free variables init-message and initial.
 ;; A dirty feature, but it is the simplest way to have it do the right thing.
+;; The init-message and initial vars come from the scope set by 
+;; viper-read-string-with-history
 (defun viper-minibuffer-standard-hook ()
   (if (stringp init-message)
       (viper-tmp-insert-at-eob init-message))
@@ -4284,6 +4287,19 @@ One can use `` and '' to temporarily jump 1 step back."
 	 (let* ((buff (current-buffer))
 	        (reg (1+ (- char ?a)))
 	        (text-marker (get-register reg)))
+	   ;; If marker points to file that had markers set (and those markers
+	   ;; were saved (as e.g., in session.el), then restore those markers
+	   (if (and (consp text-marker)
+ 		    (eq (car text-marker) 'file-query)
+ 		    (or (find-buffer-visiting (nth 1 text-marker))
+ 			(y-or-n-p (format "Visit file %s again? "
+ 					  (nth 1 text-marker)))))
+ 	       (save-excursion
+ 		 (find-file (nth 1 text-marker))
+ 		 (when (and (<= (nth 2 text-marker) (point-max))
+ 			    (<= (point-min) (nth 2 text-marker)))
+ 		   (setq text-marker (copy-marker (nth 2 text-marker)))
+ 		   (set-register reg text-marker))))
 	   (if com (viper-move-marker-locally 'viper-com-point (point)))
 	   (if (not (viper-valid-marker text-marker))
 	       (error viper-EmptyTextmarker char))
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index acc95b1ef05..bd479456ee4 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -505,6 +505,19 @@ on a dumb terminal."
   :type 'integer
   :group 'viper-misc)
 
+(defcustom viper-translate-all-ESC-keysequences (not (viper-window-display-p))
+  "Allow translation of all key sequences into commands.
+Normally, Viper lets Emacs translate only those ESC key sequences that are
+defined in the low-level key-translation-map or function-key-map, such as those
+emitted by the arrow and function keys. Other sequences, e.g., \\e/, are
+treated as ESQ command followed by a `/'. This is done for people who type fast
+and tend to hit other characters right after they hit ESC. Other people like
+Emacs to translate ESC sequences all the time. 
+The default is to translate all sequences only when using a dumb terminal.
+This permits you to use ESC as a meta key in insert mode."
+  :type 'boolean
+  :group 'viper-misc)
+
 ;; Modes and related variables
 
 ;; Current mode.  One of: `emacs-state', `vi-state', `insert-state'
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index b8fdf3365ba..b384710e1e3 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -73,6 +73,7 @@
       (fset 'viper-overlay-p (symbol-function 'extentp))
       (fset 'viper-overlay-get (symbol-function 'extent-property))
       (fset 'viper-move-overlay (symbol-function 'set-extent-endpoints))
+      (fset 'viper-overlay-live-p (symbol-function 'extent-live-p))
       (if (viper-window-display-p)
 	  (fset 'viper-iconify (symbol-function 'iconify-frame)))
       (cond ((viper-has-face-support-p)
@@ -88,6 +89,7 @@
   (fset 'viper-overlay-p (symbol-function 'overlayp))
   (fset 'viper-overlay-get (symbol-function 'overlay-get))
   (fset 'viper-move-overlay (symbol-function 'move-overlay))
+  (fset 'viper-overlay-live-p (symbol-function 'overlayp))
   (if (viper-window-display-p)
       (fset 'viper-iconify (symbol-function 'iconify-or-deiconify-frame)))
   (cond ((viper-has-face-support-p)
@@ -704,7 +706,7 @@
   (viper-move-overlay viper-replace-overlay beg end))
   
 (defun viper-set-replace-overlay (beg end)
-  (if (viper-overlay-p viper-replace-overlay)
+  (if (viper-overlay-live-p viper-replace-overlay)
       (viper-move-replace-overlay beg end)
     (setq viper-replace-overlay (viper-make-overlay beg end (current-buffer)))
     ;; never detach
@@ -729,6 +731,8 @@
   
       
 (defun viper-set-replace-overlay-glyphs (before-glyph after-glyph)
+  (or (viper-overlay-live-p viper-replace-overlay)
+      (viper-set-replace-overlay (point-min) (point-min)))
   (if (or (not (viper-has-face-support-p))
 	  viper-use-replace-region-delimiters)
       (let ((before-name (if viper-xemacs-p 'begin-glyph 'before-string))
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 4e95448ab2b..f5094a1b8da 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -6,7 +6,7 @@
 ;;  Keywords: emulations
 ;;  Author: Michael Kifer <kifer@cs.sunysb.edu>
 
-;; Copyright (C) 1994 -- 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
 
 (defconst viper-version "3.08 of October 31, 1999"
   "The current version of Viper")
@@ -393,9 +393,11 @@ widget."
     asm-mode
     prolog-mode
     flora-mode
+    sql-mode
 
     text-mode indented-text-mode
     tex-mode latex-mode bibtex-mode
+    ps-mode
 				  
     completion-list-mode
     
-- 
cgit v1.2.1