changeset 62963:fcacef2ed810

2005-06-03 Michael Kifer <kifer@cs.stonybrook.edu> * ediff-diff.el (ediff-same-contents) Eliminate CL-type functions. * ediff-mult.el (ediff-intersect-directories) Make sure that ".." and "." files are deleted from all file lists before comparison * viper-keym.el (viper-toggle-key,viper-quoted-insert-key,viper-ESC-key): Made them customizable. * viper.el (viper-non-hook-settings): fixed the names of defadvices.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Fri, 03 Jun 2005 08:04:04 +0000
parents 6ab08ae41502
children 6b3810cab95a
files lisp/ChangeLog lisp/ediff-diff.el lisp/ediff-help.el lisp/ediff-mult.el lisp/ediff-util.el lisp/ediff.el lisp/emulation/viper-keym.el lisp/emulation/viper.el
diffstat 8 files changed, 83 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Jun 02 12:27:05 2005 +0000
+++ b/lisp/ChangeLog	Fri Jun 03 08:04:04 2005 +0000
@@ -1,3 +1,16 @@
+2005-06-03  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* ediff-diff.el (ediff-same-contents) Eliminate CL-type functions.
+	
+	* ediff-mult.el (ediff-intersect-directories) Make sure that ".." and
+	"." files are deleted from all file lists before comparison
+	
+	* viper-keym.el
+	(viper-toggle-key,viper-quoted-insert-key,viper-ESC-key):
+	Made them customizable.
+	
+	* viper.el (viper-non-hook-settings): fixed the names of defadvices.
+	
 2005-06-01  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* autorevert.el (auto-revert-buffers): Use save-match-data.
--- a/lisp/ediff-diff.el	Thu Jun 02 12:27:05 2005 +0000
+++ b/lisp/ediff-diff.el	Fri Jun 03 08:04:04 2005 +0000
@@ -1353,7 +1353,7 @@
 If FILTER-RE is non-nil, recursive checking in directories
 affects only files whose names match the expression."
   ;; Normalize empty filter RE to nil.
-  (unless (length filter-re) (setq filter-re nil))
+  (unless (> (length filter-re) 0) (setq filter-re nil))
   ;; Indicate progress
   (message "Comparing '%s' and '%s' modulo '%s'" d1 d2 filter-re)
   (cond
@@ -1367,27 +1367,11 @@
     (if (eq ediff-recurse-to-subdirectories 'yes)
 	(let* ((all-entries-1 (directory-files d1 t filter-re))
 	       (all-entries-2 (directory-files d2 t filter-re))
-	       (entries-1 (remove-if (lambda (s)
-				       (string-match "^\\.\\.?$"
-						     (file-name-nondirectory s))) 
-				     all-entries-1))
-	       (entries-2 (remove-if (lambda (s)
-				       (string-match "^\\.\\.?$"
-						     (file-name-nondirectory s)))
-				     all-entries-2))
+	       (entries-1 (ediff-delete-all-matches "^\\.\\.?$" all-entries-1))
+	       (entries-2 (ediff-delete-all-matches "^\\.\\.?$" all-entries-2))
 	       )
-	  ;; First, check only the names (works quickly and ensures a
-	  ;; precondition for subsequent code)
-	  (if (and (= (length entries-1) (length entries-2))
-		   (every (lambda (a b) (equal (file-name-nondirectory a)
-					       (file-name-nondirectory b)))
-			  entries-1 entries-2))
-	      ;; With name equality established, compare the entries
-	      ;; through recursion.
-	      (every (lambda (a b)
-		       (ediff-same-contents a b filter-re))
-		     entries-1 entries-2)
-	    )
+
+	  (ediff-same-file-contents-lists entries-1 entries-2 filter-re)
 	  ))
     ) ; end of the directories case
    ;; D1 & D2 are both files => compare directly
@@ -1398,6 +1382,42 @@
    )
   )
 
+;; If lists have the same length and names of files are pairwise equal
+;; (removing the directories) then compare contents pairwise.
+;; True if all contents are the same; false otherwise
+(defun ediff-same-file-contents-lists (entries-1 entries-2 filter-re)
+  ;; First, check only the names (works quickly and ensures a
+  ;; precondition for subsequent code)
+  (if (and (= (length entries-1) (length entries-2))
+	   (equal (mapcar 'file-name-nondirectory entries-1)
+		  (mapcar 'file-name-nondirectory entries-2)))
+      ;; With name equality established, compare the entries
+      ;; through recursion.
+      (let ((continue t))
+	(while (and entries-1 continue)
+	  (if (ediff-same-contents
+	       (car entries-1) (car entries-2) filter-re)
+	      (setq entries-1 (cdr entries-1)
+		    entries-2 (cdr entries-2))
+	    (setq continue nil))
+	  )
+	;; if reached the end then lists are equal
+	(null entries-1))
+    )
+  )
+
+
+;; ARG1 is a regexp, ARG2 is a list of full-filenames
+;; Delete all entries that match the regexp
+(defun ediff-delete-all-matches (regex file-list-list)
+  (let (result elt)
+    (while file-list-list
+      (setq elt (car file-list-list))
+      (or (string-match regex (file-name-nondirectory elt))
+	  (setq result (cons elt result)))
+      (setq file-list-list (cdr file-list-list)))
+    (reverse result)))
+
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
--- a/lisp/ediff-help.el	Thu Jun 02 12:27:05 2005 +0000
+++ b/lisp/ediff-help.el	Fri Jun 03 08:04:04 2005 +0000
@@ -132,7 +132,7 @@
   "Normally, not a user option.  See `ediff-help-message' for details.")
 
 (defconst ediff-brief-message-string
-  " ? -quick help "
+  " Type ? for help"
   "Contents of the brief help message.")
 ;; The actual brief help message
 (ediff-defvar-local ediff-brief-help-message ""
--- a/lisp/ediff-mult.el	Thu Jun 02 12:27:05 2005 +0000
+++ b/lisp/ediff-mult.el	Fri Jun 03 08:04:04 2005 +0000
@@ -560,17 +560,23 @@
 			   (ediff-add-slash-if-directory auxdir1 elt))
 			 lis1)
 	  auxdir2	(file-name-as-directory dir2)
+	  lis2		(directory-files auxdir2 nil regexp)
+	  lis2 		(delete "."  lis2)
+	  lis2 		(delete ".." lis2)
 	  lis2		(mapcar
 			 (lambda (elt)
 			   (ediff-add-slash-if-directory auxdir2 elt))
-			 (directory-files auxdir2 nil regexp)))
+			 lis2))
 
     (if (stringp dir3)
 	(setq auxdir3	(file-name-as-directory dir3)
+	      lis3	(directory-files auxdir3 nil regexp)
+	      lis3 	(delete "."  lis3)
+	      lis3 	(delete ".." lis3)
 	      lis3	(mapcar
 			 (lambda (elt)
 			   (ediff-add-slash-if-directory auxdir3 elt))
-			 (directory-files auxdir3 nil regexp))))
+			 lis3)))
 
     (if (ediff-nonempty-string-p merge-autostore-dir)
 	(setq merge-autostore-dir
--- a/lisp/ediff-util.el	Thu Jun 02 12:27:05 2005 +0000
+++ b/lisp/ediff-util.el	Fri Jun 03 08:04:04 2005 +0000
@@ -117,7 +117,7 @@
   (kill-all-local-variables)
   (setq major-mode 'ediff-mode)
   (setq mode-name "Ediff")
-  (run-mode-hooks 'ediff-mode-hook))
+  (run-hooks 'ediff-mode-hook))
 
 
 
--- a/lisp/ediff.el	Thu Jun 02 12:27:05 2005 +0000
+++ b/lisp/ediff.el	Fri Jun 03 08:04:04 2005 +0000
@@ -7,7 +7,7 @@
 ;; Keywords: comparing, merging, patching, tools, unix
 
 (defconst ediff-version "2.80" "The current version of Ediff")
-(defconst ediff-date "February 19, 2005" "Date of last update")  
+(defconst ediff-date "June 3, 2005" "Date of last update")  
 
 
 ;; This file is part of GNU Emacs.
--- a/lisp/emulation/viper-keym.el	Thu Jun 02 12:27:05 2005 +0000
+++ b/lisp/emulation/viper-keym.el	Fri Jun 03 08:04:04 2005 +0000
@@ -50,16 +50,25 @@
 
 ;;; Variables
 
-(defvar viper-toggle-key "\C-z"
+(defcustom viper-toggle-key "\C-z"
   "The key used to change states from emacs to Vi and back.
 In insert mode, this key also functions as Meta.
 Must be set in .viper file or prior to loading Viper.
-This setting cannot be changed interactively.")
+This setting cannot be changed interactively."
+  :type 'string
+  :group 'viper)
 
-(defvar viper-ESC-key "\e"
+(defcustom viper-quoted-insert-key "\C-v"
+  "The key used to quote special characters when inserting them in Insert state."
+  :type 'string
+  :group 'viper)
+
+(defcustom viper-ESC-key "\e"
   "Key used to ESC.
 Must be set in .viper file or prior to loading Viper.
-This setting cannot be changed interactively.")
+This setting cannot be changed interactively."
+  :type 'string
+  :group 'viper)
 
 ;;; Emacs keys in other states.
 
@@ -242,7 +251,7 @@
 (define-key viper-insert-basic-map "\C-t" 'viper-forward-indent)
 (define-key viper-insert-basic-map
   (if viper-xemacs-p [(shift tab)] [S-tab]) 'viper-insert-tab)
-(define-key viper-insert-basic-map "\C-v" 'quoted-insert)
+(define-key viper-insert-basic-map viper-quoted-insert-key 'quoted-insert)
 (define-key viper-insert-basic-map "\C-?" 'viper-del-backward-char-in-insert)
 (define-key viper-insert-basic-map [backspace] 'viper-del-backward-char-in-insert)
 (define-key viper-insert-basic-map "\C-\\" 'viper-alternate-Meta-key)
--- a/lisp/emulation/viper.el	Thu Jun 02 12:27:05 2005 +0000
+++ b/lisp/emulation/viper.el	Fri Jun 03 08:04:04 2005 +0000
@@ -990,12 +990,13 @@
       (setq global-mode-string
 	    (append '("" viper-mode-string) (cdr global-mode-string))))
 
-  (defadvice describe-key (before viper-read-keyseq-ad protect activate)
+  (defadvice describe-key (before viper-describe-key-ad protect activate)
     "Force to read key via `viper-read-key-sequence'."
-    (interactive (list (viper-read-key-sequence "Describe key: "))))
+    (interactive (list (viper-read-key-sequence "Describe key: "))
+		 ))
 
   (defadvice describe-key-briefly
-    (before viper-read-keyseq-ad protect activate)
+    (before viper-describe-key-briefly-ad protect activate)
     "Force to read key via `viper-read-key-sequence'."
     (interactive (list (viper-read-key-sequence "Describe key briefly: "))))