2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
authorMichael Kifer <kifer@cs.stonybrook.edu>
Fri, 2 Nov 2007 06:03:12 +0000 (06:03 +0000)
committerMichael Kifer <kifer@cs.stonybrook.edu>
Fri, 2 Nov 2007 06:03:12 +0000 (06:03 +0000)
* viper-ex.el (viper-ex): do not ignore the region.

* viper-cmd.el (viper-prev-destructive-command)
(viper-insert-prev-from-insertion-ring): use ring-copy instead of
copy-sequence.

* ediff-util.el (ediff-make-current-diff-overlay): do not use face-name.
Got rid of ediff-copy-list.

* ediff-diff.el (ediff-set-fine-diff-properties-in-one-buffer): do not
use face-name.
(ediff-test-utility,ediff-diff-mandatory-option)
(ediff-reset-diff-options): removed to simplify yhe mandatory option
handling on windows.
(ediff-set-diff-options): added.
(ediff-diff-options): changed.

* ediff-vers.el (ediff-vc-internal): use ediff-vc-revision-other-window.
(ediff-vc-merge-internal): use ediff-vc-revision-other-window and
ediff-vc-working-revision.
Require vc-hooks.

ChangeLog
lisp/ediff-diff.el
lisp/ediff-util.el
lisp/ediff-vers.el
lisp/emulation/viper-cmd.el
lisp/emulation/viper-ex.el

index fd23fce..7778b53 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2007-11-02  Michael Kifer  <kifer@cs.stonybrook.edu>
+       
+       * viper-ex.el (viper-ex): do not ignore the region.
+       
+       * viper-cmd.el (viper-prev-destructive-command)
+       (viper-insert-prev-from-insertion-ring): use ring-copy instead of
+       copy-sequence.
+
+       * ediff-util.el (ediff-make-current-diff-overlay): do not use face-name.
+       Got rid of ediff-copy-list.
+       
+       * ediff-diff.el (ediff-set-fine-diff-properties-in-one-buffer): do not
+       use face-name.
+       (ediff-test-utility,ediff-diff-mandatory-option)
+       (ediff-reset-diff-options): removed to simplify yhe mandatory option
+       handling on windows.
+       (ediff-set-diff-options): added.
+       (ediff-diff-options): changed.
+       
+       * ediff-vers.el (ediff-vc-internal): use ediff-vc-revision-other-window.
+       (ediff-vc-merge-internal): use ediff-vc-revision-other-window and
+       ediff-vc-working-revision.
+       Require vc-hooks.
+       
 2007-11-01  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * configure.in: Remove HAVE_X11R5 check.
index 451f87e..06d7b60 100644 (file)
@@ -48,7 +48,6 @@
   :prefix "ediff-"
   :group 'ediff)
 
-;; these two must be here to prevent ediff-test-utility from barking
 (defcustom ediff-diff-program "diff"
   "*Program to use for generating the differential of the two files."
   :type 'string
@@ -62,46 +61,8 @@ Must produce output compatible with Unix's diff3 program."
 
 ;; The following functions must precede all defcustom-defined variables.
 
-;; The following functions needed for setting diff/diff3 options
-;; test if diff supports the --binary option
-(defsubst ediff-test-utility (diff-util option &optional files)
-  (condition-case nil
-      (eq 0 (apply 'call-process
-                  (append (list diff-util nil nil nil option) files)))
-    (error (format "Cannot execute program %S." diff-util)))
-  )
-
-(defun ediff-diff-mandatory-option (diff-util)
-  (let ((file (if (boundp 'null-device) null-device "/dev/null")))
-    (cond  ((not (memq system-type '(ms-dos windows-nt windows-95)))
-           "")
-          ((and (string= diff-util ediff-diff-program)
-                (ediff-test-utility
-                 ediff-diff-program "--binary" (list file file)))
-           "--binary ")
-          ((and (string= diff-util ediff-diff3-program)
-                (ediff-test-utility
-                 ediff-diff3-program "--binary" (list file file file)))
-           "--binary ")
-          (t ""))))
-
-
-;; must be before ediff-reset-diff-options to avoid compiler errors
 (fset 'ediff-set-actual-diff-options '(lambda () nil))
 
-;; make sure that mandatory options are added even if the user changes
-;; ediff-diff-options or ediff-diff3-options in the customization widget
-(defun ediff-reset-diff-options (symb val)
-  (let* ((diff-program
-         (if (eq symb 'ediff-diff-options)
-             ediff-diff-program
-           ediff-diff3-program))
-        (mandatory-option (ediff-diff-mandatory-option diff-program)))
-    (set symb (concat mandatory-option val))
-    (ediff-set-actual-diff-options)
-    ))
-
-
 (defcustom ediff-shell
   (cond ((eq system-type 'emx) "cmd") ; OS/2
        ((memq system-type '(ms-dos windows-nt windows-95))
@@ -130,17 +91,25 @@ are `-I REGEXP', to ignore changes whose lines match the REGEXP."
   :type '(repeat string)
   :group 'ediff-diff)
 
-(defcustom ediff-diff-options ""
+(defun ediff-set-diff-options (symbol value)
+  (set symbol value)
+  (ediff-set-actual-diff-options))
+
+(defcustom ediff-diff-options
+  (if (memq system-type '(ms-dos windows-nt windows-95)) "--binary" "")
   "*Options to pass to `ediff-diff-program'.
 If Unix diff is used as `ediff-diff-program',
 then a useful option is `-w', to ignore space.
 Options `-c', `-u', and `-i' are not allowed. Case sensitivity can be
 toggled interactively using \\[ediff-toggle-ignore-case].
 
+Do not remove the default options. If you need to change this variable, add new
+options after the default ones.
+
 This variable is not for customizing the look of the differences produced by
 the command \\[ediff-show-diff-output]. Use the variable
 `ediff-custom-diff-options' for that."
-  :set 'ediff-reset-diff-options
+  :set 'ediff-set-diff-options
   :type 'string
   :group 'ediff-diff)
 
@@ -179,7 +148,7 @@ This output is not used by Ediff internally."
   "Pattern to match lines produced by diff3 that describe differences.")
 (defcustom ediff-diff3-options ""
   "*Options to pass to `ediff-diff3-program'."
-  :set 'ediff-reset-diff-options
+  :set 'ediff-set-diff-options
   :type 'string
   :group 'ediff-diff)
 
@@ -889,9 +858,9 @@ one optional arguments, diff-number to refine.")
   (let ((fine-diff-vector  (ediff-get-fine-diff-vector n buf-type))
        (face (if default
                  'default
-               (face-name
-                (ediff-get-symbol-from-alist
-                 buf-type ediff-fine-diff-face-alist))))
+               (ediff-get-symbol-from-alist
+                buf-type ediff-fine-diff-face-alist)
+               ))
        (priority (if default
                      0
                    (1+ (or (ediff-overlay-get
index 3bc82dd..f3cffe0 100644 (file)
@@ -3802,9 +3802,8 @@ Ediff Control Panel to restore highlighting."
       (let ((overlay (ediff-get-symbol-from-alist
                      type ediff-current-diff-overlay-alist))
            (buffer (ediff-get-buffer type))
-           (face (face-name
-                  (ediff-get-symbol-from-alist
-                   type ediff-current-diff-face-alist))))
+           (face (ediff-get-symbol-from-alist
+                   type ediff-current-diff-face-alist)))
        (set overlay
             (ediff-make-bullet-proof-overlay (point-max) (point-max) buffer))
        (ediff-set-overlay-face (symbol-value overlay) face)
@@ -4292,20 +4291,7 @@ Mail anyway? (y or n) ")
       (add-to-history history-var newelt)
     (set history-var (cons newelt (symbol-value history-var)))))
 
-(if (fboundp 'copy-sequence)
-    (defalias 'ediff-copy-list 'copy-sequence)
-  (defun ediff-copy-list (list)
-    (if (consp list)
-      ;;;(let ((res nil))
-      ;;;  (while (consp list) (push (pop list) res))
-      ;;;  (prog1 (nreverse res) (setcdr res list)))
-       (let (res elt)
-         (while (consp list)
-           (setq elt (car list)
-                 res (cons elt res)
-                 list (cdr list)))
-         (nreverse res))
-      (car list))))
+(defalias 'ediff-copy-list 'copy-sequence)
 
 
 ;; don't report error if version control package wasn't found
index 98c1def..8ce2bcb 100644 (file)
@@ -52,8 +52,22 @@ comparison or merge operations are being performed."
   :group 'ediff-vers
   )
 
+(defalias 'ediff-vc-revision-other-window
+      (if (fboundp 'vc-revision-other-window)
+         'vc-revision-other-window
+       'vc-version-other-window))
+
+(defalias 'ediff-vc-working-revision
+  (if (fboundp 'vc-working-revision)
+      'vc-working-revision
+    vc-workfile-version))
+
 ;; VC.el support
 
+(eval-when-compile
+  (require 'vc-hooks)) ;; for vc-call macro
+
+
 (defun ediff-vc-latest-version (file)
   "Return the version level of the latest version of FILE in repository."
   (if (fboundp 'vc-latest-version)
@@ -77,12 +91,12 @@ comparison or merge operations are being performed."
        (setq rev1 (ediff-vc-latest-version (buffer-file-name))))
     (save-window-excursion
       (save-excursion
-       (vc-revision-other-window rev1)
+       (ediff-vc-revision-other-window rev1)
        (setq rev1buf (current-buffer)
              file1 (buffer-file-name)))
       (save-excursion
        (or (string= rev2 "")           ; use current buffer
-           (vc-revision-other-window rev2))
+           (ediff-vc-revision-other-window rev2))
        (setq rev2buf (current-buffer)
              file2 (buffer-file-name)))
       (setq startup-hooks
@@ -158,17 +172,17 @@ comparison or merge operations are being performed."
   (let (buf1 buf2 ancestor-buf)
     (save-window-excursion
       (save-excursion
-       (vc-revision-other-window rev1)
+       (ediff-vc-revision-other-window rev1)
        (setq buf1 (current-buffer)))
       (save-excursion
        (or (string= rev2 "")
-           (vc-revision-other-window rev2))
+           (ediff-vc-revision-other-window rev2))
        (setq buf2 (current-buffer)))
       (if ancestor-rev
          (save-excursion
            (if (string= ancestor-rev "")
-               (setq ancestor-rev (vc-working-revision buffer-file-name)))
-           (vc-revision-other-window ancestor-rev)
+               (setq ancestor-rev (ediff-vc-working-revision buffer-file-name)))
+           (ediff-vc-revision-other-window ancestor-rev)
            (setq ancestor-buf (current-buffer))))
       (setq startup-hooks
            (cons
index 82dc312..88af961 100644 (file)
@@ -1902,7 +1902,7 @@ With prefix argument, find next destructive command."
        (setq viper-intermediate-command
              'repeating-display-destructive-command)
       ;; first search through command history--set temp ring
-      (setq viper-temp-command-ring (copy-sequence viper-command-ring)))
+      (setq viper-temp-command-ring (ring-copy viper-command-ring)))
     (setq cmd (if next
                  (viper-special-ring-rotate1 viper-temp-command-ring 1)
                (viper-special-ring-rotate1 viper-temp-command-ring -1)))
@@ -1936,7 +1936,7 @@ to in the global map, instead of cycling through the insertion ring."
                 (length viper-last-inserted-string-from-insertion-ring))))
          )
       ;;first search through insertion history
-      (setq viper-temp-insertion-ring (copy-sequence viper-insertion-ring)))
+      (setq viper-temp-insertion-ring (ring-copy viper-insertion-ring)))
     (setq this-command 'viper-insert-from-insertion-ring)
     ;; so that things will be undone properly
     (setq buffer-undo-list (cons nil buffer-undo-list))
@@ -2790,6 +2790,7 @@ On reaching beginning of line, stop and signal error."
 
 (defun viper-next-line-carefully (arg)
   (condition-case nil
+      ;; do not use forward-line! need to keep column
       (next-line arg)
     (error nil)))
 
@@ -3089,6 +3090,7 @@ On reaching beginning of line, stop and signal error."
   (let ((val (viper-p-val arg))
        (com (viper-getCom arg)))
     (if com (viper-move-marker-locally 'viper-com-point (point)))
+    ;; do not use forward-line! need to keep column
     (next-line val)
     (if viper-ex-style-motion
        (if (and (eolp) (not (bolp))) (backward-char 1)))
@@ -3132,6 +3134,7 @@ If point is on a widget or a button, simulate clicking on that widget/button."
   (let ((val (viper-p-val arg))
        (com (viper-getCom arg)))
     (if com (viper-move-marker-locally 'viper-com-point (point)))
+    ;; do not use forward-line! need to keep column
     (previous-line val)
     (if viper-ex-style-motion
        (if (and (eolp) (not (bolp))) (backward-char 1)))
index 627d2ff..d9cc977 100644 (file)
@@ -651,17 +651,19 @@ reversed."
        (setq initial-str (format "%d,%d" reg-beg-line reg-end-line)))
 
     (setq com-str
-         (or string (viper-read-string-with-history
-                     ":"
-                     initial-str
-                     'viper-ex-history
-                     ;; no default when working on region
-                     (if initial-str
-                         nil
-                       (car viper-ex-history))
-                     map
-                     (if initial-str
-                         " [Type command to execute on current region]"))))
+         (if string
+             (concat initial-str string)
+           (viper-read-string-with-history
+            ":"
+            initial-str
+            'viper-ex-history
+            ;; no default when working on region
+            (if initial-str
+                nil
+              (car viper-ex-history))
+            map
+            (if initial-str
+                " [Type command to execute on current region]"))))
     (save-window-excursion
       ;; just a precaution
       (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))