summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kifer <kifer@cs.stonybrook.edu>2005-06-03 08:04:04 +0000
committerMichael Kifer <kifer@cs.stonybrook.edu>2005-06-03 08:04:04 +0000
commit899a431bae4a7b48a266c5da56610a5ea44febad (patch)
tree38050620920c4ff4b5bd4dc2c4f3267dfe76eef2
parentd06e384795d5ca4e82c88273847eeb9d01380046 (diff)
downloademacs-899a431bae4a7b48a266c5da56610a5ea44febad.tar.gz
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.
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/ediff-diff.el62
-rw-r--r--lisp/ediff-help.el2
-rw-r--r--lisp/ediff-mult.el10
-rw-r--r--lisp/ediff-util.el2
-rw-r--r--lisp/ediff.el2
-rw-r--r--lisp/emulation/viper-keym.el19
-rw-r--r--lisp/emulation/viper.el7
8 files changed, 83 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c9c4d26844b..df9f3993878 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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.
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el
index 4c13e6fc0e1..ec496301405 100644
--- a/lisp/ediff-diff.el
+++ b/lisp/ediff-diff.el
@@ -1353,7 +1353,7 @@ Symlinks and the likes are not handled.
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 @@ affects only files whose names match the expression."
(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 @@ affects only files whose names match the expression."
)
)
+;; 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)
diff --git a/lisp/ediff-help.el b/lisp/ediff-help.el
index bdd92f5c12d..69d170faedf 100644
--- a/lisp/ediff-help.el
+++ b/lisp/ediff-help.el
@@ -132,7 +132,7 @@ Normally, not a user option. See `ediff-help-message' for details.")
"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 ""
diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el
index 41a7699cfdc..88ab31fe56a 100644
--- a/lisp/ediff-mult.el
+++ b/lisp/ediff-mult.el
@@ -560,17 +560,23 @@ behavior."
(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
diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el
index b7b39f405e5..b952c2fb2bf 100644
--- a/lisp/ediff-util.el
+++ b/lisp/ediff-util.el
@@ -117,7 +117,7 @@ Commands:
(kill-all-local-variables)
(setq major-mode 'ediff-mode)
(setq mode-name "Ediff")
- (run-mode-hooks 'ediff-mode-hook))
+ (run-hooks 'ediff-mode-hook))
diff --git a/lisp/ediff.el b/lisp/ediff.el
index 2a2b481ec59..00a7e2f512a 100644
--- a/lisp/ediff.el
+++ b/lisp/ediff.el
@@ -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.
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el
index a74ca05b3df..f14f67d94c8 100644
--- a/lisp/emulation/viper-keym.el
+++ b/lisp/emulation/viper-keym.el
@@ -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)
+
+(defcustom viper-quoted-insert-key "\C-v"
+ "The key used to quote special characters when inserting them in Insert state."
+ :type 'string
+ :group 'viper)
-(defvar viper-ESC-key "\e"
+(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 @@ viper-insert-basic-map. Not recommended, except for novice users.")
(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)
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index e3582f2165a..3fdbccc2957 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -990,12 +990,13 @@ remains buffer-local."
(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: "))))