Commit 4960e757 authored by Michael Kifer's avatar Michael Kifer
Browse files

* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy

	of Scott Bronson.
	(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
	(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
	Deleted functions.
	(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
	ex-token-list.
	(viper-get-ex-address-subr): convert registers to char data type.

	* viper-util.el (viper-int-to-char,viper-char-equal): new
	functions.
	(viper-memq-char): use viper-int-to-char.
	(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
	vc-locking-state.
	(viper-read-key): use viper-read-key-sequence.

	* viper.el (viper-major-mode-modifier-list): added
	inferior-emacs-lisp-mode.
	(this-major-mode-requires-vi-state): new function that uses simple
	heuristics to decide if vi state is appropriate.
	(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
	(viper-non-hook-settings): don't advise read-key-sequence.
	(viper-read-key-sequence): new function that replaces the
	previously used advice to read-key-sequence.

	* viper-cmd.el (viper-test-com-defun,viper-exec-change,
	viper-exec-Change,viper-execute-com,viper-insert,viper-append,
	viper-Append,viper-Insert,viper-open-line,viper-Open-line,
	viper-open-line-at-point,viper-substitute,viper-overwrite,
	viper-replace-char-subr,viper-forward-word,viper-forward-Word):
	got rid of the negative character hack.
	(viper-escape-to-state,viper-replace-state-exit-cmd):
	use viper-read-key-sequence.
	(viper-envelop-ESC-key): no need for ad-get-orig-definition.
	(viper-minibuffer-standard-hook,viper-read-string-with-history):
	don't override existing minibuffer-setup-hook.
	(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
	convert registers to char data type.
	(viper-autoindent): use viper-indent-line.

	* viper-keym.el: use viper-exec-key-in-emacs.

	* viper.texi: Added credits, new commands, like :make.

	* ediff-util.el: Copyright years.
	(ediff-choose-syntax-table): New function.
	(ediff-setup): Use ediff-choose-syntax-table.
	(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
	vc-state is available.
	(ediff-make-temp-file): use ediff-coding-system-for-write.

	* ediff-init.el (ediff-with-syntax-table): New macro, uses
	with-syntax-table.
	(ediff-coding-system-for-read): from ediff-diff.el
	(ediff-coding-system-for-write): new variable.
	(ediff-highest-priority): fixed the bug having to do with disappearing
	overlays.
	(ediff-file-remote-p): use file-remote-p, if available.
	(ediff-listable-file): new function.
	(ediff-file-attributes): use ediff-listable-file.

	* ediff-mult.el (ediff-meta-insert-file-info1): use
	ediff-listable-file.

	* ediff-ptch.el (ediff-prompt-for-patch-file): use
	ediff-coding-system-for-read.
	(ediff-patch-file-internal): use ediff-coding-system-for-write.

	* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
	(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.

	* ediff.el: Date of last update, copyright years.

	* ediff-wind (ediff-setup-control-frame): Nill->nil.

	* ediff.texi: added clarifications, acknowledgements.
parent 05824718
2001-07-21 Michael Kifer <kifer@cs.sunysb.edu>
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
2001-07-20 Stefan Monnier <monnier@cs.yale.edu> 2001-07-20 Stefan Monnier <monnier@cs.yale.edu>
   
* server.el (server-visit-files): Fix variable name typo. * server.el (server-visit-files): Fix variable name typo.
......
...@@ -57,15 +57,6 @@ Must produce output compatible with Unix's diff3 program." ...@@ -57,15 +57,6 @@ Must produce output compatible with Unix's diff3 program."
:type 'string :type 'string
:group 'ediff-diff) :group 'ediff-diff)
(defcustom ediff-coding-system-for-read 'raw-text
"*The coding system for read to use when running the diff program as a subprocess.
In most cases, the default will do. However, under certain circumstances in
Windows NT/98/95 you might need to use something like 'raw-text-dos here.
So, if the output that your diff program sends to Emacs contains extra ^M's,
you might need to experiment here, if the default or 'raw-text-dos doesn't
work."
:type 'symbol
:group 'ediff-diff)
;; The following functions must precede all defcustom-defined variables. ;; The following functions must precede all defcustom-defined variables.
...@@ -153,7 +144,7 @@ This output is not used by Ediff internally." ...@@ -153,7 +144,7 @@ This output is not used by Ediff internally."
;;; Support for diff3 ;;; Support for diff3
(defvar ediff-match-diff3-line "^====\\(.?\\)$" (defvar ediff-match-diff3-line "^====\\(.?\\)\C-m?$"
"Pattern to match lines produced by diff3 that describe differences.") "Pattern to match lines produced by diff3 that describe differences.")
(defcustom ediff-diff3-options "" (defcustom ediff-diff3-options ""
"*Options to pass to `ediff-diff3-program'." "*Options to pass to `ediff-diff3-program'."
...@@ -918,7 +909,7 @@ delimiter regions")) ...@@ -918,7 +909,7 @@ delimiter regions"))
;; can produce the groups in the order 1, 2, 3 or 1, 3, 2. ;; can produce the groups in the order 1, 2, 3 or 1, 3, 2.
(save-excursion (save-excursion
(re-search-forward (re-search-forward
(concat "^" file ":\\([0-9]+\\)\\(,\\([0-9]+\\)\\)?\\([ac]\\)$")) (concat "^" file ":\\([0-9]+\\)\\(,\\([0-9]+\\)\\)?\\([ac]\\)\C-m?$"))
(beginning-of-line 2) (beginning-of-line 2)
;; treatment depends on whether it is an "a" group or a "c" group ;; treatment depends on whether it is an "a" group or a "c" group
(if (string-equal (buffer-substring (match-beginning 4) (match-end 4)) "c") (if (string-equal (buffer-substring (match-beginning 4) (match-end 4)) "c")
......
;;; ediff-init.el --- macros, variables, and defsubsts used by Ediff ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
;; Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc. ;; Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
...@@ -714,6 +714,22 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire." ...@@ -714,6 +714,22 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire."
:type 'symbol :type 'symbol
:group 'ediff) :group 'ediff)
(defcustom ediff-coding-system-for-read 'raw-text
"*The coding system for read to use when running the diff program as a subprocess.
In most cases, the default will do. However, under certain circumstances in
Windows NT/98/95 you might need to use something like 'raw-text-dos here.
So, if the output that your diff program sends to Emacs contains extra ^M's,
you might need to experiment here, if the default or 'raw-text-dos doesn't
work."
:type 'symbol
:group 'ediff)
(defcustom ediff-coding-system-for-write 'no-conversion
"*The coding system for write to use when writing out difference regions
to temp files when Ediff needs to find fine differences."
:type 'symbol
:group 'ediff)
(if ediff-xemacs-p (if ediff-xemacs-p
(progn (progn
...@@ -1174,7 +1190,7 @@ this variable represents.") ...@@ -1174,7 +1190,7 @@ this variable represents.")
(ediff-defvar-local ediff-current-diff-overlay-Ancestor nil (ediff-defvar-local ediff-current-diff-overlay-Ancestor nil
"Overlay for the current difference region in the ancestor buffer.") "Overlay for the current difference region in the ancestor buffer.")
;; Compute priority of ediff overlay. ;; Compute priority of a current ediff overlay.
(defun ediff-highest-priority (start end buffer) (defun ediff-highest-priority (start end buffer)
(let ((pos (max 1 (1- start))) (let ((pos (max 1 (1- start)))
ovr-list) ovr-list)
...@@ -1184,13 +1200,21 @@ this variable represents.") ...@@ -1184,13 +1200,21 @@ this variable represents.")
(while (< pos (min (point-max) (1+ end))) (while (< pos (min (point-max) (1+ end)))
(setq ovr-list (append (overlays-at pos) ovr-list)) (setq ovr-list (append (overlays-at pos) ovr-list))
(setq pos (next-overlay-change pos))) (setq pos (next-overlay-change pos)))
(1+ (apply '+ (+ 1 ediff-shadow-overlay-priority
(mapcar (lambda (ovr) (apply 'max
(if ovr (mapcar
(or (ediff-overlay-get ovr 'priority) 0) (lambda (ovr)
0)) (if (and ovr
ovr-list) ;; exclude ediff overlays from priority
)) ;; calculation, or else priority will keep
;; increasing
(null (ediff-overlay-get ovr 'ediff))
(null (ediff-overlay-get ovr 'ediff-diff-num)))
;; use the overlay priority or 0
(or (ediff-overlay-get ovr 'priority) 0)
0))
ovr-list)
))
)))) ))))
...@@ -1281,14 +1305,16 @@ This default should work without changes." ...@@ -1281,14 +1305,16 @@ This default should work without changes."
;;; In-line functions ;;; In-line functions
(or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it ;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check
(defun ediff-file-remote-p (file-name) ;; if find-file-name-handler is defined for 'file-local-copy
(defun ediff-file-remote-p (file-name)
(or (and (fboundp 'file-remote-p) (file-remote-p file-name))
(find-file-name-handler file-name 'file-local-copy))) (find-file-name-handler file-name 'file-local-copy)))
;;; (or (and (featurep 'efs-auto) (efs-ftp-path file-name))
;;; (and (featurep 'tramp) (tramp-tramp-file-p file-name)) ;; File for which we can get attributes, such as size or date
;;; (and (fboundp 'file-remote-p) (file-remote-p file-name)) (defun ediff-listable-file (file-name)
;;; ;; Can happen only in Emacs, since XEmacs has file-remote-p (let ((handler (find-file-name-handler file-name 'file-local-copy)))
;;; (and (require 'ange-ftp) (ange-ftp-ftp-name file-name))))) (or (null handler) (eq handler 'dired-handler-fn))))
(defsubst ediff-frame-unsplittable-p (frame) (defsubst ediff-frame-unsplittable-p (frame)
...@@ -1740,9 +1766,10 @@ Unless optional argument INPLACE is non-nil, return a new string." ...@@ -1740,9 +1766,10 @@ Unless optional argument INPLACE is non-nil, return a new string."
(apply 'message string args))) (apply 'message string args)))
(defun ediff-file-attributes (filename attr-number) (defun ediff-file-attributes (filename attr-number)
(if (ediff-file-remote-p filename) (if (ediff-listable-file filename)
-1 (nth attr-number (file-attributes filename))
(nth attr-number (file-attributes filename)))) -1)
)
(defsubst ediff-file-size (filename) (defsubst ediff-file-size (filename)
(ediff-file-attributes filename 7)) (ediff-file-attributes filename 7))
......
...@@ -970,7 +970,7 @@ behavior." ...@@ -970,7 +970,7 @@ behavior."
500)) 500))
file-modtime file-size) file-modtime file-size)
(cond ((not (stringp fname)) (setq file-size -2)) ; file doesn't exits (cond ((not (stringp fname)) (setq file-size -2)) ; file doesn't exits
((not (ediff-file-remote-p fname)) ((ediff-listable-file fname)
(if (file-exists-p fname) (if (file-exists-p fname)
;; set real size and modtime ;; set real size and modtime
(setq file-size (ediff-file-size fname) (setq file-size (ediff-file-size fname)
......
...@@ -408,7 +408,8 @@ are two possible targets for this patch. However, these files do not exist." ...@@ -408,7 +408,8 @@ are two possible targets for this patch. However, these files do not exist."
(defun ediff-prompt-for-patch-file () (defun ediff-prompt-for-patch-file ()
(let ((dir (cond (ediff-patch-default-directory) ; try patch default dir (let ((dir (cond (ediff-patch-default-directory) ; try patch default dir
(ediff-use-last-dir ediff-last-dir-patch) (ediff-use-last-dir ediff-last-dir-patch)
(t default-directory)))) (t default-directory)))
(coding-system-for-read ediff-coding-system-for-read))
(find-file-noselect (find-file-noselect
(read-file-name (read-file-name
(format "Patch is in file:%s " (format "Patch is in file:%s "
...@@ -445,7 +446,7 @@ are two possible targets for this patch. However, these files do not exist." ...@@ -445,7 +446,7 @@ are two possible targets for this patch. However, these files do not exist."
(goto-char (point-min)) (goto-char (point-min))
(and (re-search-forward ediff-context-diff-label-regexp nil t) (and (re-search-forward ediff-context-diff-label-regexp nil t)
(current-buffer))))) (current-buffer)))))
(t (other-buffer (current-buffer) 'visible-ok))) (t (ediff-other-buffer (current-buffer))))
'must-match))) 'must-match)))
...@@ -576,6 +577,10 @@ optional argument, then use it." ...@@ -576,6 +577,10 @@ optional argument, then use it."
;; file for the purpose of patching. ;; file for the purpose of patching.
(true-source-filename source-filename) (true-source-filename source-filename)
(target-filename source-filename) (target-filename source-filename)
;; this ensures that the patch process gets patch buffer in the
;; encoding that Emacs thinks is right for that type of text
(coding-system-for-write
(if (boundp 'buffer-file-coding-system) buffer-file-coding-system))
target-buf buf-to-patch file-name-magic-p target-buf buf-to-patch file-name-magic-p
patch-return-code ctl-buf backup-style aux-wind) patch-return-code ctl-buf backup-style aux-wind)
......
...@@ -1101,15 +1101,24 @@ of the current buffer." ...@@ -1101,15 +1101,24 @@ of the current buffer."
(defsubst ediff-file-checked-out-p (file) (defsubst ediff-file-checked-out-p (file)
(or (not (featurep 'vc-hooks)) (or (not (featurep 'vc-hooks))
(and (vc-backend file) (and (vc-backend file)
(or (memq (vc-state file) '(edited needs-merge)) (if (fboundp 'vc-state)
(stringp (vc-state file)))))) (or (memq (vc-state file) '(edited needs-merge))
(stringp (vc-state file)))
;; XEmacs has no vc-state
(vc-locking-user file))
)))
(defsubst ediff-file-checked-in-p (file) (defsubst ediff-file-checked-in-p (file)
(and (featurep 'vc-hooks) (and (featurep 'vc-hooks)
;; CVS files are considered not checked in ;; CVS files are considered not checked in
(not (memq (vc-backend file) '(nil CVS))) (not (memq (vc-backend file) '(nil CVS)))
(not (memq (vc-state file) '(edited needs-merge))) (if (fboundp 'vc-state)
(not (stringp (vc-state file))))) (progn
(not (memq (vc-state file) '(edited needs-merge)))
(not (stringp (vc-state file))))
;; XEmacs has no vc-state
(not (vc-locking-user file)))
))
(defun ediff-file-compressed-p (file) (defun ediff-file-compressed-p (file)
(condition-case nil (condition-case nil
...@@ -2971,7 +2980,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." ...@@ -2971,7 +2980,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
(defun ediff-make-temp-file (buff &optional prefix given-file start end) (defun ediff-make-temp-file (buff &optional prefix given-file start end)
(let* ((p (ediff-convert-standard-filename (or prefix "ediff"))) (let* ((p (ediff-convert-standard-filename (or prefix "ediff")))
(short-p p) (short-p p)
(coding-system-for-write 'no-conversion) (coding-system-for-write ediff-coding-system-for-write)
f short-f) f short-f)
(if (and (fboundp 'msdos-long-file-names) (if (and (fboundp 'msdos-long-file-names)
(not (msdos-long-file-names)) (not (msdos-long-file-names))
...@@ -3464,7 +3473,7 @@ Ediff Control Panel to restore highlighting." ...@@ -3464,7 +3473,7 @@ Ediff Control Panel to restore highlighting."
;; never detach ;; never detach
(ediff-overlay-put (ediff-overlay-put
overl (if ediff-emacs-p 'evaporate 'detachable) nil) overl (if ediff-emacs-p 'evaporate 'detachable) nil)
;; make vip-minibuffer-overlay open-ended ;; make overlay open-ended
;; In emacs, it is made open ended at creation time ;; In emacs, it is made open ended at creation time
(if ediff-xemacs-p (if ediff-xemacs-p
(progn (progn
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
;; Created: February 2, 1994 ;; Created: February 2, 1994
;; Keywords: comparing, merging, patching, tools, unix ;; Keywords: comparing, merging, patching, tools, unix
(defconst ediff-version "2.75" "The current version of Ediff") (defconst ediff-version "2.76" "The current version of Ediff")
(defconst ediff-date "March 5, 2001" "Date of last update") (defconst ediff-date "July 18, 2001" "Date of last update")
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
......
...@@ -74,18 +74,15 @@ ...@@ -74,18 +74,15 @@
;; given symbol foo, foo-p is the test function, foos is the set of ;; given symbol foo, foo-p is the test function, foos is the set of
;; Viper command keys ;; Viper command keys
;; (macroexpand '(viper-test-com-defun foo)) ;; (macroexpand '(viper-test-com-defun foo))
;; (defun foo-p (com) (consp (memq (if (< com 0) (- com) com) foos))) ;; (defun foo-p (com) (consp (memq com foos)))
(defmacro viper-test-com-defun (name) (defmacro viper-test-com-defun (name)
(let* ((snm (symbol-name name)) (let* ((snm (symbol-name name))
(nm-p (intern (concat snm "-p"))) (nm-p (intern (concat snm "-p")))
(nms (intern (concat snm "s")))) (nms (intern (concat snm "s"))))
`(defun ,nm-p (com) `(defun ,nm-p (com)
(consp (viper-memq-char (consp (viper-memq-char com ,nms)
(if (and (viper-characterp com) (< com 0)) ))))
(- com) com)
,nms)
))))
;; Variables for defining VI commands ;; Variables for defining VI commands
...@@ -725,10 +722,8 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to ...@@ -725,10 +722,8 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
viper-emacs-kbd-minor-mode) viper-emacs-kbd-minor-mode)
(unwind-protect (unwind-protect
(progn (progn
(setq com (key-binding (setq key (setq com
(if viper-xemacs-p (key-binding (setq key (viper-read-key-sequence nil))))
(read-key-sequence nil)
(read-key-sequence nil t)))))
;; In case of binding indirection--chase definitions. ;; In case of binding indirection--chase definitions.
;; Have to do it here because we execute this command under ;; Have to do it here because we execute this command under
;; different keymaps, so command-execute may not do the ;; different keymaps, so command-execute may not do the
...@@ -797,6 +792,12 @@ Similar to viper-escape-to-emacs, but accepts forms rather than keystrokes." ...@@ -797,6 +792,12 @@ Similar to viper-escape-to-emacs, but accepts forms rather than keystrokes."
(viper-set-mode-vars-for viper-current-state) (viper-set-mode-vars-for viper-current-state)
result)) result))
;; This executes the last kbd event in emacs mode. Is used when we want to
;; interpret certain keys directly in emacs (as, for example, in comint mode).
(defun viper-exec-key-in-emacs (arg)
(interactive "P")
(viper-escape-to-emacs arg last-command-event))
;; This is needed because minor modes sometimes override essential Viper ;; This is needed because minor modes sometimes override essential Viper
;; bindings. By letting Viper know which files these modes are in, it will ;; bindings. By letting Viper know which files these modes are in, it will
...@@ -878,9 +879,7 @@ as a Meta key and any number of multiple escapes is allowed." ...@@ -878,9 +879,7 @@ as a Meta key and any number of multiple escapes is allowed."
(progn (progn
(let (minor-mode-map-alist) (let (minor-mode-map-alist)
(viper-set-unread-command-events event) (viper-set-unread-command-events event)
(setq keyseq (setq keyseq (read-key-sequence nil 'continue-echo))
(funcall
(ad-get-orig-definition 'read-key-sequence) nil))
) ; let ) ; let
;; If keyseq translates into something that still has ESC ;; If keyseq translates into something that still has ESC
;; at the beginning, separate ESC from the rest of the seq. ;; at the beginning, separate ESC from the rest of the seq.
...@@ -933,8 +932,7 @@ as a Meta key and any number of multiple escapes is allowed." ...@@ -933,8 +932,7 @@ as a Meta key and any number of multiple escapes is allowed."
;; this is escape event with nothing after it ;; this is escape event with nothing after it
;; put in unread-command-event and then re-read ;; put in unread-command-event and then re-read
(viper-set-unread-command-events event) (viper-set-unread-command-events event)
(setq keyseq (setq keyseq (read-key-sequence nil))
(funcall (ad-get-orig-definition 'read-key-sequence) nil))
)) ))
;; not an escape event ;; not an escape event
(setq keyseq (vector event))) (setq keyseq (vector event)))
...@@ -1121,7 +1119,8 @@ as a Meta key and any number of multiple escapes is allowed." ...@@ -1121,7 +1119,8 @@ as a Meta key and any number of multiple escapes is allowed."
;; execute apropriate region command. ;; execute apropriate region command.
(let ((char (car com)) (com (cdr com))) (let ((char (car com)) (com (cdr com)))
(setq prefix-arg (cons value com)) (setq prefix-arg (cons value com))
(if (viper= char ?r) (viper-region prefix-arg) (if (viper= char ?r)
(viper-region prefix-arg)
(viper-Region prefix-arg)) (viper-Region prefix-arg))
;; reset prefix-arg ;; reset prefix-arg
(setq prefix-arg nil)) (setq prefix-arg nil))
...@@ -1249,9 +1248,10 @@ as a Meta key and any number of multiple escapes is allowed." ...@@ -1249,9 +1248,10 @@ as a Meta key and any number of multiple escapes is allowed."
(exchange-point-and-mark)) (exchange-point-and-mark))
(if (eq (preceding-char) ?\n) (if (eq (preceding-char) ?\n)
(viper-backward-char-carefully)) ; give back the newline (viper-backward-char-carefully)) ; give back the newline
(if (viper= com ?c) (if (eq viper-intermediate-command 'viper-repeat)
(viper-change (mark t) (point)) (viper-change-subr (mark t) (point))
(viper-change-subr (mark t) (point)))) (viper-change (mark t) (point))
))
;; this is invoked by viper-substitute-line ;; this is invoked by viper-substitute-line
(defun viper-exec-Change (m-com com) (defun viper-exec-Change (m-com com)
...@@ -1271,9 +1271,10 @@ as a Meta key and any number of multiple escapes is allowed." ...@@ -1271,9 +1271,10 @@ as a Meta key and any number of multiple escapes is allowed."
(setq viper-use-register nil))) (setq viper-use-register nil)))
(delete-region (mark t) (point))) (delete-region (mark t) (point)))
(open-line 1) (open-line 1)
(if (viper= com ?C) (if (eq viper-intermediate-command 'viper-repeat)
(viper-change-state-to-insert) (viper-yank-last-insertion)
(viper-yank-last-insertion))) (viper-change-state-to-insert)
))
(defun viper-exec-delete (m-com com) (defun viper-exec-delete (m-com com)
(or (and (markerp viper-com-point) (marker-position viper-com-point)) (or (and (markerp viper-com-point) (marker-position viper-com-point))
...@@ -1455,15 +1456,13 @@ as a Meta key and any number of multiple escapes is allowed." ...@@ -1455,15 +1456,13 @@ as a Meta key and any number of multiple escapes is allowed."
;; this is the special command `#' ;; this is the special command `#'
(if (> com 128) (if (> com 128)
(viper-special-prefix-com (- com 128)) (viper-special-prefix-com (- com 128))
(let ((fn (aref viper-exec-array (if (< com 0) (- com) com)))) (let ((fn (aref viper-exec-array com)))
(if (null fn) (if (null fn)
(error "%c: %s" com viper-InvalidViCommand) (error "%c: %s" com viper-InvalidViCommand)
(funcall fn m-com com)))) (funcall fn m-com com))))
(if (viper-dotable-command-p com) (if (viper-dotable-command-p com)
(viper-set-destructive-command (viper-set-destructive-command
(list m-com val (list m-com val com reg nil nil)))
(if (viper-memq-char com (list ?c ?C ?!)) (- com) com)
reg nil nil)))
)) ))
...@@ -1889,8 +1888,7 @@ Undo previous insertion and inserts new." ...@@ -1889,8 +1888,7 @@ Undo previous insertion and inserts new."
(if (fboundp 'minibuffer-prompt-end) (if (fboundp 'minibuffer-prompt-end)
(delete-region (minibuffer-prompt-end) (point-max)) (delete-region (minibuffer-prompt-end) (point-max))
(erase-buffer)) (erase-buffer))
(insert initial))) (insert initial))))
(viper-minibuffer-setup-sentinel))
(defsubst viper-minibuffer-real-start () (defsubst viper-minibuffer-real-start ()
(if (fboundp 'minibuffer-prompt-end) (if (fboundp 'minibuffer-prompt-end)
...@@ -1994,7 +1992,16 @@ problems." ...@@ -1994,7 +1992,16 @@ problems."
;; KEYMAP is used, if given, instead of minibuffer-local-map. ;; KEYMAP is used, if given, instead of minibuffer-local-map.
;; INIT-MESSAGE is the message temporarily displayed after entering the ;; INIT-MESSAGE is the message temporarily displayed after entering the
;; minibuffer. ;; minibuffer.
(let ((minibuffer-setup-hook 'viper-minibuffer-standard-hook) (let ((minibuffer-setup-hook
;; stolen from add-hook
(let ((old
(if (boundp 'minibuffer-setup-hook)
minibuffer-setup-hook
nil)))
(cons
'viper-minibuffer-standard-hook
(if (or (not (listp old)) (eq (car old) 'lambda))
(list old) old))))
(val "") (val "")
(padding "") (padding "")
temp-msg) temp-msg)
...@@ -2059,7 +2066,7 @@ problems." ...@@ -2059,7 +2066,7 @@ problems."
(let ((val (viper-p-val arg)) (let ((val (viper-p-val arg))
(com (viper-getcom arg))) (com (viper-getcom arg)))
(viper-set-destructive-command (list 'viper-insert val ?r nil nil nil)) (viper-set-destructive-command (list 'viper-insert val ?r nil nil nil))
(if com (if (eq viper-intermediate-command 'viper-repeat)
(viper-loop val (viper-yank-last-insertion)) (viper-loop val (viper-yank-last-insertion))
(viper-change-state-to-insert)))) (viper-change-state-to-insert))))
...@@ -2071,7 +2078,7 @@ problems." ...@@ -2071,7 +2078,7 @@ problems."
(com (viper-getcom arg))) (com (viper-getcom arg)))
(viper-set-destructive-command (list 'viper-append val ?r nil nil nil))