changeset 99595:eb7532b56b78

2008-11-16 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-ESC-keyseq-timeout): Make it into a function instead of a variable. * viper-util.el (viper-fast-keysequence-p): Changed to use viper-ESC-keyseq-timeout as a function. (viper-get-saved-cursor-color-in-replace-mode): Use defun instead of defsubst. * viper-cmd.el: Let line-move-visual to nil when using next-line or previous-line. (viper-R-state-post-command-sentinel): Use defun instead of defsubst. * viper-keym.el (viper-ESC-key): Use (kbd "ESC"). * ediff-util.el (ediff-toggle-multiframe): Check if control window is live. (ediff-save-buffer): Let window-min-height to 2. * ediff-wind.el (ediff-setup-windows-plain-compare): Avoid selecting the minibuffer.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sun, 16 Nov 2008 04:55:45 +0000
parents f7610a7d319c
children bc9da26d5914
files lisp/ChangeLog lisp/ediff-util.el lisp/ediff-wind.el lisp/emulation/viper-cmd.el lisp/emulation/viper-init.el lisp/emulation/viper-keym.el lisp/emulation/viper-util.el
diffstat 7 files changed, 65 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Nov 16 04:54:05 2008 +0000
+++ b/lisp/ChangeLog	Sun Nov 16 04:55:45 2008 +0000
@@ -1,3 +1,26 @@
+2008-11-16  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* viper-init.el (viper-ESC-keyseq-timeout): Make it into a function
+	instead of a variable.
+	
+	* viper-util.el (viper-fast-keysequence-p): Changed to use
+	viper-ESC-keyseq-timeout as a function.
+	(viper-get-saved-cursor-color-in-replace-mode): Use defun instead of
+	defsubst.
+	
+	* viper-cmd.el: Let line-move-visual to nil when using next-line or
+	previous-line.
+	(viper-R-state-post-command-sentinel): Use defun instead of defsubst.
+	
+	* viper-keym.el (viper-ESC-key): Use (kbd "ESC").
+	
+	* ediff-util.el (ediff-toggle-multiframe): Check if control window is
+	live.
+	(ediff-save-buffer): Let window-min-height to 2.
+	
+	* ediff-wind.el (ediff-setup-windows-plain-compare): Avoid selecting
+	the minibuffer.
+	
 2008-11-16  Juanma Barranquero  <lekktu@gmail.com>
 
 	* ielm.el (ielm-noisy, ielm-dynamic-return, ielm-mode-hook)
--- a/lisp/ediff-util.el	Sun Nov 16 04:54:05 2008 +0000
+++ b/lisp/ediff-util.el	Sun Nov 16 04:55:45 2008 +0000
@@ -1294,12 +1294,14 @@
 	((eq ediff-window-setup-function 'ediff-setup-windows-plain)
 	 (if (ediff-in-control-buffer-p)
 	     (ediff-kill-bottom-toolbar))
-	 (if (ediff-buffer-live-p ediff-control-buffer)
+	 (if (and (ediff-buffer-live-p ediff-control-buffer)
+		  (window-live-p ediff-control-window))
 	     (set-window-dedicated-p ediff-control-window nil))
 	 (setq ediff-multiframe t)
 	 (setq window-setup-func 'ediff-setup-windows-multiframe))
 	(t
-	 (if (ediff-buffer-live-p ediff-control-buffer)
+	 (if (and (ediff-buffer-live-p ediff-control-buffer)
+		  (window-live-p ediff-control-window))
 	     (set-window-dedicated-p ediff-control-window nil))
 	 (setq ediff-multiframe t)
 	 (setq window-setup-func 'ediff-setup-windows-multiframe))
@@ -1313,7 +1315,9 @@
 			     ediff-window-B nil)))
 	ediff-session-registry)
   (if (ediff-in-control-buffer-p)
-      (ediff-recenter 'no-rehighlight))))
+      (progn
+	(set-window-dedicated-p (selected-window) nil)
+	(ediff-recenter 'no-rehighlight)))))
 
 
 ;;;###autoload
@@ -3312,7 +3316,8 @@
 		    ediff-diff-buffer)
 		   (t (error "Output from `diff' not found"))))
 	    )
-    (save-buffer)))
+    (let ((window-min-height 2))
+      (save-buffer))))
 
 
 ;; idea suggested by Hannu Koivisto <azure@iki.fi>
--- a/lisp/ediff-wind.el	Sun Nov 16 04:54:05 2008 +0000
+++ b/lisp/ediff-wind.el	Sun Nov 16 04:55:45 2008 +0000
@@ -416,6 +416,10 @@
 	    ;; this lets us have local versions of ediff-split-window-function
 	    split-window-function ediff-split-window-function
 	    three-way-comparison ediff-3way-comparison-job))
+    ;; if in minibuffer go somewhere else
+    (if (save-match-data
+	  (string-match "\*Minibuf-" (buffer-name (window-buffer))))
+	(select-window (next-window nil 'ignore-minibuf)))
     (delete-other-windows)
     (set-window-dedicated-p (selected-window) nil)
     (split-window-vertically)
--- a/lisp/emulation/viper-cmd.el	Sun Nov 16 04:54:05 2008 +0000
+++ b/lisp/emulation/viper-cmd.el	Sun Nov 16 04:55:45 2008 +0000
@@ -216,7 +216,7 @@
 	   (marker-position viper-insert-point))
       (setq viper-pre-command-point (marker-position viper-insert-point))))
 
-(defsubst viper-R-state-post-command-sentinel ()
+(defun viper-R-state-post-command-sentinel ()
   ;; Restoring cursor color is needed despite
   ;; viper-replace-state-pre-command-sentinel: When you jump to another buffer
   ;; in another frame, the pre-command hook won't change cursor color to
@@ -2762,9 +2762,10 @@
 (defun viper-next-line-carefully (arg)
   (condition-case nil
       ;; do not use forward-line! need to keep column
-      (if (featurep 'emacs)
-	  (with-no-warnings (next-line arg))
-	(next-line arg))
+      (let ((line-move-visual nil))
+	(if (featurep 'emacs)
+	    (with-no-warnings (next-line arg))
+	  (next-line arg)))
     (error nil)))
 
 
@@ -3064,9 +3065,10 @@
 	(com (viper-getCom arg)))
     (if com (viper-move-marker-locally 'viper-com-point (point)))
     ;; do not use forward-line! need to keep column
-    (if (featurep 'emacs)
-	(with-no-warnings (next-line val))
-      (next-line val))
+    (let ((line-move-visual nil))
+      (if (featurep 'emacs)
+	  (with-no-warnings (next-line val))
+	(next-line val)))
     (if viper-ex-style-motion
 	(if (and (eolp) (not (bolp))) (backward-char 1)))
     (setq this-command 'next-line)
@@ -3113,9 +3115,10 @@
 	(com (viper-getCom arg)))
     (if com (viper-move-marker-locally 'viper-com-point (point)))
     ;; do not use forward-line! need to keep column
-    (if (featurep 'emacs)
-	(with-no-warnings (previous-line val))
-      (previous-line val))
+    (let ((line-move-visual nil))
+      (if (featurep 'emacs)
+	  (with-no-warnings (previous-line val))
+	(previous-line val)))
     (if viper-ex-style-motion
 	(if (and (eolp) (not (bolp))) (backward-char 1)))
     (setq this-command 'previous-line)
--- a/lisp/emulation/viper-init.el	Sun Nov 16 04:54:05 2008 +0000
+++ b/lisp/emulation/viper-init.el	Sun Nov 16 04:55:45 2008 +0000
@@ -525,15 +525,6 @@
   :type 'integer
   :group 'viper-misc)
 
-(defcustom viper-ESC-keyseq-timeout (if (viper-window-display-p)
-				      0 viper-fast-keyseq-timeout)
-  "*Key sequence beginning with ESC and separated by no more than this many milliseconds is considered to be generated by a keyboard function key.
-Setting this too high may slow down switching from insert to vi state.  Setting
-this value too low will make it impossible to use function keys in insert mode
-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
@@ -996,6 +987,15 @@
       (set (make-local-variable 'bar-cursor) 2)
     (setq cursor-type '(bar . 2))))
 
+(defun viper-ESC-keyseq-timeout ()
+  "*Key sequence beginning with ESC and separated by no more than this many milliseconds is considered to be generated by a keyboard function key.
+Setting this too high may slow down switching from insert to vi state.  Setting
+this value too low will make it impossible to use function keys in insert mode
+on a dumb terminal."
+  (if (viper-window-display-p)
+      0 viper-fast-keyseq-timeout))
+
+
 
 (provide 'viper-init)
 
--- a/lisp/emulation/viper-keym.el	Sun Nov 16 04:54:05 2008 +0000
+++ b/lisp/emulation/viper-keym.el	Sun Nov 16 04:55:45 2008 +0000
@@ -193,36 +193,8 @@
   :type 'string
   :group 'viper)
 
-(defcustom viper-ESC-key (if (viper-window-display-p) [(escape)] "\e")
-  "Key used to ESC.
-Enter as a sexp. Examples: \"\\e\", [(escape)].
-If running in a terminal, [(escape)] is not understood, so must use \"\\e\"."
-  :type 'sexp
-  :group 'viper
-  :set (lambda (symbol value)
-	 (let ((old-value (if (boundp 'viper-ESC-key)
-			      viper-ESC-key
-			    [(escape)])))
-	   (mapc
-	    (lambda (buf)
-	      (save-excursion
-		(set-buffer buf)
-		(when (and (boundp 'viper-insert-intercept-map)
-			   (keymapp viper-insert-intercept-map))
-		  (when old-value
-		    (define-key viper-insert-intercept-map old-value nil))
-		  (define-key
-		    viper-insert-intercept-map value 'viper-intercept-ESC-key))
-		(when (and (boundp 'viper-vi-intercept-map)
-			   (keymapp viper-vi-intercept-map))
-		  (when old-value
-		    (define-key viper-vi-intercept-map old-value nil))
-		  (define-key
-		    viper-vi-intercept-map value 'viper-intercept-ESC-key))
-		))
-	    (buffer-list))
-	   (set-default symbol value)
-           )))
+(defvar viper-ESC-key (kbd "ESC")
+  "Key used to ESC.")
 
 
 ;;; Variables used by minor modes
--- a/lisp/emulation/viper-util.el	Sun Nov 16 04:54:05 2008 +0000
+++ b/lisp/emulation/viper-util.el	Sun Nov 16 04:55:45 2008 +0000
@@ -196,7 +196,7 @@
 	       color)))))))
 
 
-(defsubst viper-get-saved-cursor-color-in-replace-mode ()
+(defun viper-get-saved-cursor-color-in-replace-mode ()
   (or
    (funcall
     (if (featurep 'emacs) 'frame-parameter 'frame-property)
@@ -206,7 +206,7 @@
 	    (viper-frame-value viper-emacs-state-cursor-color))
        (viper-frame-value viper-vi-state-cursor-color))))
 
-(defsubst viper-get-saved-cursor-color-in-insert-mode ()
+(defun viper-get-saved-cursor-color-in-insert-mode ()
   (or
    (funcall
     (if (featurep 'emacs) 'frame-parameter 'frame-property)
@@ -216,7 +216,7 @@
 	    (viper-frame-value viper-emacs-state-cursor-color))
        (viper-frame-value viper-vi-state-cursor-color))))
 
-(defsubst viper-get-saved-cursor-color-in-emacs-mode ()
+(defun viper-get-saved-cursor-color-in-emacs-mode ()
   (or
    (funcall
     (if (featurep 'emacs) 'frame-parameter 'frame-property)
@@ -939,10 +939,10 @@
     event))
 
 ;; Uses different timeouts for ESC-sequences and others
-(defsubst viper-fast-keysequence-p ()
+(defun viper-fast-keysequence-p ()
   (not (viper-sit-for-short
 	(if (viper-ESC-event-p last-input-event)
-	    viper-ESC-keyseq-timeout
+	    (viper-ESC-keyseq-timeout)
 	  viper-fast-keyseq-timeout)
 	t)))