changeset 82467:ff85cbd27ee2

2007-08-19 Michael Kifer <kifer@cs.stonybrook.edu> * viper.el (viper-remove-hooks): remove some additional viper hooks when the user calls viper-go-away. (viper-go-away): restore the default of default-major-mode. Save the value of default-major-mode before vaperization. * viper-cmd.el: Replace error "" with "Viper bell". * viper-ex.el: Replace error "" with "Viper bell". * ediff-util.el (ediff-make-temp-file): use the coding system of the buffer for which file is created.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sun, 19 Aug 2007 13:47:08 +0000
parents 168363a0236b
children 4f98fbdaf9ce
files lisp/ChangeLog lisp/ediff-util.el lisp/ediff.el lisp/emulation/viper-cmd.el lisp/emulation/viper-ex.el lisp/emulation/viper.el
diffstat 6 files changed, 47 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Aug 19 03:05:35 2007 +0000
+++ b/lisp/ChangeLog	Sun Aug 19 13:47:08 2007 +0000
@@ -1,3 +1,17 @@
+2007-08-19  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* viper.el (viper-remove-hooks): remove some additional viper hooks
+	when the user calls viper-go-away.
+	(viper-go-away): restore the default of default-major-mode.
+	Save the value of default-major-mode before vaperization.
+	
+	* viper-cmd.el: Replace error "" with "Viper bell".
+	
+	* viper-ex.el: Replace error "" with "Viper bell".
+	
+	* ediff-util.el (ediff-make-temp-file): use the coding system of the
+	buffer for which file is created.
+	
 2007-08-19  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (custom-deps, finder-data, autoloads, recompile)
--- a/lisp/ediff-util.el	Sun Aug 19 03:05:35 2007 +0000
+++ b/lisp/ediff-util.el	Sun Aug 19 13:47:08 2007 +0000
@@ -3164,7 +3164,11 @@
 (defun ediff-make-temp-file (buff &optional prefix given-file start end)
   (let* ((p (ediff-convert-standard-filename (or prefix "ediff")))
 	 (short-p p)
-	 (coding-system-for-write ediff-coding-system-for-write)
+	 (coding-system-for-write
+	  (ediff-with-current-buffer buff
+	    (if (boundp 'buffer-file-coding-system)
+		buffer-file-coding-system
+	      ediff-coding-system-for-write)))
 	 f short-f)
     (if (and (fboundp 'msdos-long-file-names)
 	     (not (msdos-long-file-names))
--- a/lisp/ediff.el	Sun Aug 19 03:05:35 2007 +0000
+++ b/lisp/ediff.el	Sun Aug 19 13:47:08 2007 +0000
@@ -8,7 +8,7 @@
 ;; Keywords: comparing, merging, patching, tools, unix
 
 (defconst ediff-version "2.81.2" "The current version of Ediff")
-(defconst ediff-date "June 13, 2007" "Date of last update")
+(defconst ediff-date "August 18, 2007" "Date of last update")
 
 
 ;; This file is part of GNU Emacs.
--- a/lisp/emulation/viper-cmd.el	Sun Aug 19 03:05:35 2007 +0000
+++ b/lisp/emulation/viper-cmd.el	Sun Aug 19 13:47:08 2007 +0000
@@ -1116,7 +1116,7 @@
   "Function that implements ESC key in Viper emulation of Vi."
   (interactive)
   (let ((cmd (or (key-binding (viper-envelop-ESC-key))
-		 '(lambda () (interactive) (error "")))))
+		 '(lambda () (interactive) (error "Viper bell")))))
 
     ;; call the actual function to execute ESC (if no other symbols followed)
     ;; or the key bound to the ESC sequence (if the sequence was issued
@@ -1238,7 +1238,7 @@
 	  ;; it is an error.
 	  (progn
 	    ;; new com is (CHAR . OLDCOM)
-	    (if (viper-memq-char char '(?# ?\")) (error ""))
+	    (if (viper-memq-char char '(?# ?\")) (error "Viper bell"))
 	    (setq com (cons char com))
 	    (setq cont nil))
 	;; If com is nil we set com as char, and read more.  Again, if char is
@@ -1257,7 +1257,7 @@
 	       (let ((reg (read-char)))
 		 (if (viper-valid-register reg)
 		     (setq viper-use-register reg)
-		   (error ""))
+		   (error "Viper bell"))
 		 (setq char (read-char))))
 	      (t
 	       (setq com char)
@@ -1279,7 +1279,7 @@
 	      (viper-regsuffix-command-p char)
 	      (viper= char ?!) ; bang command
 	      (viper= char ?g) ; the gg command (like G0)
-	      (error ""))
+	      (error "Viper bell"))
 	  (setq cmd-to-exec-at-end
 		(viper-exec-form-in-vi
 		 `(key-binding (char-to-string ,char)))))
@@ -1313,7 +1313,7 @@
 	 ((equal com '(?= . ?=)) (viper-line (cons value ?=)))
 	 ;; gg  acts as G0
 	 ((equal (car com) ?g)   (viper-goto-line 0))
-	 (t (error "")))))
+	 (t (error "Viper bell")))))
     
     (if cmd-to-exec-at-end
 	(progn
@@ -2738,9 +2738,9 @@
 	  ;; the forward motion before the 'viper-execute-com', but, of
 	  ;; course, 'dl' doesn't work on an empty line, so we have to
 	  ;; catch that condition before 'viper-execute-com'
-	  (if (and (eolp) (bolp)) (error "") (forward-char val))
+	  (if (and (eolp) (bolp)) (error "Viper bell") (forward-char val))
 	  (if com (viper-execute-com 'viper-forward-char val com))
-	  (if (eolp) (progn (backward-char 1) (error ""))))
+	  (if (eolp) (progn (backward-char 1) (error "Viper bell"))))
       (forward-char val)
       (if com (viper-execute-com 'viper-forward-char val com)))))
 
@@ -2755,7 +2755,7 @@
     (if com (viper-move-marker-locally 'viper-com-point (point)))
     (if viper-ex-style-motion
 	(progn
-	  (if (bolp) (error "") (backward-char val))
+	  (if (bolp) (error "Viper bell") (backward-char val))
 	  (if com (viper-execute-com 'viper-backward-char val com)))
       (backward-char val)
       (if com (viper-execute-com 'viper-backward-char val com)))))
@@ -3078,7 +3078,7 @@
     (if com (viper-execute-com 'viper-goto-col val com))
     (save-excursion
       (end-of-line)
-      (if (> val (current-column)) (error "")))
+      (if (> val (current-column)) (error "Viper bell")))
     ))
 
 
@@ -3198,7 +3198,7 @@
 ;; If FORWARD then search is forward, otherwise backward.  OFFSET is used to
 ;; adjust point after search.
 (defun viper-find-char (arg char forward offset)
-  (or (char-or-string-p char) (error ""))
+  (or (char-or-string-p char) (error "Viper bell"))
   (let ((arg (if forward arg (- arg)))
 	(cmd (if (eq viper-intermediate-command 'viper-repeat)
 		 (nth 5 viper-d-com)
@@ -3544,7 +3544,7 @@
 	     (if com (viper-move-marker-locally 'viper-com-point (point)))
 	     (backward-sexp 1)
 	     (if com (viper-execute-com 'viper-paren-match nil com)))
-	    (t (error ""))))))
+	    (t (error "Viper bell"))))))
 
 (defun viper-toggle-parse-sexp-ignore-comments ()
   (interactive)
@@ -4107,7 +4107,7 @@
 	    (let ((reg viper-use-register))
 	      (setq viper-use-register nil)
 	      (error viper-EmptyRegister reg))
-	  (error "")))
+	  (error "Viper bell")))
     (setq viper-use-register nil)
     (if (viper-end-with-a-newline-p text)
 	(progn
@@ -4157,7 +4157,7 @@
 	    (let ((reg viper-use-register))
 	      (setq viper-use-register nil)
 	      (error viper-EmptyRegister reg))
-	  (error "")))
+	  (error "Viper bell")))
     (setq viper-use-register nil)
     (if (viper-end-with-a-newline-p text) (beginning-of-line))
     (viper-set-destructive-command
@@ -4202,7 +4202,7 @@
 	     (> val (viper-chars-in-region (point) (viper-line-pos 'end))))
 	(setq val (viper-chars-in-region (point) (viper-line-pos 'end))))
     (if (and viper-ex-style-motion (eolp))
-	(if (bolp) (error "") (setq val 0))) ; not bol---simply back 1 ch
+	(if (bolp) (error "Viper bell") (setq val 0))) ; not bol---simply back 1 ch
     (save-excursion
       (viper-forward-char-carefully val)
       (setq end-del-pos (point)))
@@ -4467,7 +4467,7 @@
 	  ((viper= char ?,) (viper-cycle-through-mark-ring))
 	  ((viper= char ?^) (push-mark viper-saved-mark t t))
 	  ((viper= char ?D) (mark-defun))
-	  (t (error ""))
+	  (t (error "Viper bell"))
 	  )))
 
 ;; Algorithm: If first invocation of this command save mark on ring, goto
@@ -4566,7 +4566,7 @@
 		 (switch-to-buffer buff)
 		 (goto-char viper-com-point)
 		 (viper-change-state-to-vi)
-		 (error "")))))
+		 (error "Viper bell")))))
 	((and (not skip-white) (viper= char ?`))
 	 (if com (viper-move-marker-locally 'viper-com-point (point)))
 	 (if (and (viper-same-line (point) viper-last-jump)
--- a/lisp/emulation/viper-ex.el	Sun Aug 19 03:05:35 2007 +0000
+++ b/lisp/emulation/viper-ex.el	Sun Aug 19 13:47:08 2007 +0000
@@ -1236,7 +1236,7 @@
 		(read-string "[Hit return to confirm] ")
 	      (quit
 	       (save-excursion (kill-buffer " *delete text*"))
-	       (error "")))
+	       (error "Viper bell")))
 	    (save-excursion (kill-buffer " *delete text*")))
 	(if ex-buffer
 	    (cond ((viper-valid-register ex-buffer '(Letter))
--- a/lisp/emulation/viper.el	Sun Aug 19 03:05:35 2007 +0000
+++ b/lisp/emulation/viper.el	Sun Aug 19 13:47:08 2007 +0000
@@ -9,7 +9,7 @@
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Keywords: emulations
 
-(defconst viper-version "3.14 of June 14, 2007"
+(defconst viper-version "3.14 of August 18, 2007"
   "The current version of Viper")
 
 ;; This file is part of GNU Emacs.
@@ -646,6 +646,11 @@
 	 (remove-hook symbol 'viper-change-state-to-emacs)
 	 (remove-hook symbol 'viper-change-state-to-insert)
 	 (remove-hook symbol 'viper-change-state-to-vi)
+	 (remove-hook symbol 'viper-minibuffer-post-command-hook)
+	 (remove-hook symbol 'viper-minibuffer-setup-sentinel)
+	 (remove-hook symbol 'viper-major-mode-change-sentinel)
+	 (remove-hook symbol 'set-viper-state-in-major-mode)
+	 (remove-hook symbol 'viper-post-command-sentinel)
 	 )))
 
 ;; Remove local value in all existing buffers
@@ -682,6 +687,9 @@
    global-mode-string
    (delq 'viper-mode-string global-mode-string))
 
+  (setq default-major-mode
+	(viper-standard-value 'default-major-mode viper-saved-non-viper-variables))
+
   (if viper-emacs-p
       (setq-default
        mark-even-if-inactive
@@ -772,9 +780,7 @@
   (mapatoms 'viper-remove-hooks)
   (remove-hook 'comint-mode-hook 'viper-comint-mode-hook)
   (remove-hook 'erc-mode-hook 'viper-comint-mode-hook)
-  (remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel)
   (remove-hook 'change-major-mode-hook 'viper-major-mode-change-sentinel)
-  (remove-hook 'post-command-hook 'viper-minibuffer-post-command-hook)
 
   ;; unbind Viper mouse bindings
   (viper-unbind-mouse-search-key)
@@ -1214,6 +1220,7 @@
 (if (null viper-saved-non-viper-variables)
     (setq viper-saved-non-viper-variables
 	  (list
+	   (cons 'default-major-mode (list default-major-mode))
 	   (cons 'next-line-add-newlines (list next-line-add-newlines))
 	   (cons 'require-final-newline (list require-final-newline))
 	   (cons 'scroll-step (list scroll-step))