comparison 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
comparison
equal deleted inserted replaced
38513:144b56521d1d 38514:10482dd382e7
1 ;;; ediff-init.el --- macros, variables, and defsubsts used by Ediff 1 ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
2 2
3 ;; Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
4 4
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
712 people find the other two packages more convenient. Set this variable to the 712 people find the other two packages more convenient. Set this variable to the
713 appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire." 713 appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire."
714 :type 'symbol 714 :type 'symbol
715 :group 'ediff) 715 :group 'ediff)
716 716
717 (defcustom ediff-coding-system-for-read 'raw-text
718 "*The coding system for read to use when running the diff program as a subprocess.
719 In most cases, the default will do. However, under certain circumstances in
720 Windows NT/98/95 you might need to use something like 'raw-text-dos here.
721 So, if the output that your diff program sends to Emacs contains extra ^M's,
722 you might need to experiment here, if the default or 'raw-text-dos doesn't
723 work."
724 :type 'symbol
725 :group 'ediff)
726
727 (defcustom ediff-coding-system-for-write 'no-conversion
728 "*The coding system for write to use when writing out difference regions
729 to temp files when Ediff needs to find fine differences."
730 :type 'symbol
731 :group 'ediff)
732
717 733
718 (if ediff-xemacs-p 734 (if ediff-xemacs-p
719 (progn 735 (progn
720 (fset 'ediff-read-event (symbol-function 'next-command-event)) 736 (fset 'ediff-read-event (symbol-function 'next-command-event))
721 (fset 'ediff-overlayp (symbol-function 'extentp)) 737 (fset 'ediff-overlayp (symbol-function 'extentp))
1172 (ediff-defvar-local ediff-current-diff-overlay-C nil 1188 (ediff-defvar-local ediff-current-diff-overlay-C nil
1173 "Overlay for the current difference region in buffer C.") 1189 "Overlay for the current difference region in buffer C.")
1174 (ediff-defvar-local ediff-current-diff-overlay-Ancestor nil 1190 (ediff-defvar-local ediff-current-diff-overlay-Ancestor nil
1175 "Overlay for the current difference region in the ancestor buffer.") 1191 "Overlay for the current difference region in the ancestor buffer.")
1176 1192
1177 ;; Compute priority of ediff overlay. 1193 ;; Compute priority of a current ediff overlay.
1178 (defun ediff-highest-priority (start end buffer) 1194 (defun ediff-highest-priority (start end buffer)
1179 (let ((pos (max 1 (1- start))) 1195 (let ((pos (max 1 (1- start)))
1180 ovr-list) 1196 ovr-list)
1181 (if ediff-xemacs-p 1197 (if ediff-xemacs-p
1182 (1+ ediff-shadow-overlay-priority) 1198 (1+ ediff-shadow-overlay-priority)
1183 (ediff-with-current-buffer buffer 1199 (ediff-with-current-buffer buffer
1184 (while (< pos (min (point-max) (1+ end))) 1200 (while (< pos (min (point-max) (1+ end)))
1185 (setq ovr-list (append (overlays-at pos) ovr-list)) 1201 (setq ovr-list (append (overlays-at pos) ovr-list))
1186 (setq pos (next-overlay-change pos))) 1202 (setq pos (next-overlay-change pos)))
1187 (1+ (apply '+ 1203 (+ 1 ediff-shadow-overlay-priority
1188 (mapcar (lambda (ovr) 1204 (apply 'max
1189 (if ovr 1205 (mapcar
1190 (or (ediff-overlay-get ovr 'priority) 0) 1206 (lambda (ovr)
1191 0)) 1207 (if (and ovr
1192 ovr-list) 1208 ;; exclude ediff overlays from priority
1193 )) 1209 ;; calculation, or else priority will keep
1210 ;; increasing
1211 (null (ediff-overlay-get ovr 'ediff))
1212 (null (ediff-overlay-get ovr 'ediff-diff-num)))
1213 ;; use the overlay priority or 0
1214 (or (ediff-overlay-get ovr 'priority) 0)
1215 0))
1216 ovr-list)
1217 ))
1194 )))) 1218 ))))
1195 1219
1196 1220
1197 (defvar ediff-toggle-read-only-function nil 1221 (defvar ediff-toggle-read-only-function nil
1198 "*Specifies the function to be used to toggle read-only. 1222 "*Specifies the function to be used to toggle read-only.
1279 (ediff-defvar-local ediff-temp-file-C nil "") 1303 (ediff-defvar-local ediff-temp-file-C nil "")
1280 1304
1281 1305
1282 ;;; In-line functions 1306 ;;; In-line functions
1283 1307
1284 (or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it 1308 ;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check
1285 (defun ediff-file-remote-p (file-name) 1309 ;; if find-file-name-handler is defined for 'file-local-copy
1310 (defun ediff-file-remote-p (file-name)
1311 (or (and (fboundp 'file-remote-p) (file-remote-p file-name))
1286 (find-file-name-handler file-name 'file-local-copy))) 1312 (find-file-name-handler file-name 'file-local-copy)))
1287 ;;; (or (and (featurep 'efs-auto) (efs-ftp-path file-name)) 1313
1288 ;;; (and (featurep 'tramp) (tramp-tramp-file-p file-name)) 1314 ;; File for which we can get attributes, such as size or date
1289 ;;; (and (fboundp 'file-remote-p) (file-remote-p file-name)) 1315 (defun ediff-listable-file (file-name)
1290 ;;; ;; Can happen only in Emacs, since XEmacs has file-remote-p 1316 (let ((handler (find-file-name-handler file-name 'file-local-copy)))
1291 ;;; (and (require 'ange-ftp) (ange-ftp-ftp-name file-name))))) 1317 (or (null handler) (eq handler 'dired-handler-fn))))
1292 1318
1293 1319
1294 (defsubst ediff-frame-unsplittable-p (frame) 1320 (defsubst ediff-frame-unsplittable-p (frame)
1295 (cdr (assq 'unsplittable (frame-parameters frame)))) 1321 (cdr (assq 'unsplittable (frame-parameters frame))))
1296 1322
1738 (defsubst ediff-message-if-verbose (string &rest args) 1764 (defsubst ediff-message-if-verbose (string &rest args)
1739 (if ediff-verbose-p 1765 (if ediff-verbose-p
1740 (apply 'message string args))) 1766 (apply 'message string args)))
1741 1767
1742 (defun ediff-file-attributes (filename attr-number) 1768 (defun ediff-file-attributes (filename attr-number)
1743 (if (ediff-file-remote-p filename) 1769 (if (ediff-listable-file filename)
1744 -1 1770 (nth attr-number (file-attributes filename))
1745 (nth attr-number (file-attributes filename)))) 1771 -1)
1772 )
1746 1773
1747 (defsubst ediff-file-size (filename) 1774 (defsubst ediff-file-size (filename)
1748 (ediff-file-attributes filename 7)) 1775 (ediff-file-attributes filename 7))
1749 (defsubst ediff-file-modtime (filename) 1776 (defsubst ediff-file-modtime (filename)
1750 (ediff-file-attributes filename 5)) 1777 (ediff-file-attributes filename 5))