Commit 42acc581 authored by Michael Kifer's avatar Michael Kifer
Browse files

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.
parent 61c11870
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> 2008-11-16 Juanma Barranquero <lekktu@gmail.com>
   
* ielm.el (ielm-noisy, ielm-dynamic-return, ielm-mode-hook) * ielm.el (ielm-noisy, ielm-dynamic-return, ielm-mode-hook)
......
...@@ -1294,12 +1294,14 @@ which see." ...@@ -1294,12 +1294,14 @@ which see."
((eq ediff-window-setup-function 'ediff-setup-windows-plain) ((eq ediff-window-setup-function 'ediff-setup-windows-plain)
(if (ediff-in-control-buffer-p) (if (ediff-in-control-buffer-p)
(ediff-kill-bottom-toolbar)) (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)) (set-window-dedicated-p ediff-control-window nil))
(setq ediff-multiframe t) (setq ediff-multiframe t)
(setq window-setup-func 'ediff-setup-windows-multiframe)) (setq window-setup-func 'ediff-setup-windows-multiframe))
(t (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)) (set-window-dedicated-p ediff-control-window nil))
(setq ediff-multiframe t) (setq ediff-multiframe t)
(setq window-setup-func 'ediff-setup-windows-multiframe)) (setq window-setup-func 'ediff-setup-windows-multiframe))
...@@ -1313,7 +1315,9 @@ which see." ...@@ -1313,7 +1315,9 @@ which see."
ediff-window-B nil))) ediff-window-B nil)))
ediff-session-registry) ediff-session-registry)
(if (ediff-in-control-buffer-p) (if (ediff-in-control-buffer-p)
(ediff-recenter 'no-rehighlight)))) (progn
(set-window-dedicated-p (selected-window) nil)
(ediff-recenter 'no-rehighlight)))))
;;;###autoload ;;;###autoload
...@@ -3312,7 +3316,8 @@ Without an argument, it saves customized diff argument, if available ...@@ -3312,7 +3316,8 @@ Without an argument, it saves customized diff argument, if available
ediff-diff-buffer) ediff-diff-buffer)
(t (error "Output from `diff' not found")))) (t (error "Output from `diff' not found"))))
) )
(save-buffer))) (let ((window-min-height 2))
(save-buffer))))
;; idea suggested by Hannu Koivisto <azure@iki.fi> ;; idea suggested by Hannu Koivisto <azure@iki.fi>
......
...@@ -416,6 +416,10 @@ into icons, regardless of the window manager." ...@@ -416,6 +416,10 @@ into icons, regardless of the window manager."
;; this lets us have local versions of ediff-split-window-function ;; this lets us have local versions of ediff-split-window-function
split-window-function ediff-split-window-function split-window-function ediff-split-window-function
three-way-comparison ediff-3way-comparison-job)) 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) (delete-other-windows)
(set-window-dedicated-p (selected-window) nil) (set-window-dedicated-p (selected-window) nil)
(split-window-vertically) (split-window-vertically)
......
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
(marker-position viper-insert-point)) (marker-position viper-insert-point))
(setq viper-pre-command-point (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 ;; Restoring cursor color is needed despite
;; viper-replace-state-pre-command-sentinel: When you jump to another buffer ;; 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 ;; 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." ...@@ -2762,9 +2762,10 @@ On reaching beginning of line, stop and signal error."
(defun viper-next-line-carefully (arg) (defun viper-next-line-carefully (arg)
(condition-case nil (condition-case nil
;; do not use forward-line! need to keep column ;; do not use forward-line! need to keep column
(if (featurep 'emacs) (let ((line-move-visual nil))
(with-no-warnings (next-line arg)) (if (featurep 'emacs)
(next-line arg)) (with-no-warnings (next-line arg))
(next-line arg)))
(error nil))) (error nil)))
...@@ -3064,9 +3065,10 @@ On reaching beginning of line, stop and signal error." ...@@ -3064,9 +3065,10 @@ On reaching beginning of line, stop and signal error."
(com (viper-getCom arg))) (com (viper-getCom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point))) (if com (viper-move-marker-locally 'viper-com-point (point)))
;; do not use forward-line! need to keep column ;; do not use forward-line! need to keep column
(if (featurep 'emacs) (let ((line-move-visual nil))
(with-no-warnings (next-line val)) (if (featurep 'emacs)
(next-line val)) (with-no-warnings (next-line val))
(next-line val)))
(if viper-ex-style-motion (if viper-ex-style-motion
(if (and (eolp) (not (bolp))) (backward-char 1))) (if (and (eolp) (not (bolp))) (backward-char 1)))
(setq this-command 'next-line) (setq this-command 'next-line)
...@@ -3113,9 +3115,10 @@ If point is on a widget or a button, simulate clicking on that widget/button." ...@@ -3113,9 +3115,10 @@ If point is on a widget or a button, simulate clicking on that widget/button."
(com (viper-getCom arg))) (com (viper-getCom arg)))
(if com (viper-move-marker-locally 'viper-com-point (point))) (if com (viper-move-marker-locally 'viper-com-point (point)))
;; do not use forward-line! need to keep column ;; do not use forward-line! need to keep column
(if (featurep 'emacs) (let ((line-move-visual nil))
(with-no-warnings (previous-line val)) (if (featurep 'emacs)
(previous-line val)) (with-no-warnings (previous-line val))
(previous-line val)))
(if viper-ex-style-motion (if viper-ex-style-motion
(if (and (eolp) (not (bolp))) (backward-char 1))) (if (and (eolp) (not (bolp))) (backward-char 1)))
(setq this-command 'previous-line) (setq this-command 'previous-line)
......
...@@ -525,15 +525,6 @@ will make it hard to use Vi-style timeout macros." ...@@ -525,15 +525,6 @@ will make it hard to use Vi-style timeout macros."
:type 'integer :type 'integer
:group 'viper-misc) :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)) (defcustom viper-translate-all-ESC-keysequences (not (viper-window-display-p))
"Allow translation of all key sequences into commands. "Allow translation of all key sequences into commands.
Normally, Viper lets Emacs translate only those ESC key sequences that are Normally, Viper lets Emacs translate only those ESC key sequences that are
...@@ -996,6 +987,15 @@ Should be set in `~/.viper' file." ...@@ -996,6 +987,15 @@ Should be set in `~/.viper' file."
(set (make-local-variable 'bar-cursor) 2) (set (make-local-variable 'bar-cursor) 2)
(setq cursor-type '(bar . 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) (provide 'viper-init)
......
...@@ -193,36 +193,8 @@ Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]." ...@@ -193,36 +193,8 @@ Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]."
:type 'string :type 'string
:group 'viper) :group 'viper)
(defcustom viper-ESC-key (if (viper-window-display-p) [(escape)] "\e") (defvar viper-ESC-key (kbd "ESC")
"Key used to ESC. "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)
)))
;;; Variables used by minor modes ;;; Variables used by minor modes
......
...@@ -196,7 +196,7 @@ Otherwise return the normal value." ...@@ -196,7 +196,7 @@ Otherwise return the normal value."
color))))))) color)))))))
(defsubst viper-get-saved-cursor-color-in-replace-mode () (defun viper-get-saved-cursor-color-in-replace-mode ()
(or (or
(funcall (funcall
(if (featurep 'emacs) 'frame-parameter 'frame-property) (if (featurep 'emacs) 'frame-parameter 'frame-property)
...@@ -206,7 +206,7 @@ Otherwise return the normal value." ...@@ -206,7 +206,7 @@ Otherwise return the normal value."
(viper-frame-value viper-emacs-state-cursor-color)) (viper-frame-value viper-emacs-state-cursor-color))
(viper-frame-value viper-vi-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 (or
(funcall (funcall
(if (featurep 'emacs) 'frame-parameter 'frame-property) (if (featurep 'emacs) 'frame-parameter 'frame-property)
...@@ -216,7 +216,7 @@ Otherwise return the normal value." ...@@ -216,7 +216,7 @@ Otherwise return the normal value."
(viper-frame-value viper-emacs-state-cursor-color)) (viper-frame-value viper-emacs-state-cursor-color))
(viper-frame-value viper-vi-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 (or
(funcall (funcall
(if (featurep 'emacs) 'frame-parameter 'frame-property) (if (featurep 'emacs) 'frame-parameter 'frame-property)
...@@ -939,10 +939,10 @@ Otherwise return the normal value." ...@@ -939,10 +939,10 @@ Otherwise return the normal value."
event)) event))
;; Uses different timeouts for ESC-sequences and others ;; Uses different timeouts for ESC-sequences and others
(defsubst viper-fast-keysequence-p () (defun viper-fast-keysequence-p ()
(not (viper-sit-for-short (not (viper-sit-for-short
(if (viper-ESC-event-p last-input-event) (if (viper-ESC-event-p last-input-event)
viper-ESC-keyseq-timeout (viper-ESC-keyseq-timeout)
viper-fast-keyseq-timeout) viper-fast-keyseq-timeout)
t))) t)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment