From 42acc58182959fd891b5f4263d900c088de24c13 Mon Sep 17 00:00:00 2001 From: Michael Kifer Date: Sun, 16 Nov 2008 04:55:45 +0000 Subject: [PATCH] 2008-11-16 Michael Kifer * 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 | 23 +++++++++++++++++++++++ lisp/ediff-util.el | 13 +++++++++---- lisp/ediff-wind.el | 4 ++++ lisp/emulation/viper-cmd.el | 23 +++++++++++++---------- lisp/emulation/viper-init.el | 18 +++++++++--------- lisp/emulation/viper-keym.el | 32 ++------------------------------ lisp/emulation/viper-util.el | 10 +++++----- 7 files changed, 65 insertions(+), 58 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f36bb2e761c..3336ba4e84f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,26 @@ +2008-11-16 Michael Kifer + + * 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 * ielm.el (ielm-noisy, ielm-dynamic-return, ielm-mode-hook) diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el index c9de700f234..f6b62b0e0dd 100644 --- a/lisp/ediff-util.el +++ b/lisp/ediff-util.el @@ -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 diff --git a/lisp/ediff-wind.el b/lisp/ediff-wind.el index 64018466508..e21817289ff 100644 --- a/lisp/ediff-wind.el +++ b/lisp/ediff-wind.el @@ -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) diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 18fa94d1cd9..2e9449c513f 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -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 @@ 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) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index d8eaf253d16..9894ec8beda 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -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) diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index dc24b83e3b6..90c4c627b7d 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el @@ -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 diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 9bb047183dc..6976340b964 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -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))) -- 2.11.4.GIT