diff lisp/ediff-init.el @ 38514:10482dd382e7

* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy of Scott Bronson. (ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions. (viper-check-sub,viper-get-ex-command,viper-execute-ex-command): Deleted functions. (viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new ex-token-list. (viper-get-ex-address-subr): convert registers to char data type. * viper-util.el (viper-int-to-char,viper-char-equal): new functions. (viper-memq-char): use viper-int-to-char. (viper-file-checked-in-p): use vc-locking-user, if vc doesn't have vc-locking-state. (viper-read-key): use viper-read-key-sequence. * viper.el (viper-major-mode-modifier-list): added inferior-emacs-lisp-mode. (this-major-mode-requires-vi-state): new function that uses simple heuristics to decide if vi state is appropriate. (set-viper-state-in-major-mode): use this-major-mode-requires-vi-state. (viper-non-hook-settings): don't advise read-key-sequence. (viper-read-key-sequence): new function that replaces the previously used advice to read-key-sequence. * viper-cmd.el (viper-test-com-defun,viper-exec-change, viper-exec-Change,viper-execute-com,viper-insert,viper-append, viper-Append,viper-Insert,viper-open-line,viper-Open-line, viper-open-line-at-point,viper-substitute,viper-overwrite, viper-replace-char-subr,viper-forward-word,viper-forward-Word): got rid of the negative character hack. (viper-escape-to-state,viper-replace-state-exit-cmd): use viper-read-key-sequence. (viper-envelop-ESC-key): no need for ad-get-orig-definition. (viper-minibuffer-standard-hook,viper-read-string-with-history): don't override existing minibuffer-setup-hook. (viper-mark-point,viper-goto-mark-subr,viper-brac-function): convert registers to char data type. (viper-autoindent): use viper-indent-line. * viper-keym.el: use viper-exec-key-in-emacs. * viper.texi: Added credits, new commands, like :make. * ediff-util.el: Copyright years. (ediff-choose-syntax-table): New function. (ediff-setup): Use ediff-choose-syntax-table. (ediff-file-checked-out-p,ediff-file-checked-in-p): check if vc-state is available. (ediff-make-temp-file): use ediff-coding-system-for-write. * ediff-init.el (ediff-with-syntax-table): New macro, uses with-syntax-table. (ediff-coding-system-for-read): from ediff-diff.el (ediff-coding-system-for-write): new variable. (ediff-highest-priority): fixed the bug having to do with disappearing overlays. (ediff-file-remote-p): use file-remote-p, if available. (ediff-listable-file): new function. (ediff-file-attributes): use ediff-listable-file. * ediff-mult.el (ediff-meta-insert-file-info1): use ediff-listable-file. * ediff-ptch.el (ediff-prompt-for-patch-file): use ediff-coding-system-for-read. (ediff-patch-file-internal): use ediff-coding-system-for-write. * ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el. (ediff-match-diff3-line,ediff-get-diff3-group): improved pattern. * ediff.el: Date of last update, copyright years. * ediff-wind (ediff-setup-control-frame): Nill->nil. * ediff.texi: added clarifications, acknowledgements.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 21 Jul 2001 05:28:24 +0000
parents 7a94f1c588c4
children 8dccf2552307
line wrap: on
line diff
--- a/lisp/ediff-init.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/ediff-init.el	Sat Jul 21 05:28:24 2001 +0000
@@ -1,4 +1,4 @@
-;;; ediff-init.el --- macros, variables, and defsubsts used by Ediff
+;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
 
 ;; Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
 
@@ -714,6 +714,22 @@
   :type 'symbol
   :group 'ediff)
 
+(defcustom ediff-coding-system-for-read 'raw-text
+  "*The coding system for read to use when running the diff program as a subprocess. 
+In most cases, the default will do. However, under certain circumstances in
+Windows NT/98/95 you might need to use something like 'raw-text-dos here.
+So, if the output that your diff program sends to Emacs contains extra ^M's,
+you might need to experiment here, if the default or 'raw-text-dos doesn't
+work."
+  :type 'symbol
+  :group 'ediff)
+
+(defcustom ediff-coding-system-for-write 'no-conversion
+  "*The coding system for write to use when writing out difference regions
+to temp files when Ediff needs to find fine differences."
+  :type 'symbol
+  :group 'ediff)
+
 
 (if ediff-xemacs-p
     (progn
@@ -1174,7 +1190,7 @@
 (ediff-defvar-local ediff-current-diff-overlay-Ancestor nil
   "Overlay for the current difference region in the ancestor buffer.")
 
-;; Compute priority of ediff overlay.
+;; Compute priority of a current ediff overlay.
 (defun ediff-highest-priority (start end buffer)
   (let ((pos (max 1 (1- start)))
 	ovr-list)
@@ -1184,13 +1200,21 @@
 	(while (< pos (min (point-max) (1+ end)))
 	  (setq ovr-list (append (overlays-at pos) ovr-list))
 	  (setq pos (next-overlay-change pos)))
-	(1+ (apply '+
-		   (mapcar (lambda (ovr)
-			     (if ovr
-				 (or (ediff-overlay-get ovr 'priority) 0)
-			       0))
-			   ovr-list)
-		   ))
+	(+ 1 ediff-shadow-overlay-priority
+	   (apply 'max
+		  (mapcar
+		   (lambda (ovr)
+		     (if (and ovr
+			      ;; exclude ediff overlays from priority
+			      ;; calculation, or else priority will keep
+			      ;; increasing
+			      (null (ediff-overlay-get ovr 'ediff))
+			      (null (ediff-overlay-get ovr 'ediff-diff-num)))
+			 ;; use the overlay priority or 0
+			 (or (ediff-overlay-get ovr 'priority) 0)
+		       0))
+		   ovr-list)
+		  ))
 	))))
 
 
@@ -1281,14 +1305,16 @@
 
 ;;; In-line functions
 
-(or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it
-    (defun ediff-file-remote-p (file-name)
+;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check
+;; if find-file-name-handler is defined for 'file-local-copy
+(defun ediff-file-remote-p (file-name)
+  (or (and (fboundp 'file-remote-p) (file-remote-p file-name))
       (find-file-name-handler file-name 'file-local-copy)))
-;;;      (or (and (featurep 'efs-auto) (efs-ftp-path file-name))
-;;;	  (and (featurep 'tramp) (tramp-tramp-file-p file-name))
-;;;	  (and (fboundp 'file-remote-p) (file-remote-p file-name))
-;;;	  ;; Can happen only in Emacs, since XEmacs has file-remote-p
-;;;	  (and (require 'ange-ftp) (ange-ftp-ftp-name file-name)))))
+
+;; File for which we can get attributes, such as size or date
+(defun ediff-listable-file (file-name)
+  (let ((handler (find-file-name-handler file-name 'file-local-copy)))
+    (or (null handler) (eq handler 'dired-handler-fn))))
 
 
 (defsubst ediff-frame-unsplittable-p (frame)
@@ -1740,9 +1766,10 @@
       (apply 'message string args)))
 
 (defun ediff-file-attributes (filename attr-number)
-  (if (ediff-file-remote-p filename)
-      -1
-    (nth attr-number (file-attributes filename))))
+  (if (ediff-listable-file filename)
+      (nth attr-number (file-attributes filename))
+    -1)
+  )
 
 (defsubst ediff-file-size (filename)
   (ediff-file-attributes filename 7))