aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Kifer2005-06-03 08:04:04 +0000
committerMichael Kifer2005-06-03 08:04:04 +0000
commit899a431bae4a7b48a266c5da56610a5ea44febad (patch)
tree38050620920c4ff4b5bd4dc2c4f3267dfe76eef2 /lisp
parentd06e384795d5ca4e82c88273847eeb9d01380046 (diff)
downloademacs-899a431bae4a7b48a266c5da56610a5ea44febad.tar.gz
emacs-899a431bae4a7b48a266c5da56610a5ea44febad.zip
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.
Diffstat (limited to 'lisp')
-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 @@
12005-06-03 Michael Kifer <kifer@cs.stonybrook.edu>
2
3 * ediff-diff.el (ediff-same-contents) Eliminate CL-type functions.
4
5 * ediff-mult.el (ediff-intersect-directories) Make sure that ".." and
6 "." files are deleted from all file lists before comparison
7
8 * viper-keym.el
9 (viper-toggle-key,viper-quoted-insert-key,viper-ESC-key):
10 Made them customizable.
11
12 * viper.el (viper-non-hook-settings): fixed the names of defadvices.
13
12005-06-01 Luc Teirlinck <teirllm@auburn.edu> 142005-06-01 Luc Teirlinck <teirllm@auburn.edu>
2 15
3 * autorevert.el (auto-revert-buffers): Use save-match-data. 16 * 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.
1353If FILTER-RE is non-nil, recursive checking in directories 1353If FILTER-RE is non-nil, recursive checking in directories
1354affects only files whose names match the expression." 1354affects only files whose names match the expression."
1355 ;; Normalize empty filter RE to nil. 1355 ;; Normalize empty filter RE to nil.
1356 (unless (length filter-re) (setq filter-re nil)) 1356 (unless (> (length filter-re) 0) (setq filter-re nil))
1357 ;; Indicate progress 1357 ;; Indicate progress
1358 (message "Comparing '%s' and '%s' modulo '%s'" d1 d2 filter-re) 1358 (message "Comparing '%s' and '%s' modulo '%s'" d1 d2 filter-re)
1359 (cond 1359 (cond
@@ -1367,27 +1367,11 @@ affects only files whose names match the expression."
1367 (if (eq ediff-recurse-to-subdirectories 'yes) 1367 (if (eq ediff-recurse-to-subdirectories 'yes)
1368 (let* ((all-entries-1 (directory-files d1 t filter-re)) 1368 (let* ((all-entries-1 (directory-files d1 t filter-re))
1369 (all-entries-2 (directory-files d2 t filter-re)) 1369 (all-entries-2 (directory-files d2 t filter-re))
1370 (entries-1 (remove-if (lambda (s) 1370 (entries-1 (ediff-delete-all-matches "^\\.\\.?$" all-entries-1))
1371 (string-match "^\\.\\.?$" 1371 (entries-2 (ediff-delete-all-matches "^\\.\\.?$" all-entries-2))
1372 (file-name-nondirectory s)))
1373 all-entries-1))
1374 (entries-2 (remove-if (lambda (s)
1375 (string-match "^\\.\\.?$"
1376 (file-name-nondirectory s)))
1377 all-entries-2))
1378 ) 1372 )
1379 ;; First, check only the names (works quickly and ensures a 1373
1380 ;; precondition for subsequent code) 1374 (ediff-same-file-contents-lists entries-1 entries-2 filter-re)
1381 (if (and (= (length entries-1) (length entries-2))
1382 (every (lambda (a b) (equal (file-name-nondirectory a)
1383 (file-name-nondirectory b)))
1384 entries-1 entries-2))
1385 ;; With name equality established, compare the entries
1386 ;; through recursion.
1387 (every (lambda (a b)
1388 (ediff-same-contents a b filter-re))
1389 entries-1 entries-2)
1390 )
1391 )) 1375 ))
1392 ) ; end of the directories case 1376 ) ; end of the directories case
1393 ;; D1 & D2 are both files => compare directly 1377 ;; D1 & D2 are both files => compare directly
@@ -1398,6 +1382,42 @@ affects only files whose names match the expression."
1398 ) 1382 )
1399 ) 1383 )
1400 1384
1385;; If lists have the same length and names of files are pairwise equal
1386;; (removing the directories) then compare contents pairwise.
1387;; True if all contents are the same; false otherwise
1388(defun ediff-same-file-contents-lists (entries-1 entries-2 filter-re)
1389 ;; First, check only the names (works quickly and ensures a
1390 ;; precondition for subsequent code)
1391 (if (and (= (length entries-1) (length entries-2))
1392 (equal (mapcar 'file-name-nondirectory entries-1)
1393 (mapcar 'file-name-nondirectory entries-2)))
1394 ;; With name equality established, compare the entries
1395 ;; through recursion.
1396 (let ((continue t))
1397 (while (and entries-1 continue)
1398 (if (ediff-same-contents
1399 (car entries-1) (car entries-2) filter-re)
1400 (setq entries-1 (cdr entries-1)
1401 entries-2 (cdr entries-2))
1402 (setq continue nil))
1403 )
1404 ;; if reached the end then lists are equal
1405 (null entries-1))
1406 )
1407 )
1408
1409
1410;; ARG1 is a regexp, ARG2 is a list of full-filenames
1411;; Delete all entries that match the regexp
1412(defun ediff-delete-all-matches (regex file-list-list)
1413 (let (result elt)
1414 (while file-list-list
1415 (setq elt (car file-list-list))
1416 (or (string-match regex (file-name-nondirectory elt))
1417 (setq result (cons elt result)))
1418 (setq file-list-list (cdr file-list-list)))
1419 (reverse result)))
1420
1401 1421
1402;;; Local Variables: 1422;;; Local Variables:
1403;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) 1423;;; 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.")
132 "Normally, not a user option. See `ediff-help-message' for details.") 132 "Normally, not a user option. See `ediff-help-message' for details.")
133 133
134(defconst ediff-brief-message-string 134(defconst ediff-brief-message-string
135 " ? -quick help " 135 " Type ? for help"
136 "Contents of the brief help message.") 136 "Contents of the brief help message.")
137;; The actual brief help message 137;; The actual brief help message
138(ediff-defvar-local ediff-brief-help-message "" 138(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."
560 (ediff-add-slash-if-directory auxdir1 elt)) 560 (ediff-add-slash-if-directory auxdir1 elt))
561 lis1) 561 lis1)
562 auxdir2 (file-name-as-directory dir2) 562 auxdir2 (file-name-as-directory dir2)
563 lis2 (directory-files auxdir2 nil regexp)
564 lis2 (delete "." lis2)
565 lis2 (delete ".." lis2)
563 lis2 (mapcar 566 lis2 (mapcar
564 (lambda (elt) 567 (lambda (elt)
565 (ediff-add-slash-if-directory auxdir2 elt)) 568 (ediff-add-slash-if-directory auxdir2 elt))
566 (directory-files auxdir2 nil regexp))) 569 lis2))
567 570
568 (if (stringp dir3) 571 (if (stringp dir3)
569 (setq auxdir3 (file-name-as-directory dir3) 572 (setq auxdir3 (file-name-as-directory dir3)
573 lis3 (directory-files auxdir3 nil regexp)
574 lis3 (delete "." lis3)
575 lis3 (delete ".." lis3)
570 lis3 (mapcar 576 lis3 (mapcar
571 (lambda (elt) 577 (lambda (elt)
572 (ediff-add-slash-if-directory auxdir3 elt)) 578 (ediff-add-slash-if-directory auxdir3 elt))
573 (directory-files auxdir3 nil regexp)))) 579 lis3)))
574 580
575 (if (ediff-nonempty-string-p merge-autostore-dir) 581 (if (ediff-nonempty-string-p merge-autostore-dir)
576 (setq merge-autostore-dir 582 (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:
117 (kill-all-local-variables) 117 (kill-all-local-variables)
118 (setq major-mode 'ediff-mode) 118 (setq major-mode 'ediff-mode)
119 (setq mode-name "Ediff") 119 (setq mode-name "Ediff")
120 (run-mode-hooks 'ediff-mode-hook)) 120 (run-hooks 'ediff-mode-hook))
121 121
122 122
123 123
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 @@
7;; Keywords: comparing, merging, patching, tools, unix 7;; Keywords: comparing, merging, patching, tools, unix
8 8
9(defconst ediff-version "2.80" "The current version of Ediff") 9(defconst ediff-version "2.80" "The current version of Ediff")
10(defconst ediff-date "February 19, 2005" "Date of last update") 10(defconst ediff-date "June 3, 2005" "Date of last update")
11 11
12 12
13;; This file is part of GNU Emacs. 13;; 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 @@
50 50
51;;; Variables 51;;; Variables
52 52
53(defvar viper-toggle-key "\C-z" 53(defcustom viper-toggle-key "\C-z"
54 "The key used to change states from emacs to Vi and back. 54 "The key used to change states from emacs to Vi and back.
55In insert mode, this key also functions as Meta. 55In insert mode, this key also functions as Meta.
56Must be set in .viper file or prior to loading Viper. 56Must be set in .viper file or prior to loading Viper.
57This setting cannot be changed interactively.") 57This setting cannot be changed interactively."
58 :type 'string
59 :group 'viper)
60
61(defcustom viper-quoted-insert-key "\C-v"
62 "The key used to quote special characters when inserting them in Insert state."
63 :type 'string
64 :group 'viper)
58 65
59(defvar viper-ESC-key "\e" 66(defcustom viper-ESC-key "\e"
60 "Key used to ESC. 67 "Key used to ESC.
61Must be set in .viper file or prior to loading Viper. 68Must be set in .viper file or prior to loading Viper.
62This setting cannot be changed interactively.") 69This setting cannot be changed interactively."
70 :type 'string
71 :group 'viper)
63 72
64;;; Emacs keys in other states. 73;;; Emacs keys in other states.
65 74
@@ -242,7 +251,7 @@ viper-insert-basic-map. Not recommended, except for novice users.")
242(define-key viper-insert-basic-map "\C-t" 'viper-forward-indent) 251(define-key viper-insert-basic-map "\C-t" 'viper-forward-indent)
243(define-key viper-insert-basic-map 252(define-key viper-insert-basic-map
244 (if viper-xemacs-p [(shift tab)] [S-tab]) 'viper-insert-tab) 253 (if viper-xemacs-p [(shift tab)] [S-tab]) 'viper-insert-tab)
245(define-key viper-insert-basic-map "\C-v" 'quoted-insert) 254(define-key viper-insert-basic-map viper-quoted-insert-key 'quoted-insert)
246(define-key viper-insert-basic-map "\C-?" 'viper-del-backward-char-in-insert) 255(define-key viper-insert-basic-map "\C-?" 'viper-del-backward-char-in-insert)
247(define-key viper-insert-basic-map [backspace] 'viper-del-backward-char-in-insert) 256(define-key viper-insert-basic-map [backspace] 'viper-del-backward-char-in-insert)
248(define-key viper-insert-basic-map "\C-\\" 'viper-alternate-Meta-key) 257(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."
990 (setq global-mode-string 990 (setq global-mode-string
991 (append '("" viper-mode-string) (cdr global-mode-string)))) 991 (append '("" viper-mode-string) (cdr global-mode-string))))
992 992
993 (defadvice describe-key (before viper-read-keyseq-ad protect activate) 993 (defadvice describe-key (before viper-describe-key-ad protect activate)
994 "Force to read key via `viper-read-key-sequence'." 994 "Force to read key via `viper-read-key-sequence'."
995 (interactive (list (viper-read-key-sequence "Describe key: ")))) 995 (interactive (list (viper-read-key-sequence "Describe key: "))
996 ))
996 997
997 (defadvice describe-key-briefly 998 (defadvice describe-key-briefly
998 (before viper-read-keyseq-ad protect activate) 999 (before viper-describe-key-briefly-ad protect activate)
999 "Force to read key via `viper-read-key-sequence'." 1000 "Force to read key via `viper-read-key-sequence'."
1000 (interactive (list (viper-read-key-sequence "Describe key briefly: ")))) 1001 (interactive (list (viper-read-key-sequence "Describe key briefly: "))))
1001 1002