2008-11-16 Michael Kifer <kifer@cs.stonybrook.edu>
authorMichael Kifer <kifer@cs.stonybrook.edu>
Sun, 16 Nov 2008 04:55:45 +0000 (04:55 +0000)
committerMichael Kifer <kifer@cs.stonybrook.edu>
Sun, 16 Nov 2008 04:55:45 +0000 (04:55 +0000)
* 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.

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

index f36bb2e..3336ba4 100644 (file)
@@ -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)
index c9de700..f6b62b0 100644 (file)
@@ -1294,12 +1294,14 @@ which see."
        ((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 @@ which see."
                             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 @@ Without an argument, it saves customized diff argument, if available
                    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>
index 6401846..e218172 100644 (file)
@@ -416,6 +416,10 @@ into icons, regardless of the window manager."
            ;; 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)
index 18fa94d..2e9449c 100644 (file)
           (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 @@ On reaching beginning of line, stop and signal error."
 (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 @@ On reaching beginning of line, stop and signal error."
        (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 @@ If point is on a widget or a button, simulate clicking on that widget/button."
        (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)
index d8eaf25..9894ec8 100644 (file)
@@ -525,15 +525,6 @@ will make it hard to use Vi-style timeout macros."
   :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 @@ Should be set in `~/.viper' file."
       (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)
 
index dc24b83..90c4c62 100644 (file)
@@ -193,36 +193,8 @@ Enter as a sexp.  Examples: \"\\C-z\", [(control ?z)]."
   :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
index 9bb0471..6976340 100644 (file)
@@ -196,7 +196,7 @@ Otherwise return the normal value."
               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 @@ Otherwise return the normal value."
            (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 @@ Otherwise return the normal value."
            (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 @@ Otherwise return the normal value."
     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)))