changeset 33842:f6a67d77484a

* ediff-diff.el: Moved variables around to have it compile under NT. * ediff-help.el (ediff-use-long-help-message): made it customizable. * ediff-init.el (ediff-abbrev-jobname): use capitalize. * ediff-wind.el (ediff-skip-unsuitable-frames): deleted the redundant skip-small-frames test. * viper-cmd.el (viper-change-state-to-vi): disable overwrite mode. (viper-downgrade-to-insert): protect against errors in hooks. * viper-init.el (viper-vi-state-hook,viper-insert-state-hook, viper-replace-state-hook,viper-emacs-state-hook): do cursor handling. (viper-restore-cursor-type,viper-set-insert-cursor-type): new functions. * viper-util.el (viper-memq-char): bug fixes * viper.el (viper-mode): fix cursor handling.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Fri, 24 Nov 2000 08:15:11 +0000
parents ed02ff77aa8d
children 388a61e78c53
files lisp/ChangeLog lisp/ediff-diff.el lisp/ediff-help.el lisp/ediff-init.el lisp/ediff-wind.el lisp/emulation/viper-cmd.el lisp/emulation/viper-init.el lisp/emulation/viper-util.el lisp/emulation/viper.el
diffstat 9 files changed, 77 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/ChangeLog	Fri Nov 24 08:15:11 2000 +0000
@@ -1,3 +1,26 @@
+2000-11-24  Michael Kifer  <kifer@cs.sunysb.edu>
+	
+	* ediff-diff.el: Moved variables around to have it compile under NT.
+	
+	* ediff-help.el (ediff-use-long-help-message): made it customizable.
+	
+	* ediff-init.el (ediff-abbrev-jobname): use capitalize.
+	
+	* ediff-wind.el (ediff-skip-unsuitable-frames): deleted the
+	redundant skip-small-frames test.
+	
+	* viper-cmd.el (viper-change-state-to-vi): disable overwrite mode.
+	(viper-downgrade-to-insert): protect against errors in hooks.
+	
+	* viper-init.el (viper-vi-state-hook,viper-insert-state-hook,
+	viper-replace-state-hook,viper-emacs-state-hook): do cursor handling.
+	(viper-restore-cursor-type,viper-set-insert-cursor-type): new
+	functions.
+	
+	* viper-util.el (viper-memq-char): bug fixes.
+	
+	* viper.el (viper-mode): fix cursor handling.
+	
 2000-11-24  Kenichi Handa  <handa@etl.go.jp>
 
 	* international/mule-diag.el (list-iso-charset-chars): For
--- a/lisp/ediff-diff.el	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/ediff-diff.el	Fri Nov 24 08:15:11 2000 +0000
@@ -44,6 +44,18 @@
   :prefix "ediff-"
   :group 'ediff)
 
+;; these two must be here to prevent ediff-test-utility from barking
+(defcustom ediff-diff-program "diff"
+  "*Program to use for generating the differential of the two files."
+  :type 'string
+  :group 'ediff-diff)
+(defcustom ediff-diff3-program "diff3"
+  "*Program to be used for three-way comparison.
+Must produce output compatible with Unix's diff3 program."
+  :type 'string
+  :group 'ediff-diff)
+
+;; The following functions must precede all defcustom-defined variables.
 
 ;; The following functions needed for setting diff/diff3 options
 ;; test if diff supports the --binary option
@@ -108,10 +120,6 @@
   :type '(repeat string)
   :group 'ediff-diff)
 
-(defcustom ediff-diff-program "diff"
-  "*Program to use for generating the differential of the two files."
-  :type 'string
-  :group 'ediff-diff)
 (defcustom ediff-diff-options ""
   "*Options to pass to `ediff-diff-program'. 
 If diff\(1\) is used as `ediff-diff-program', then the most useful options are
@@ -135,11 +143,6 @@
 
 (defvar ediff-match-diff3-line "^====\\(.?\\)$"
   "Pattern to match lines produced by diff3 that describe differences.")
-(defcustom ediff-diff3-program "diff3"
-  "*Program to be used for three-way comparison.
-Must produce output compatible with Unix's diff3 program."
-  :type 'string
-  :group 'ediff-diff)
 (defcustom ediff-diff3-options ""  
   "*Options to pass to `ediff-diff3-program'."
   :set 'ediff-reset-diff-options
--- a/lisp/ediff-help.el	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/ediff-help.el	Fri Nov 24 08:15:11 2000 +0000
@@ -144,8 +144,10 @@
   "The long help message that the user can customize.
 See `ediff-brief-help-message-function' for more.")
 
-(defvar ediff-use-long-help-message nil
-  "*If t, Ediff displays a long help message.  Short help message otherwise.")
+(defcustom ediff-use-long-help-message nil
+  "*If t, Ediff displays a long help message.  Short help message otherwise."
+  :type 'boolean
+  :group 'ediff-window)
 
 ;; The actual help message.
 (ediff-defvar-local ediff-help-message ""
--- a/lisp/ediff-init.el	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/ediff-init.el	Fri Nov 24 08:15:11 2000 +0000
@@ -1683,17 +1683,9 @@
 	((eq jobname 'ediff-merge-directory-revisions-with-ancestor)
 	 "Merge dir versions via ancestors")
 	(t
-	 (let* ((str (substring (symbol-name jobname) 6))
-		(len (length str))
-		(pos 0))
-	   (while (< pos len)
-	     (if (= pos 0)
-		 (aset str pos (upcase (aref str pos))))
-	     (if (= (aref str pos) ?-)
-		 (aset str pos ?\ ))
-	     (setq pos (1+ pos)))
-	   str))))
-
+	 (capitalize
+	  (subst-char-in-string ?- ?\  (substring (symbol-name jobname) 6))))
+	))
 
 
 (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end)
--- a/lisp/ediff-wind.el	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/ediff-wind.el	Fri Nov 24 08:15:11 2000 +0000
@@ -151,7 +151,7 @@
    '(vertical-scroll-bars . nil)  ; Emacs only
    '(scrollbar-width . 0)         ; XEmacs only
    '(menu-bar-lines . 0)          ; Emacs only
-   '(tool-bar-lines . 0)      ; Emacs 21+ only
+   '(tool-bar-lines . 0)          ; Emacs 21+ only
    ;; don't lower and auto-raise
    '(auto-lower . nil)
    '(auto-raise . t)
@@ -842,9 +842,6 @@
 		    (or
 		     (ediff-frame-has-dedicated-windows (selected-frame))
 		     (ediff-frame-iconified-p (selected-frame))
-		     ;; skip small frames
-		     (< (frame-height (selected-frame))
-			(* 3 window-min-height))
 		     ;; skip small windows
 		     (< (window-height (selected-window))
 			(* 3 window-min-height))
--- a/lisp/emulation/viper-cmd.el	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/emulation/viper-cmd.el	Fri Nov 24 08:15:11 2000 +0000
@@ -597,7 +597,7 @@
   (interactive)
   (if (and viper-first-time (not (viper-is-in-minibuffer)))
       (viper-mode)
-    (if overwrite-mode (overwrite-mode nil))
+    (if overwrite-mode (overwrite-mode -1))
     (or (viper-overlay-p viper-replace-overlay)
       (viper-set-replace-overlay (point-min) (point-min)))
     (viper-hide-replace-overlay)
@@ -646,8 +646,13 @@
      (viper-message-conditions conds))))
 
 (defsubst viper-downgrade-to-insert ()
- (setq viper-current-state 'insert-state
-       viper-replace-minor-mode nil))
+  ;; Protect against user errors in hooks
+  (condition-case conds
+      (run-hooks 'viper-insert-state-hook)
+    (error
+     (viper-message-conditions conds)))
+  (setq viper-current-state 'insert-state
+	viper-replace-minor-mode nil))
 
 
 
@@ -2210,7 +2215,7 @@
   ;; guard against a smartie who switched from R-replace to normal replace
   (remove-hook
    'viper-post-command-hooks 'viper-R-state-post-command-sentinel 'local)
-  (if overwrite-mode (overwrite-mode nil))
+  (if overwrite-mode (overwrite-mode -1))
   )
 
 
--- a/lisp/emulation/viper-init.el	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/emulation/viper-init.el	Fri Nov 24 08:15:11 2000 +0000
@@ -947,19 +947,19 @@
   :prefix "viper-"
   :group 'viper)
 
-(defcustom viper-vi-state-hook nil
+(defcustom viper-vi-state-hook 'viper-restore-cursor-type
   "*Hooks run just before the switch to Vi mode is completed."
   :type 'hook
   :group 'viper-hooks)
-(defcustom viper-insert-state-hook nil
+(defcustom viper-insert-state-hook 'viper-set-insert-cursor-type
   "*Hooks run just before the switch to Insert mode is completed."
   :type 'hook
   :group 'viper-hooks)
-(defcustom viper-replace-state-hook nil
+(defcustom viper-replace-state-hook 'viper-restore-cursor-type
   "*Hooks run just before the switch to Replace mode is completed."
   :type 'hook
   :group 'viper-hooks)
-(defcustom viper-emacs-state-hook nil
+(defcustom viper-emacs-state-hook 'viper-restore-cursor-type
   "*Hooks run just before the switch to Emacs mode is completed."
   :type 'hook
   :group 'viper-hooks)
@@ -969,6 +969,16 @@
   :type 'hook
   :group 'viper-hooks)
 
+(defun viper-restore-cursor-type ()
+  (if viper-xemacs-p
+      (setq bar-cursor nil)
+    (setq cursor-type default-cursor-type)))
+
+(defun viper-set-insert-cursor-type ()
+  (if viper-xemacs-p
+      (setq bar-cursor 2)
+    (setq cursor-type '(bar . 2))))
+
 
 ;;; Local Variables:
 ;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
--- a/lisp/emulation/viper-util.el	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/emulation/viper-util.el	Fri Nov 24 08:15:11 2000 +0000
@@ -102,17 +102,15 @@
       (symbol-function
        (if viper-xemacs-p 'characterp 'integerp)))
 
-; CHAR is supposed to be a char or an integer; LIST is a list of chars, nil,
-; and negative numbers
-; Check if CHAR is a member by trying to convert into integers, if necessary.
-; Introduced for compatibility with XEmacs, where integers are not the same as
-; chars.
+;; CHAR is supposed to be a char or an integer (positive or negative)
+;; LIST is a list of chars, nil, and negative numbers
+;; Check if CHAR is a member by trying to convert into integers, if necessary.
+;; Introduced for compatibility with XEmacs, where integers are not the same as
+;; chars.
 (defun viper-memq-char (char list)
   (cond (viper-emacs-p (memq char list))
-	((null char) (memq char list))
-	((characterp char) (memq char list))
-	((integerp char) (memq (int-to-char char) list))
-	(t nil)))
+	((and (integerp char) (>= char 0)) (memq (int-to-char char) list))
+	((memq char list))))
 
 ;; Like =, but accommodates null and also is t for eq-objects
 (defun viper= (char char1)
--- a/lisp/emulation/viper.el	Fri Nov 24 06:32:05 2000 +0000
+++ b/lisp/emulation/viper.el	Fri Nov 24 08:15:11 2000 +0000
@@ -592,6 +592,9 @@
 		    ))
 	      (viper-set-expert-level 'dont-change-unless)))
 
+	(if viper-xemacs-p
+	    (make-variable-buffer-local 'bar-cursor))
+
 	(or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi
 	    (memq major-mode viper-insert-state-mode-list) ; don't switch
 	    (viper-change-state-to-vi)))))
@@ -660,6 +663,7 @@
   ;; Ideally, we would like to be able to de-localize local variables 
   (viper-delocalize-var 'minor-mode-map-alist)
   (viper-delocalize-var 'require-final-newline)
+  (if viper-xemacs-p (viper-delocalize-var 'bar-cursor))
 
   
   ;; deactivate all advices done by Viper.