changeset 65856:d64aeb0dc54e

2005-10-05 Michael Kifer <kifer@cs.stonybrook.edu> * ediff-merge.el (ediff-merge-region-is-non-clash): new defsubst. (ediff-merge-region-is-non-clash-to-skip): previouslu called ediff-merge-region-is-non-clash. * ediff-mult.el (ediff-append-custom-diff,ediff-meta-show-patch): use insert-buffer-substring. * ediff-ptch.el (ediff-fixup-patch-map): use better heuristics for selecting files to patch. Also bug fixes. * ediff-util.el (ediff-setup): bug fix. (ediff-next-difference): Never skip clashes that differ in white space only. * ediff-wind.el (ediff-setup-control-frame,ediff-destroy-control-frame): check the menubar feature. * viper-cmd.el (viper-normalize-minor-mode-map-alist, viper-refresh-mode-line): use make-local-variable to localize some vars instead of make-variable-buffer-local. Suggested by Stefan Monnier. * viper-init.el (viper-make-variable-buffer-local): delete alias. (viper-restore-cursor-type,viper-set-insert-cursor-type): use make-local-variable instead of make-variable-buffer-local. Suggested by Stefan Monnier. * viper.el (viper-mode): don't use viper-make-variable-buffer-local. (viper-comint-mode-hook): use make-local-variable on require-final-newline. (viper-non-hook-settings): don't use make-variable-buffer-local.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Thu, 06 Oct 2005 00:09:49 +0000
parents 97ab21c68453
children 528399f4c636
files lisp/ChangeLog lisp/ediff-merg.el lisp/ediff-mult.el lisp/ediff-ptch.el lisp/ediff-util.el lisp/ediff-wind.el lisp/ediff.el lisp/emulation/viper-cmd.el lisp/emulation/viper-init.el lisp/emulation/viper.el
diffstat 10 files changed, 96 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/ChangeLog	Thu Oct 06 00:09:49 2005 +0000
@@ -12,6 +12,39 @@
 	(gdb-locals-mode): Use `gdb-local-font-lock-keywords'
 	(gdb-threads-font-lock-keywords): New font lock keywords definition.
 	(gdb-threads-mode): Use `gdb-threads-font-lock-keywords'.
+	
+2005-10-05  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* ediff-merge.el (ediff-merge-region-is-non-clash): new defsubst.
+	(ediff-merge-region-is-non-clash-to-skip): previouslu called
+	ediff-merge-region-is-non-clash.
+	
+	* ediff-mult.el (ediff-append-custom-diff,ediff-meta-show-patch): use
+	insert-buffer-substring.
+	
+	* ediff-ptch.el (ediff-fixup-patch-map): use better heuristics for
+	selecting files to patch. Also bug fixes.
+	
+	* ediff-util.el (ediff-setup): bug fix.
+	(ediff-next-difference): Never skip clashes that differ in white space
+	only.
+	
+	* ediff-wind.el (ediff-setup-control-frame,ediff-destroy-control-frame):
+	check the menubar feature.
+	
+	* viper-cmd.el (viper-normalize-minor-mode-map-alist,
+	viper-refresh-mode-line): use make-local-variable to localize some vars
+	instead of make-variable-buffer-local. Suggested by Stefan Monnier.
+	
+	* viper-init.el (viper-make-variable-buffer-local): delete alias.
+	(viper-restore-cursor-type,viper-set-insert-cursor-type): use
+	make-local-variable instead of make-variable-buffer-local. Suggested by
+	Stefan Monnier.
+	
+	* viper.el (viper-mode): don't use viper-make-variable-buffer-local.
+	(viper-comint-mode-hook): use make-local-variable on
+	require-final-newline.
+	(viper-non-hook-settings): don't use make-variable-buffer-local.
 
 2005-10-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
--- a/lisp/ediff-merg.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/ediff-merg.el	Thu Oct 06 00:09:49 2005 +0000
@@ -103,11 +103,15 @@
   )
 (make-variable-buffer-local 'ediff-skip-merge-regions-that-differ-from-default)
 
+;; check if there is no clash between the ancestor and one of the variants.
+(defsubst ediff-merge-region-is-non-clash (n)
+  (string-match "prefer" (or (ediff-get-state-of-merge n) "")))
+
 ;; If ediff-show-clashes-only, check if there is no clash between the ancestor
 ;; and one of the variants.
-(defsubst ediff-merge-region-is-non-clash (n)
+(defsubst ediff-merge-region-is-non-clash-to-skip (n)
   (and ediff-show-clashes-only
-       (string-match "prefer" (or (ediff-get-state-of-merge n) ""))))
+       (ediff-merge-region-is-non-clash n)))
 
 ;; If ediff-skip-changed-regions, check if the merge region differs from
 ;; the current default. If a region is different from the default, it means
--- a/lisp/ediff-mult.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/ediff-mult.el	Thu Oct 06 00:09:49 2005 +0000
@@ -1624,7 +1624,7 @@
 	   (save-excursion
 	     (set-buffer meta-diff-buff)
 	     (goto-char (point-max))
-	     (insert-buffer custom-diff-buf)
+	     (insert-buffer-substring custom-diff-buf)
 	     (insert "\n")))
 	  ;; if ediff session is not live, run diff directly on the files
 	  ((memq metajob '(ediff-directories
@@ -1643,7 +1643,7 @@
 	   (save-excursion
 	     (set-buffer meta-diff-buff)
 	     (goto-char (point-max))
-	     (insert-buffer tmp-buf)
+	     (insert-buffer-substring tmp-buf)
 	     (insert "\n")))
 	  (t
 	   (ediff-kill-buffer-carefully meta-diff-buff)
@@ -1691,7 +1691,8 @@
 	       (ediff-get-session-objC-name info)))
 	    (set-buffer (get-buffer-create ediff-tmp-buffer))
 	    (erase-buffer)
-	    (insert-buffer patchbuffer)
+	    (insert-buffer-substring patchbuffer)
+	    (goto-char (point-min))
 	    (display-buffer ediff-tmp-buffer 'not-this-window)
 	    ))
       (error "The patch buffer wasn't found"))))
--- a/lisp/ediff-ptch.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/ediff-ptch.el	Thu Oct 06 00:09:49 2005 +0000
@@ -297,16 +297,23 @@
 		      ;; (file1 . file2). Get it using ediff-get-session-objA.
 		      (ediff-get-session-objA-name session-info))
 		     ;; base-dir1 is  the dir part of the 1st file in the patch
-		     (base-dir1 (file-name-directory (car proposed-file-names)))
+		     (base-dir1
+		      (or (file-name-directory (car proposed-file-names))
+			  ""))
 		     ;; directory part of the 2nd file in the patch
-		     (base-dir2 (file-name-directory (cdr proposed-file-names)))
+		     (base-dir2
+		      (or (file-name-directory (cdr proposed-file-names))
+			  ""))
 		     )
-		;; If both base-dir1 and base-dir2 are relative, assume that
+		;; If both base-dir1 and base-dir2 are relative and exist,
+		;; assume that
 		;; these dirs lead to the actual files starting at the present
 		;; directory. So, we don't strip these relative dirs from the
 		;; file names. This is a heuristic intended to improve guessing
-		(unless (or (and base-dir1 (file-name-absolute-p base-dir1))
-			    (and base-dir2 (file-name-absolute-p base-dir2)))
+		(unless (or (file-name-absolute-p base-dir1)
+			    (file-name-absolute-p base-dir2)
+			    (not (file-exists-p base-dir1))
+			    (not (file-exists-p base-dir2)))
 		  (setq base-dir1 ""
 			base-dir2 ""))
 		(or (string= (car proposed-file-names) "/dev/null")
@@ -377,8 +384,8 @@
 			   (concat actual-dir (cdr proposed-file-names)))))
 		))
 	    ediff-patch-map)
-    ;; check for the shorter existing file in each pair and discard the other
-    ;; one
+    ;; Check for the existing files in each pair and discard the nonexisting
+    ;; ones. If both exist, ask the user.
     (mapcar (lambda (session-info)
 	      (let* ((file1 (car (ediff-get-session-objA-name session-info)))
 		     (file2 (cdr (ediff-get-session-objA-name session-info)))
--- a/lisp/ediff-util.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/ediff-util.el	Thu Oct 06 00:09:49 2005 +0000
@@ -329,7 +329,7 @@
 	    ediff-word-mode-job (ediff-word-mode-job))
 
       ;; Don't delete variants in case of ediff-buffer-* jobs without asking.
-      ;; This is because u may loose work---dangerous.
+      ;; This is because one may loose work---dangerous.
       (if (string-match "buffer" (symbol-name ediff-job-name))
 	  (setq ediff-keep-variants t))
 
@@ -368,6 +368,7 @@
 	    (save-excursion
 	      (set-buffer buffer-C)
 	      (insert-buffer-substring buf)
+	      (goto-char (point-min))
 	      (funcall (ediff-with-current-buffer buf major-mode))
 	      (widen) ; merge buffer is always widened
 	      (add-hook 'local-write-file-hooks 'ediff-set-merge-mode nil t)
@@ -1729,7 +1730,7 @@
 	(or (>= n ediff-number-of-differences)
 	    (setq regexp-skip (funcall ediff-skip-diff-region-function n))
 	    ;; this won't exec if regexp-skip is t
-	    (setq non-clash-skip (ediff-merge-region-is-non-clash n)
+	    (setq non-clash-skip (ediff-merge-region-is-non-clash-to-skip n)
 		  skip-changed
 		  (ediff-skip-merge-region-if-changed-from-default-p n))
 	    (ediff-install-fine-diff-if-necessary n))
@@ -1744,6 +1745,7 @@
 		     skip-changed
 		     ;; skip difference regions that differ in white space
 		     (and ediff-ignore-similar-regions
+			  (ediff-merge-region-is-non-clash n)
 			  (or (eq (ediff-no-fine-diffs-p n) t)
 			      (and (ediff-merge-job)
 				   (eq (ediff-no-fine-diffs-p n) 'C)))
@@ -1754,7 +1756,7 @@
 	  (or (>= n ediff-number-of-differences)
 	      (setq regexp-skip (funcall ediff-skip-diff-region-function n))
 	      ;; this won't exec if regexp-skip is t
-	      (setq non-clash-skip (ediff-merge-region-is-non-clash n)
+	      (setq non-clash-skip (ediff-merge-region-is-non-clash-to-skip n)
 		    skip-changed
 		    (ediff-skip-merge-region-if-changed-from-default-p n))
 	      (ediff-install-fine-diff-if-necessary n))
@@ -1778,7 +1780,7 @@
 	(or (< n 0)
 	    (setq regexp-skip (funcall ediff-skip-diff-region-function n))
 	    ;; this won't exec if regexp-skip is t
-	    (setq non-clash-skip (ediff-merge-region-is-non-clash n)
+	    (setq non-clash-skip (ediff-merge-region-is-non-clash-to-skip n)
 		  skip-changed
 		  (ediff-skip-merge-region-if-changed-from-default-p n))
 	    (ediff-install-fine-diff-if-necessary n))
@@ -1802,7 +1804,7 @@
 	  (or (< n 0)
 	      (setq regexp-skip (funcall ediff-skip-diff-region-function n))
 	      ;; this won't exec if regexp-skip is t
-	      (setq non-clash-skip (ediff-merge-region-is-non-clash n)
+	      (setq non-clash-skip (ediff-merge-region-is-non-clash-to-skip n)
 		    skip-changed
 		    (ediff-skip-merge-region-if-changed-from-default-p n))
 	      (ediff-install-fine-diff-if-necessary n))
--- a/lisp/ediff-wind.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/ediff-wind.el	Thu Oct 06 00:09:49 2005 +0000
@@ -900,7 +900,7 @@
 
     (ediff-with-current-buffer ctl-buffer
       (ediff-cond-compile-for-xemacs-or-emacs
-       (set-buffer-menubar nil) ; xemacs
+       (when (featurep 'menubar) (set-buffer-menubar nil)) ; xemacs
        nil ; emacs
        )
       ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse))
@@ -1054,7 +1054,8 @@
     (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))
 	(let ((ctl-frame ediff-control-frame))
 	  (ediff-cond-compile-for-xemacs-or-emacs
-	   (set-buffer-menubar default-menubar) ; xemacs
+	   (when (featurep 'menubar)
+	     (set-buffer-menubar default-menubar)) ; xemacs
 	   nil ; emacs
 	   )
 	  (setq ediff-control-frame nil)
--- a/lisp/ediff.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/ediff.el	Thu Oct 06 00:09:49 2005 +0000
@@ -8,7 +8,7 @@
 ;; Keywords: comparing, merging, patching, tools, unix
 
 (defconst ediff-version "2.80.1" "The current version of Ediff")
-(defconst ediff-date "September 19, 2005" "Date of last update")
+(defconst ediff-date "October 5, 2005" "Date of last update")
 
 
 ;; This file is part of GNU Emacs.
--- a/lisp/emulation/viper-cmd.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/emulation/viper-cmd.el	Thu Oct 06 00:09:49 2005 +0000
@@ -494,13 +494,20 @@
 		       viper-empty-keymap))
 	       ))
 	
-  ;; in emacs with emulation-mode-map-alists, nothing needs to be done
+  ;; This var is not local in Emacs, so we make it local.  It must be local
+  ;; because although the stack of minor modes can be the same for all buffers,
+  ;; the associated *keymaps* can be different.  In Viper,
+  ;; viper-vi-local-user-map, viper-insert-local-user-map, and others can have
+  ;; different keymaps for different buffers.  Also, the keymaps associated
+  ;; with viper-vi/insert-state-modifier-minor-mode can be different.
+  ;; ***This is needed only in case emulation-mode-map-alists is not defined.
+  ;; In emacs with emulation-mode-map-alists, nothing needs to be done
   (unless
       (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
-    (setq minor-mode-map-alist
-	  (viper-append-filter-alist
-	   (append viper--intercept-key-maps viper--key-maps)
-	   minor-mode-map-alist)))
+    (set (make-local-variable 'minor-mode-map-alist)
+         (viper-append-filter-alist
+          (append viper--intercept-key-maps viper--key-maps)
+          minor-mode-map-alist)))
   )
 
 
@@ -509,7 +516,7 @@
 
 ;; Modifies mode-line-buffer-identification.
 (defun viper-refresh-mode-line ()
-  (setq viper-mode-string
+  (set (make-local-variable 'viper-mode-string)
 	(cond ((eq viper-current-state 'emacs-state) viper-emacs-state-id)
 	      ((eq viper-current-state 'vi-state) viper-vi-state-id)
 	      ((eq viper-current-state 'replace-state) viper-replace-state-id)
@@ -4781,7 +4788,7 @@
 	      level-changed t)
 	(insert "
 Please specify your level of familiarity with the venomous VI PERil
-(and the VI Plan for Emacs Rescue).
+\(and the VI Plan for Emacs Rescue).
 You can change it at any time by typing `M-x viper-set-expert-level RET'
 
  1 -- BEGINNER: Almost all Emacs features are suppressed.
@@ -5000,5 +5007,5 @@
 
 
 
-;;; arch-tag: 739a6450-5fda-44d0-88b0-325053d888c2
+;; arch-tag: 739a6450-5fda-44d0-88b0-325053d888c2
 ;;; viper-cmd.el ends here
--- a/lisp/emulation/viper-init.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/emulation/viper-init.el	Thu Oct 06 00:09:49 2005 +0000
@@ -115,11 +115,6 @@
 
 ;;; Macros
 
-;; Fool the compiler to avoid warnings.
-;; Viper calls make-variable-buffer-local from within other functions, which
-;; triggers compiler warnings.
-(defalias 'viper-make-variable-buffer-local 'make-variable-buffer-local)
-
 (defmacro viper-deflocalvar (var default-value &optional documentation)
   `(progn
     (defvar ,var ,default-value
@@ -1019,19 +1014,19 @@
 (defun viper-restore-cursor-type ()
   (condition-case nil
       (if viper-xemacs-p
-	  (setq bar-cursor nil)
+	  (set (make-local-variable 'bar-cursor) nil)
 	(setq cursor-type default-cursor-type))
     (error nil)))
 
 (defun viper-set-insert-cursor-type ()
   (if viper-xemacs-p
-      (setq bar-cursor 2)
+      (set (make-local-variable 'bar-cursor) 2)
     (setq cursor-type '(bar . 2))))
 
 
-;;; Local Variables:
-;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
-;;; End:
+;; Local Variables:
+;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
+;; End:
 
-;;; arch-tag: 4efa2416-1fcb-4690-be10-1a2a0248d250
+;; arch-tag: 4efa2416-1fcb-4690-be10-1a2a0248d250
 ;;; viper-init.el ends here
--- a/lisp/emulation/viper.el	Wed Oct 05 17:20:04 2005 +0000
+++ b/lisp/emulation/viper.el	Thu Oct 06 00:09:49 2005 +0000
@@ -9,7 +9,7 @@
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Keywords: emulations
 
-(defconst viper-version "3.11.5 of September 19, 2005"
+(defconst viper-version "3.11.5 of October 5, 2005"
   "The current version of Viper")
 
 ;; This file is part of GNU Emacs.
@@ -605,8 +605,6 @@
 		    ))
 	      (viper-set-expert-level 'dont-change-unless)))
 
-	(if viper-xemacs-p
-	    (viper-make-variable-buffer-local 'bar-cursor))
 	(if (eq major-mode 'viper-mode)
 	    (setq major-mode 'fundamental-mode))
 
@@ -627,8 +625,8 @@
 
 ;; This hook designed to enable Vi-style editing in comint-based modes."
 (defun viper-comint-mode-hook ()
-  (setq require-final-newline nil
-	viper-ex-style-editing nil
+  (set (make-local-variable 'require-final-newline) nil)
+  (setq viper-ex-style-editing nil
 	viper-ex-style-motion nil)
   (viper-change-state-to-insert))
 
@@ -1000,17 +998,6 @@
 ;; these are primarily advices and Vi-ish variable settings
 (defun viper-non-hook-settings ()
 
-  ;; This var is not local in Emacs, so we make it local.  It must be local
-  ;; because although the stack of minor modes can be the same for all buffers,
-  ;; the associated *keymaps* can be different.  In Viper,
-  ;; viper-vi-local-user-map, viper-insert-local-user-map, and others can have
-  ;; different keymaps for different buffers.  Also, the keymaps associated
-  ;; with viper-vi/insert-state-modifier-minor-mode can be different.
-  ;; ***This is needed only in case emulation-mode-map-alists is not defined
-  (unless
-      (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
-    (viper-make-variable-buffer-local 'minor-mode-map-alist))
-
   ;; Viper changes the default mode-line-buffer-identification
   (setq-default mode-line-buffer-identification '(" %b"))
 
@@ -1018,8 +1005,6 @@
   (setq next-line-add-newlines nil
 	require-final-newline t)
 
-  (viper-make-variable-buffer-local 'require-final-newline)
-
   ;; don't bark when mark is inactive
   (if viper-emacs-p
       (setq mark-even-if-inactive t))
@@ -1027,7 +1012,6 @@
   (setq scroll-step 1)
 
   ;; Variable displaying the current Viper state in the mode line.
-  (viper-deflocalvar viper-mode-string viper-emacs-state-id)
   (or (memq 'viper-mode-string global-mode-string)
       (setq global-mode-string
 	    (append '("" viper-mode-string) (cdr global-mode-string))))
@@ -1336,9 +1320,9 @@
 (provide 'viper)
 
 
-;;; Local Variables:
-;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
-;;; End:
+;; Local Variables:
+;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
+;; End:
 
-;;; arch-tag: 5f3e844c-c4e6-4bbd-9b73-63bdc14e7d79
+;; arch-tag: 5f3e844c-c4e6-4bbd-9b73-63bdc14e7d79
 ;;; viper.el ends here