aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ediff-diff.el57
-rw-r--r--lisp/ediff-hook.el48
-rw-r--r--lisp/ediff-init.el221
-rw-r--r--lisp/ediff-merg.el12
-rw-r--r--lisp/ediff-mult.el68
-rw-r--r--lisp/ediff-util.el565
-rw-r--r--lisp/ediff-wind.el124
-rw-r--r--lisp/ediff.el287
-rw-r--r--lisp/emulation/viper-ex.el2
9 files changed, 661 insertions, 723 deletions
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el
index 4a9f626e93..af0b9a9a40 100644
--- a/lisp/ediff-diff.el
+++ b/lisp/ediff-diff.el
@@ -25,8 +25,10 @@
(require 'ediff-init)
+
(defvar ediff-shell
(cond ((eq system-type 'emx) "cmd") ; OS/2
+ ((eq system-type 'ms-dos) shell-file-name) ; no standard name on MS-DOS
((memq system-type '(vax-vms axp-vms)) "*dcl*") ; VMS
(t "sh")) ; UNIX
"*The shell used to run diff and patch. If user's .profile or
@@ -84,7 +86,7 @@ Lines that do not match are assumed to be error messages.")
;;; Fine differences
-(ediff-defvar-local ediff-auto-refine (if (ediff-window-display-p) 'on 'nix)
+(ediff-defvar-local ediff-auto-refine (if (ediff-has-face-support-p) 'on 'nix)
"If `on', Ediff auto-highlights fine diffs for the current diff region.
If `off', auto-highlighting is not used. If `nix', no fine diffs are shown
at all, unless the user force-refines the region by hitting `*'.
@@ -132,9 +134,9 @@ one optional arguments, diff-number to refine.")
;; ediff-setup-diff-regions-function, which can also have the value
;; ediff-setup-diff-regions3, which takes 4 arguments.
(defun ediff-setup-diff-regions (file-A file-B file-C)
- ;; Force all minibuffers to display ediff's messages.
- ;; When xemacs implements minibufferless frames, this won't be necessary
- (if ediff-xemacs-p (setq synchronize-minibuffers t))
+;;; ;; Force all minibuffers to display ediff's messages.
+;;; ;; When xemacs implements minibufferless frames, this won't be necessary
+;;; (if ediff-xemacs-p (setq synchronize-minibuffers t))
(or (ediff-buffer-live-p ediff-diff-buffer)
(setq ediff-diff-buffer
@@ -148,8 +150,7 @@ one optional arguments, diff-number to refine.")
;;(message "Computing differences ... done")
(ediff-convert-diffs-to-overlays
(ediff-extract-diffs
- ediff-diff-buffer ediff-word-mode ediff-narrow-bounds))
- )
+ ediff-diff-buffer ediff-word-mode ediff-narrow-bounds)))
;; If file-A/B/C is nil, do 2-way comparison with the non-nil buffers
;; This function works for diff3 and diff2 jobs
@@ -178,7 +179,8 @@ one optional arguments, diff-number to refine.")
) ; exec process
(ediff-prepare-error-list ok-regexp ediff-fine-diff-buffer)
- ;;(ediff-message-if-verbose
+ (ediff-message-if-verbose
+ "")
;; "Refining difference region %d ... done" (1+ reg-num))
(setq diff-list
@@ -463,15 +465,9 @@ one optional arguments, diff-number to refine.")
(setq pt-saved (ediff-eval-in-buffer buff (point)))))
(setq overlay (ediff-make-bullet-proof-overlay begin end buff))
- ;; Priorities of overlays should be equal in all ediff control
- ;; panel buffers. Otherwise it won't work due to Emacs
- ;; bug, as insert-in-front-hooks will be called
- ;; only on behalf of the buffer with higher priority.
(ediff-overlay-put overlay 'priority ediff-shadow-overlay-priority)
(ediff-overlay-put overlay 'ediff-diff-num current-diff)
- (ediff-overlay-put
- overlay 'insert-in-front-hooks '(ediff-insert-in-front))
- (if (and (ediff-window-display-p)
+ (if (and (ediff-has-face-support-p)
ediff-use-faces ediff-highlight-all-diffs)
(ediff-set-overlay-face
overlay (ediff-background-face buf-type current-diff)))
@@ -502,7 +498,7 @@ one optional arguments, diff-number to refine.")
(or n (setq n ediff-current-difference))
(if (< ediff-number-of-differences 1)
- (error "No differences found"))
+ (error "Sorry, it is not my job to munch identical variants..."))
(if ediff-word-mode
(setq flag 'skip
@@ -668,10 +664,10 @@ one optional arguments, diff-number to refine.")
;; if fine diff vector is not set for diff N, then do nothing
(defun ediff-set-fine-diff-properties (n &optional default)
- (or (not (ediff-window-display-p))
+ (or (not (ediff-has-face-support-p))
(< n 0)
(>= n ediff-number-of-differences)
- ;; in a window system, set faces and priorities of fine overlays
+ ;; when faces are supported, set faces and priorities of fine overlays
(progn
(ediff-set-fine-diff-properties-in-one-buffer 'A n default)
(ediff-set-fine-diff-properties-in-one-buffer 'B n default)
@@ -966,9 +962,9 @@ one optional arguments, diff-number to refine.")
;; or it is the ancestor file.
(defun ediff-setup-diff-regions3 (file-A file-B file-C)
- ;; force all minibuffers to display ediff's messages.
- ;; when xemacs implements minibufferless frames, this won't be necessary
- (if ediff-xemacs-p (setq synchronize-minibuffers t))
+;;; ;; force all minibuffers to display ediff's messages.
+;;; ;; when xemacs implements minibufferless frames, this won't be necessary
+;;; (if ediff-xemacs-p (setq synchronize-minibuffers t))
(or (ediff-buffer-live-p ediff-diff-buffer)
(setq ediff-diff-buffer
@@ -987,11 +983,11 @@ one optional arguments, diff-number to refine.")
))
-;; Execute PROGRAM asynchronously, unless OS/2 or unless SYNC is non-nil.
-;; BUFFER must be a buffer object, and must be alive.
-;; All arguments in ARGS must be strings. The first arg may be a blank string,
-;; in which case we delete it from ARGS list. We also delete nil from args.
-(defun ediff-exec-process (program buffer sync &rest args)
+;; Execute PROGRAM asynchronously, unless OS/2, Windows-*, or DOS, or unless
+;; SYNCH is non-nil. BUFFER must be a buffer object, and must be alive. All
+;; arguments in ARGS must be strings. The first arg may be a blank string, in
+;; which case we delete it from ARGS list. We also delete nil from args.
+(defun ediff-exec-process (program buffer synch &rest args)
(let ((data (match-data)))
(if (string-match "^[ \t]*$" (car args)) ; delete blank string
(setq args (cdr args)))
@@ -1004,13 +1000,17 @@ one optional arguments, diff-number to refine.")
(set-buffer buffer)
(erase-buffer)
(setq default-directory directory)
- (if (or (eq system-type 'emx) sync)
- ;; In OS/2 do it synchronously, since OS/2 doesn't let us
+ (if (or (memq system-type '(emx ms-dos windows-nt windows-95))
+ synch)
+ ;; In OS/2 (emx) do it synchronously, since OS/2 doesn't let us
;; delete files used by other processes. Thus, in ediff-buffers
;; and similar functions, we can't delete temp files because
- ;; they might be used by the async process that computes
+ ;; they might be used by the asynch process that computes
;; custom diffs. So, we have to wait till custom diff
;; subprocess is done.
+ ;; Similarly for Windows-*
+ ;; In DOS, must synchronize because DOS doesn't have
+ ;; asynchronous processes.
(apply 'call-process program nil buffer nil args)
;; On other systems, do it asynchronously.
(setq proc (get-buffer-process buffer))
@@ -1164,4 +1164,5 @@ argument to `skip-chars-forward'."
(provide 'ediff-diff)
+
;; ediff-diff.el ends here
diff --git a/lisp/ediff-hook.el b/lisp/ediff-hook.el
index 8e88573fdf..9c4c4c48af 100644
--- a/lisp/ediff-hook.el
+++ b/lisp/ediff-hook.el
@@ -23,10 +23,12 @@
;;; Code:
-;; These must be placed in menu-bar.el in Emacs
+;;; These must be placed in menu-bar.el in Emacs
;;
+;; (define-key menu-bar-tools-menu [ediff-doc]
+;; '("Ediff Manual..." . ediff-documentation))
;; (define-key menu-bar-tools-menu [eregistry]
-;; '("List Ediff Sessions" . ediff-show-registry))
+;; '("List Ediff Sessions..." . ediff-show-registry))
;; (define-key menu-bar-tools-menu [epatch]
;; '("Apply Patch" . menu-bar-epatch-menu))
;; (define-key menu-bar-tools-menu [ediff-merge]
@@ -46,14 +48,16 @@
'("Tools") epatch-menu "OO-Browser...")
(add-menu-button
'("Tools")
- ["List Ediff Sessions" ediff-show-registry t] "OO-Browser...")
+ ["List Ediff Sessions..." ediff-show-registry t] "OO-Browser...")
(add-menu-button
'("Tools")
- ["---" nil nil] "OO-Browser...")
+ ["Ediff Manual..." ediff-documentation t] "OO-Browser...")
+ (add-menu-button
+ '("Tools")
+ ["-------" nil nil] "OO-Browser...")
)))
-
;; explicit string-match is needed: ediff-xemacs-p is not defined at build time
(cond ((string-match "XEmacs" emacs-version)
(defvar ediff-menu
@@ -73,7 +77,8 @@
["Windows Line-by-line..." ediff-windows-linewise t]
"---"
["Regions Word-by-word..." ediff-regions-wordwise t]
- ["Regions Line-by-line..." ediff-regions-linewise t]))
+ ["Regions Line-by-line..." ediff-regions-linewise t]
+ ))
(defvar ediff-merge-menu
'("Merge"
["Files..." ediff-merge-files t]
@@ -91,15 +96,16 @@
ediff-merge-revisions-with-ancestor t]
["Directory Revisions..." ediff-merge-directory-revisions t]
["Directory Revisions with Ancestor..."
- ediff-merge-directory-revisions-with-ancestor t]))
+ ediff-merge-directory-revisions-with-ancestor t]
+ ))
(defvar epatch-menu
'("Apply Patch"
["To a file..." ediff-patch-file t]
- ["To a buffer..." ediff-patch-buffer t]))
+ ["To a buffer..." ediff-patch-buffer t]
+ ))
;; put these menus before Object-Oriented-Browser in Tools menu
(add-hook 'before-init-hook 'ediff-xemacs-init-menus)
- ;; this `if' is to be deleted before going into distribution
(if (not purify-flag)
(ediff-xemacs-init-menus))
)
@@ -117,7 +123,17 @@
;; define ediff-menu
(define-key menu-bar-ediff-menu [window]
- '("This Window And Next Window" . compare-windows))
+ '("This Window and Next Window" . compare-windows))
+ (define-key menu-bar-ediff-menu [ediff-windows-linewise]
+ '("Windows Line-by-line..." . ediff-windows-linewise))
+ (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
+ '("Windows Word-by-word..." . ediff-windows-wordwise))
+ (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
+ (define-key menu-bar-ediff-menu [ediff-regions-linewise]
+ '("Regions Line-by-line..." . ediff-regions-linewise))
+ (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
+ '("Regions Word-by-word..." . ediff-regions-wordwise))
+ (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
(define-key menu-bar-ediff-menu [ediff-dir-revision]
'("Directory Revisions..." . ediff-directory-revisions))
(define-key menu-bar-ediff-menu [ediff-revision]
@@ -136,16 +152,6 @@
'("Two Buffers..." . ediff-buffers))
(define-key menu-bar-ediff-menu [ediff-files]
'("Two Files..." . ediff-files))
- (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
- (define-key menu-bar-ediff-menu [ediff-regions-linewise]
- '("Regions Line-by-line..." . ediff-regions-linewise))
- (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
- '("Regions Word-by-word..." . ediff-regions-wordwise))
- (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
- (define-key menu-bar-ediff-menu [ediff-windows-linewise]
- '("Windows Line-by-line..." . ediff-windows-linewise))
- (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
- '("Windows Word-by-word..." . ediff-windows-wordwise))
;; define merge menu
(define-key
@@ -268,7 +274,7 @@
;; misc
(autoload 'ediff-show-registry
- "ediff-mult"
+ "ediff-meta"
"Display the registry of active Ediff sessions"
t)
(autoload 'ediff-version
diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el
index 95eccc5c83..6932ae2fc8 100644
--- a/lisp/ediff-init.el
+++ b/lisp/ediff-init.el
@@ -33,8 +33,18 @@
window-system
(device-type (selected-device))))
;; in XEmacs: device-type is tty on tty and stream in batch.
-(defsubst ediff-window-display-p ()
- (and (ediff-device-type) (not (memq (ediff-device-type) '(tty stream)))))
+(defun ediff-window-display-p ()
+ (and (ediff-device-type) (not (memq (ediff-device-type) '(tty pc stream)))))
+
+;; test if supports faces
+;; ediff-force-faces is for those devices that support faces, but we don't know
+;; this yet
+(defun ediff-has-face-support-p ()
+ (cond ((ediff-window-display-p))
+ (ediff-force-faces)
+ (ediff-emacs-p (memq (ediff-device-type) '(pc)))
+ (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))))
+
;;; Macros
(defmacro ediff-odd-p (arg)
@@ -146,8 +156,7 @@
(,@ forms))
(set-buffer StartBuffer))
(or (eq this-command 'ediff-quit)
- (error
- "You've killed an essential Ediff buffer---Please quit Ediff"))
+ (error ediff-KILLED-VITAL-BUFFER))
))))
@@ -226,11 +235,16 @@
;; add more here
))
(defsubst ediff-collect-diffs-metajob (&optional metajob)
- (or (ediff-revision-metajob metajob)
- (memq ediff-metajob-name
- '(ediff-directories
- ;; add more here
- ediff-directory-revisions))))
+ (memq (or metajob ediff-metajob-name)
+ '(ediff-directories
+ ediff-directory-revisions
+ ediff-merge-directories
+ ediff-merge-directories-with-ancestor
+ ediff-merge-directory-revisions
+ ediff-merge-directory-revisions-with-ancestor
+ ;; add more here
+ )))
+
(defsubst ediff-metajob3 (&optional metajob)
(memq (or metajob ediff-metajob-name)
'(ediff-merge-directories-with-ancestor
@@ -335,7 +349,7 @@ n,SPC -next diff | h -hiliting | rx -restore buf X's old diff
C-l -recenter | ## -ignore whitespace |
v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X
</> -scroll lt/rt | X -read-only in buf X | wd -save diff output
- | m -wide display | ~ -swap buffers
+ ~ -swap variants | m -wide display |
"
"Help message usually used for 2-way comparison.
Normally, not a user option. See `ediff-help-message' for details.")
@@ -349,7 +363,7 @@ n,SPC -next diff | h -hiliting | rx -restore buf X's old diff
C-l -recenter | ## -ignore whitespace |
v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X
</> -scroll lt/rt | X -read-only in buf X | wd -save diff output
- | m -wide display | ~ -swap buffers
+ ~ -swap variants | m -wide display |
"
"Help message when comparing windows or regions line-by-line.
Normally, not a user option. See `ediff-help-message' for details.")
@@ -363,7 +377,7 @@ n,SPC -next diff | h -hiliting | rx -restore buf X's old diff
C-l -recenter | |
v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X
</> -scroll lt/rt | X -read-only in buf X | wd -save diff output
- | m -wide display | ~ -swap buffers
+ ~ -swap variants | m -wide display |
"
"Help message when comparing windows or regions word-by-word.
Normally, not a user option. See `ediff-help-message' for details.")
@@ -377,7 +391,7 @@ n,SPC -next diff | h -hiliting | r -restore buf C's old diff
C-l -recenter | #f/#h -focus/hide regions | + -combine diff regions
v/V -scroll up/dn | X -read-only in buf X | wx -save buf X
</> -scroll lt/rt | m -wide display | wd -save diff output
- / -ancestor buff | s -shrink window C | ~ -swap buffers
+ ~ -swap variants | s -shrink window C | / -show ancestor buff
| $ -show clashes only | & -merge w/new default
"
"Help message during merging.
@@ -402,8 +416,8 @@ produce the brief help message. This function must return a string.")
"The long help message that the user can customize.
See `ediff-brief-help-message-function' for more.")
-(defvar ediff-prefer-long-help-message nil
- "*If t, Ediff starts with a long help message. Short help msg otherwise.")
+(defvar ediff-use-long-help-message nil
+ "*If t, Ediff displays a long help message. Short help message otherwise.")
;; The actual help message.
(ediff-defvar-local ediff-help-message ""
@@ -412,6 +426,12 @@ Normally, the user shouldn't touch this. However, if you want Ediff to
start up with different help messages for different jobs, you can change
the value of this variable and the variables `ediff-help-message-*' in
`ediff-startup-hook'.")
+
+;; Error messages
+(defconst ediff-KILLED-VITAL-BUFFER
+ "You have killed a vital Ediff buffer---you must leave Ediff now!")
+(defconst ediff-NO-DIFFERENCES
+ "Sorry, it is not my job to munch identical variants...")
;; Selective browsing
@@ -484,13 +504,18 @@ Must end with newline.")
(ediff-defvar-local ediff-use-faces t
- "If t, differences are highlighted using faces on a window system.
-If nil, they are highlighted using ASCII flags, ediff-before-flag
+ "If t, differences are highlighted using faces, if device supports faces.
+If nil, differences are highlighted using ASCII flags, ediff-before-flag
and ediff-after-flag. On a non-window system, differences are always
highlighted using ASCII flags.
This variable can be set either in .emacs or toggled interactively.
Use `setq-default' if setting it in .emacs")
+(defvar ediff-force-faces nil
+ "If t, Ediff will think that it is running on a display that supports faces.
+This is provided as a temporary relief for users of face-capable displays
+that Ediff doesn't know about.")
+
;; this indicates that diff regions are word-size, so fine diffs are
;; permanently nixed; used in ediff-windows-wordwise and ediff-regions-wordwise
@@ -570,7 +595,7 @@ ediff-toggle-hilit. Use `setq-default' to set it.")
;; Buffer-local variables to be saved then restored during Ediff sessions
;; Buffer-local variables to be saved then restored during Ediff sessions
(defconst ediff-protected-variables '(buffer-read-only
- synchronize-minibuffers
+;;; synchronize-minibuffers
mode-line-format))
;; Vector of differences between the variants. Each difference is
@@ -636,10 +661,10 @@ ediff-toggle-hilit. Use `setq-default' to set it.")
(defvar ediff-version-control-package 'vc
"Version control package used.
-Currently, Ediff supports vc.el, rcs.el, and generic-sc.el. The standard Emacs
-interface to RCS, CVS, SCCS, etc., is vc.el. However, some people find the
-other two packages more convenient. Set this variable `rcs' or `generic-sc' if
-you are such a person.")
+Currently, Ediff supports vc.el, rcs.el, pcl-cvs.el, and generic-sc.el. The
+standard Emacs interface to RCS, CVS, SCCS, etc., is vc.el. However, some
+people find the other two packages more convenient. Set this variable to the
+appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire.")
(if ediff-xemacs-p
@@ -647,16 +672,12 @@ you are such a person.")
(fset 'ediff-read-event (symbol-function 'next-command-event))
(fset 'ediff-overlayp (symbol-function 'extentp))
(fset 'ediff-make-overlay (symbol-function 'make-extent))
- (fset 'ediff-delete-overlay (symbol-function 'delete-extent))
- (fset 'ediff-overlay-buffer (symbol-function 'extent-buffer))
- (fset 'ediff-overlay-get (symbol-function 'extent-property)))
+ (fset 'ediff-delete-overlay (symbol-function 'delete-extent)))
(fset 'ediff-read-event (symbol-function 'read-event))
(fset 'ediff-overlayp (symbol-function 'overlayp))
(fset 'ediff-overlayp (symbol-function 'overlayp))
(fset 'ediff-make-overlay (symbol-function 'make-overlay))
- (fset 'ediff-delete-overlay (symbol-function 'delete-overlay))
- (fset 'ediff-overlay-buffer (symbol-function 'overlay-buffer))
- (fset 'ediff-overlay-get (symbol-function 'overlay-get)))
+ (fset 'ediff-delete-overlay (symbol-function 'delete-overlay)))
;; Check the current version against the major and minor version numbers
;; using op: cur-vers op major.minor If emacs-major-version or
@@ -728,30 +749,34 @@ you are such a person.")
(eq (device-class (selected-device)) 'color)))
-(if (ediff-window-display-p)
+(if (ediff-has-face-support-p)
(if ediff-xemacs-p
(progn
- (fset 'ediff-display-pixel-width
- (symbol-function 'device-pixel-width))
- (fset 'ediff-display-pixel-height
- (symbol-function 'device-pixel-height))
(fset 'ediff-valid-color-p (symbol-function 'valid-color-name-p))
(fset 'ediff-get-face (symbol-function 'get-face)))
;; Temporary fix for OS/2 port of Emacs
;; pm-win.el in PM-Emacs should be fixed.
- (fset 'ediff-display-pixel-width
- (symbol-function 'x-display-pixel-width))
- (fset 'ediff-display-pixel-height
- (symbol-function 'x-display-pixel-height))
(if (eq (ediff-device-type) 'pm)
(fset 'ediff-valid-color-p
(function (lambda (color) (assoc color pm-color-alist))))
(fset 'ediff-valid-color-p (symbol-function 'x-color-defined-p)))
(fset 'ediff-get-face (symbol-function 'internal-get-face))))
+
+(if (ediff-window-display-p)
+ (if ediff-xemacs-p
+ (progn
+ (fset 'ediff-display-pixel-width
+ (symbol-function 'device-pixel-width))
+ (fset 'ediff-display-pixel-height
+ (symbol-function 'device-pixel-height)))
+ (fset 'ediff-display-pixel-width
+ (symbol-function 'x-display-pixel-width))
+ (fset 'ediff-display-pixel-height
+ (symbol-function 'x-display-pixel-height))))
(defun ediff-make-current-diff-overlay (type)
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(let ((overlay (intern (format "ediff-current-diff-overlay-%S" type)))
(buffer (ediff-get-buffer type))
(face (face-name
@@ -787,7 +812,7 @@ you are such a person.")
(defun ediff-set-face (ground face color)
"Set face foreground/background."
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(if (ediff-valid-color-p color)
(if (eq ground 'foreground)
(set-face-foreground face color)
@@ -815,14 +840,15 @@ you are such a person.")
(copy-face 'secondary-selection face))))
))
-(or (boundp 'facemenu-unlisted-faces)
- (setq facemenu-unlisted-faces nil))
-
-(add-to-list 'facemenu-unlisted-faces 'ediff-current-diff-face-A)
+(defun ediff-hide-face (face)
+ (if (and (ediff-has-face-support-p) ediff-emacs-p)
+ (add-to-list 'facemenu-unlisted-faces face)))
+
(defvar ediff-current-diff-face-A
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-current-diff-face-A)
+ (ediff-hide-face 'ediff-current-diff-face-A)
(or (face-differs-from-default-p 'ediff-current-diff-face-A)
(cond ((ediff-color-display-p)
(ediff-set-face
@@ -837,11 +863,11 @@ you are such a person.")
'ediff-current-diff-face-A))
"Face for highlighting the selected difference in buffer A.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-current-diff-face-B)
(defvar ediff-current-diff-face-B
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-current-diff-face-B)
+ (ediff-hide-face 'ediff-current-diff-face-B)
(or (face-differs-from-default-p 'ediff-current-diff-face-B)
(cond ((ediff-color-display-p)
(ediff-set-face
@@ -857,11 +883,11 @@ you are such a person.")
"Face for highlighting the selected difference in buffer B.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-current-diff-face-C)
(defvar ediff-current-diff-face-C
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-current-diff-face-C)
+ (ediff-hide-face 'ediff-current-diff-face-C)
(or (face-differs-from-default-p 'ediff-current-diff-face-C)
(cond ((ediff-color-display-p)
(ediff-set-face
@@ -876,21 +902,21 @@ you are such a person.")
'ediff-current-diff-face-C))
"Face for highlighting the selected difference in buffer C.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-current-diff-face-Ancestor)
(defvar ediff-current-diff-face-Ancestor
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-current-diff-face-Ancestor)
+ (ediff-hide-face 'ediff-current-diff-face-Ancestor)
(or (face-differs-from-default-p 'ediff-current-diff-face-Ancestor)
(copy-face
'ediff-current-diff-face-C 'ediff-current-diff-face-Ancestor))))
"Face for highlighting the selected difference in the ancestor buffer.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-fine-diff-face-A)
(defvar ediff-fine-diff-face-A
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-fine-diff-face-A)
+ (ediff-hide-face 'ediff-fine-diff-face-A)
(or (face-differs-from-default-p 'ediff-fine-diff-face-A)
(cond ((ediff-color-display-p)
(ediff-set-face 'foreground 'ediff-fine-diff-face-A
@@ -901,11 +927,11 @@ you are such a person.")
'ediff-fine-diff-face-A))
"Face for highlighting the refinement of the selected diff in buffer A.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-fine-diff-face-B)
(defvar ediff-fine-diff-face-B
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-fine-diff-face-B)
+ (ediff-hide-face 'ediff-fine-diff-face-B)
(or (face-differs-from-default-p 'ediff-fine-diff-face-B)
(cond ((ediff-color-display-p)
(ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black")
@@ -914,11 +940,11 @@ you are such a person.")
'ediff-fine-diff-face-B))
"Face for highlighting the refinement of the selected diff in buffer B.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-fine-diff-face-C)
(defvar ediff-fine-diff-face-C
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-fine-diff-face-C)
+ (ediff-hide-face 'ediff-fine-diff-face-C)
(or (face-differs-from-default-p 'ediff-fine-diff-face-C)
(cond ((ediff-color-display-p)
(ediff-set-face 'foreground 'ediff-fine-diff-face-C "black")
@@ -928,11 +954,11 @@ you are such a person.")
'ediff-fine-diff-face-C))
"Face for highlighting the refinement of the selected diff in buffer C.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-fine-diff-face-Ancestor)
(defvar ediff-fine-diff-face-Ancestor
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-fine-diff-face-Ancestor)
+ (ediff-hide-face 'ediff-fine-diff-face-Ancestor)
(or (face-differs-from-default-p 'ediff-fine-diff-face-Ancestor)
(copy-face
'ediff-fine-diff-face-C 'ediff-fine-diff-face-Ancestor))))
@@ -940,11 +966,11 @@ you are such a person.")
Presently, this is not used, as difference regions are not refined in the
ancestor buffer.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-even-diff-face-A)
(defvar ediff-even-diff-face-A
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-even-diff-face-A)
+ (ediff-hide-face 'ediff-even-diff-face-A)
(or (face-differs-from-default-p 'ediff-even-diff-face-A)
(cond ((ediff-color-display-p)
(ediff-set-face
@@ -956,11 +982,11 @@ ancestor buffer.")
'ediff-even-diff-face-A))
"Face used to highlight even-numbered differences in buffer A.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-even-diff-face-B)
(defvar ediff-even-diff-face-B
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-even-diff-face-B)
+ (ediff-hide-face 'ediff-even-diff-face-B)
(or (face-differs-from-default-p 'ediff-even-diff-face-B)
(cond ((ediff-color-display-p)
(ediff-set-face
@@ -972,31 +998,31 @@ ancestor buffer.")
'ediff-even-diff-face-B))
"Face used to highlight even-numbered differences in buffer B.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-even-diff-face-C)
(defvar ediff-even-diff-face-C
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-even-diff-face-C)
+ (ediff-hide-face 'ediff-even-diff-face-C)
(or (face-differs-from-default-p 'ediff-even-diff-face-C)
(copy-face 'ediff-even-diff-face-A 'ediff-even-diff-face-C))
'ediff-even-diff-face-C))
"Face used to highlight even-numbered differences in buffer C.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-even-diff-face-Ancestor)
(defvar ediff-even-diff-face-Ancestor
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-even-diff-face-Ancestor)
+ (ediff-hide-face 'ediff-even-diff-face-Ancestor)
(or (face-differs-from-default-p 'ediff-even-diff-face-Ancestor)
(copy-face 'ediff-even-diff-face-C 'ediff-even-diff-face-Ancestor))
'ediff-even-diff-face-Ancestor))
"Face highlighting even-numbered differences in the ancestor buffer.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-odd-diff-face-A)
(defvar ediff-odd-diff-face-A
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-odd-diff-face-A)
+ (ediff-hide-face 'ediff-odd-diff-face-A)
(or (face-differs-from-default-p 'ediff-odd-diff-face-A)
(cond ((ediff-color-display-p)
(ediff-set-face
@@ -1008,11 +1034,11 @@ ancestor buffer.")
'ediff-odd-diff-face-A))
"Face used to highlight odd-numbered differences in buffer A.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-odd-diff-face-B)
(defvar ediff-odd-diff-face-B
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-odd-diff-face-B)
+ (ediff-hide-face 'ediff-odd-diff-face-B)
(or (face-differs-from-default-p 'ediff-odd-diff-face-B)
(cond ((ediff-color-display-p)
(ediff-set-face
@@ -1024,21 +1050,21 @@ ancestor buffer.")
'ediff-odd-diff-face-B))
"Face used to highlight odd-numbered differences in buffer B.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-odd-diff-face-C)
(defvar ediff-odd-diff-face-C
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-odd-diff-face-C)
+ (ediff-hide-face 'ediff-odd-diff-face-C)
(or (face-differs-from-default-p 'ediff-odd-diff-face-C)
(copy-face 'ediff-odd-diff-face-A 'ediff-odd-diff-face-C))
'ediff-odd-diff-face-C))
"Face used to highlight odd-numbered differences in buffer C.")
-(add-to-list 'facemenu-unlisted-faces 'ediff-odd-diff-face-Ancestor )
(defvar ediff-odd-diff-face-Ancestor
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(progn
(make-face 'ediff-odd-diff-face-Ancestor)
+ (ediff-hide-face 'ediff-odd-diff-face-Ancestor)
(or (face-differs-from-default-p 'ediff-odd-diff-face-Ancestor)
(copy-face 'ediff-odd-diff-face-C 'ediff-odd-diff-face-Ancestor))
'ediff-odd-diff-face-Ancestor))
@@ -1110,9 +1136,9 @@ Instead, C-h jumps to previous difference.")
d)
(setq d (if (and env (> (length env) 0))
env
- (if (memq system-type '(vax-vms axp-vms))
- "SYS$SCRATCH:"
- "/tmp")))
+ (cond ((memq system-type '(vax-vms axp-vms)) "SYS$SCRATCH:")
+ ((eq system-type 'ms-dos) "c:/")
+ (t "/tmp"))))
;; The following is to make sure we get something to which we can
;; add directory levels on VMS.
(setq d (file-name-as-directory (directory-file-name d)))
@@ -1129,6 +1155,9 @@ Do not start with `~/' or `~user-name/'.")
"Characters that must be quoted with \\ when used in a shell command line.
More precisely, a regexp to match any one such character.")
+;; needed to simulate frame-char-width in XEmacs.
+(defvar ediff-H-glyph (if ediff-xemacs-p (make-glyph "H")))
+
(ediff-defvar-local ediff-temp-file-A nil
"Temporary file used for refining difference regions in buffer A.")
@@ -1143,14 +1172,6 @@ More precisely, a regexp to match any one such character.")
(if (fboundp ediff-ange-ftp-ftp-name)
(funcall ediff-ange-ftp-ftp-name file-name)))
-;;(defun ediff-frame-has-menubar ()
-;; (and (ediff-window-display-p)
-;; (if ediff-xemacs-p
-;; current-menubar
-;; (let ((lines (cdr (assq 'menu-bar-lines
-;; (frame-parameters (selected-frame))))))
-;; (or (eq lines t) (and (numberp lines) (< 0 lines))))
-;; )))
(defsubst ediff-frame-unsplittable-p (frame)
(cdr (assq 'unsplittable (frame-parameters frame))))
@@ -1246,7 +1267,7 @@ More precisely, a regexp to match any one such character.")
(posn-point (event-start event))))
((ediff-key-press-event-p event)
(point))
- (t (error ""))))
+ (t (error))))
(defun ediff-event-buffer (event)
(cond ((ediff-mouse-event-p event)
@@ -1255,7 +1276,7 @@ More precisely, a regexp to match any one such character.")
(window-buffer (posn-window (event-start event)))))
((ediff-key-press-event-p event)
(current-buffer))
- (t (error ""))))
+ (t (error))))
(defsubst ediff-frame-iconified-p (frame)
@@ -1299,10 +1320,9 @@ More precisely, a regexp to match any one such character.")
(defsubst ediff-spy-after-mouse ()
(setq ediff-mouse-pixel-position (mouse-pixel-position)))
-;; This is actually not easy to find out since emacs and xemacs behave
-;; differently when mouse is not in any frame. Also, this is sensitive to
-;; when the user grabbed mouse.
-;; Not used for now.
+;; It is not easy to find out when the user grabs the mouse, since emacs and
+;; xemacs behave differently when mouse is not in any frame. Also, this is
+;; sensitive to when the user grabbed mouse. Not used for now.
(defun ediff-user-grabbed-mouse ()
(if ediff-mouse-pixel-position
(cond ((not (eq (car ediff-mouse-pixel-position)
@@ -1321,12 +1341,26 @@ More precisely, a regexp to match any one such character.")
(defsubst ediff-frame-char-height (frame)
(if ediff-xemacs-p
- (/ (frame-pixel-height frame) (frame-height frame))
+ (glyph-height ediff-H-glyph (selected-window frame))
(frame-char-height frame)))
(defsubst ediff-empty-overlay-p (overl)
(= (ediff-overlay-start overl) (ediff-overlay-end overl)))
+
+;; like overlay-buffer in Emacs. In XEmacs, returns nil if the extent is
+;; dead. Otherwise, works like extent-buffer
+(defun ediff-overlay-buffer (overl)
+ (if ediff-emacs-p
+ (overlay-buffer overl)
+ (and (extent-live-p overl) (extent-buffer overl))))
+
+;; like overlay-get in Emacs. In XEmacs, returns nil if the extent is
+;; dead. Otherwise, like extent-property
+(defun ediff-overlay-get (overl property)
+ (if ediff-emacs-p
+ (overlay-get overl property)
+ (and (extent-live-p overl) (extent-property overl property))))
;; t if diff region is empty.
;; In case of buffer C, t also if it is not a 3way
@@ -1354,7 +1388,7 @@ More precisely, a regexp to match any one such character.")
;; temporarily uses DIR to abbreviate file name
;; if DIR is nil, use default-directory
-(defsubst ediff-abbreviate-file-name (file &optional dir)
+(defun ediff-abbreviate-file-name (file &optional dir)
(cond ((stringp dir)
(let ((directory-abbrev-alist (list (cons dir ""))))
(abbreviate-file-name file)))
@@ -1447,6 +1481,7 @@ More precisely, a regexp to match any one such character.")
(defsubst ediff-message-if-verbose (string &rest args)
(if ediff-verbose-p
(apply 'message string args)))
+
(provide 'ediff-init)
diff --git a/lisp/ediff-merg.el b/lisp/ediff-merg.el
index eb203df630..58f723843b 100644
--- a/lisp/ediff-merg.el
+++ b/lisp/ediff-merg.el
@@ -25,12 +25,12 @@
(require 'ediff-init)
-(defvar ediff-default-variant 'default-A
+(defvar ediff-default-variant 'combined
"*The variant to be used as a default for buffer C in merging.
Valid values are the symbols `default-A', `default-B', and `combined'.")
(defvar ediff-combination-pattern
- '("#ifdef NEW /* variant A */" "#else /* variant B */" "#endif /* NEW */")
+ '("<<<<<<<<<<<<<< variant A" ">>>>>>>>>>>>>> variant B" "======= end of combination")
"*Pattern to be used for combining difference regions in buffers A and B.
The value is (STRING1 STRING2 STRING3). The combined text will look like this:
@@ -213,9 +213,11 @@ Used only for merging jobs."
;; N here is the user's region number. It is 1+ what Ediff uses internally.
(defun ediff-combine-diffs (n &optional batch-invocation)
"Combine Nth diff regions of buffers A and B and place the combination in C.
-Combining is done using the list in variable `ediff-combination-pattern'."
+N is a prefix argument. If nil, combine the current difference regions.
+Combining is done according to the specifications in variable
+`ediff-combination-pattern'."
(interactive "P")
- (setq n (if n (1- n) ediff-current-difference))
+ (setq n (if (numberp n) (1- n) ediff-current-difference))
(let (regA regB reg-combined)
(setq regA (ediff-get-region-contents n 'A ediff-control-buffer)
@@ -224,7 +226,7 @@ Combining is done using the list in variable `ediff-combination-pattern'."
(setq reg-combined (ediff-make-combined-diff regA regB))
(ediff-copy-diff n nil 'C batch-invocation reg-combined))
- (or batch-invocation (ediff-recenter)))
+ (or batch-invocation (ediff-jump-to-difference (1+ n))))
;; Checks if the region in buff C looks like a combination of the regions
diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el
index 31b63f4962..459d8f839e 100644
--- a/lisp/ediff-mult.el
+++ b/lisp/ediff-mult.el
@@ -23,7 +23,7 @@
;;; Commentary:
-;; Users are strongly encourage to add functionality to this file.
+;; Users are strongly encouraged to add functionality to this file.
;; In particular, epatch needs to be enhanced to work with multi-file
;; patches. The present file contains all the infrastructure needed for that.
;;
@@ -300,9 +300,9 @@ Moves in circular fashion. With numeric prefix arg, skip this many items."
;; ((dir1 dir2 dir3) (file . num) (file . num)...)
;; where num encodes the set of dirs where the file is found:
;; 2 - only dir1; 3 - only dir2; 5 - only dir3; 6 - dir1&2; 10 - dir1&3; etc.
-(defun ediff-intersect-directories (jobname diff-var regexp dir1 dir2
- &optional dir3 comparison-func)
- (require 'cl)
+(defun ediff-intersect-directories (jobname
+ diff-var regexp dir1 dir2
+ &optional dir3 comparison-func)
(setq comparison-func (or comparison-func 'string=))
(let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 difflist)
@@ -318,7 +318,7 @@ Moves in circular fashion. With numeric prefix arg, skip this many items."
(setq lis1 (delete "." lis1)
lis1 (delete ".." lis1))
- (setq common (intersection lis1 lis2 ':test comparison-func))
+ (setq common (ediff-intersection lis1 lis2 comparison-func))
;; get rid of files that are directories in dir1 but not dir2
(mapcar (function (lambda (elt)
(if (Xor (file-directory-p (concat auxdir1 elt))
@@ -326,7 +326,7 @@ Moves in circular fashion. With numeric prefix arg, skip this many items."
(setq common (delq elt common)))))
common)
;; intersect with the third dir
- (if lis3 (setq common (intersection common lis3 ':test comparison-func)))
+ (if lis3 (setq common (ediff-intersection common lis3 comparison-func)))
(if (ediff-comparison-metajob3 jobname)
(mapcar (function (lambda (elt)
(if (Xor (file-directory-p (concat auxdir1 elt))
@@ -334,19 +334,20 @@ Moves in circular fashion. With numeric prefix arg, skip this many items."
(setq common (delq elt common)))))
common))
- ;; trying to avoid side effects of sorting
- (setq common (sort (copy-list common) 'string-lessp))
+ ;; copying is needed because sort sorts via side effects
+ (setq common (sort (ediff-copy-list common) 'string-lessp))
;; compute difference list
- (setq difflist (set-difference
- (union (union lis1 lis2 ':test comparison-func)
- lis3
- ':test comparison-func)
+ (setq difflist (ediff-set-difference
+ (ediff-union (ediff-union lis1 lis2 comparison-func)
+ lis3
+ comparison-func)
common
- ':test comparison-func)
+ comparison-func)
difflist (delete "." difflist)
- ;; copy-list needed because sort sorts it by side effects
- difflist (sort (copy-list (delete ".." difflist)) 'string-lessp))
+ ;; copying is needed because sort sorts via side effects
+ difflist (sort (ediff-copy-list (delete ".." difflist))
+ 'string-lessp))
(setq difflist (mapcar (function (lambda (elt) (cons elt 1))) difflist))
@@ -377,7 +378,6 @@ Moves in circular fashion. With numeric prefix arg, skip this many items."
;; find directory files that are under revision.
;; display subdirectories, too, since we may visit them recursively.
(defun ediff-get-directory-files-under-revision (jobname regexp dir1)
- (require 'cl)
(let (lis1 elt common auxdir1)
(setq auxdir1 (file-name-as-directory dir1)
lis1 (directory-files auxdir1 nil regexp))
@@ -389,14 +389,17 @@ Moves in circular fashion. With numeric prefix arg, skip this many items."
(cond ((file-directory-p (concat auxdir1 elt))
(setq common (cons elt common)))
((file-exists-p (concat auxdir1 elt ",v"))
- (setq common (cons elt common))))
+ (setq common (cons elt common)))
+ ((file-exists-p (concat auxdir1 "RCS/" elt ",v"))
+ (setq common (cons elt common)))
+ ) ; cond
) ; while
(setq common (delete "." common)
common (delete ".." common))
- ;; trying to avoid side effects of sorting
- (setq common (sort (copy-list common) 'string-lessp))
+ ;; copying is needed because sort sorts via side effects
+ (setq common (sort (ediff-copy-list common) 'string-lessp))
;; return result
(cons (list regexp auxdir1 nil nil)
@@ -942,7 +945,9 @@ Useful commands:
(if (ediff-buffer-live-p session-buf)
(ediff-eval-in-buffer session-buf
(if (eq ediff-control-buffer session-buf) ; individual session
- (setq custom-diff-buf ediff-custom-diff-buffer))))
+ (progn
+ (ediff-compute-custom-diffs-maybe)
+ (setq custom-diff-buf ediff-custom-diff-buffer)))))
(or (ediff-buffer-live-p meta-diff-buff)
(error "Ediff: something wrong--no multiple diffs buffer"))
@@ -953,7 +958,9 @@ Useful commands:
(goto-char (point-max))
(insert-buffer custom-diff-buf)
(insert "\n")))
- ((eq metajob 'ediff-directories)
+ ((memq metajob '(ediff-directories
+ ediff-merge-directories
+ ediff-merge-directories-with-ancestor))
;; get diffs by calling shell command on ediff-custom-diff-program
(save-excursion
(set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer)))
@@ -970,10 +977,8 @@ Useful commands:
(insert-buffer tmp-buf)
(insert "\n")))
(t
- (error
- "Session %d is marked but inactive--can't make its diff"
- sessionNum)))
- ))
+ (error "Can't make context diff for Session %d" sessionNum )))
+ ))
(defun ediff-collect-custom-diffs ()
"Collect custom diffs of marked sessions in buffer `*Ediff Multifile Diffs*'.
@@ -1185,10 +1190,11 @@ all marked sessions must be active."
(t (ediff-skip-unsuitable-frames 'ok-unsplittable)
(set-window-buffer (selected-window) meta-buf)))
))
- (if (ediff-window-display-p)
+ (if (and (ediff-window-display-p)
+ (window-live-p
+ (setq wind (ediff-get-visible-buffer-window meta-buf))))
(progn
- (setq frame
- (window-frame (ediff-get-visible-buffer-window meta-buf)))
+ (setq frame (window-frame wind))
(raise-frame frame)
(ediff-reset-mouse frame)))
(run-hooks 'ediff-show-session-group-hook)
@@ -1213,7 +1219,7 @@ all marked sessions must be active."
(error "No active Ediff sessions or corrupted session registry"))
(let (wind frame)
;; for some reason, point moves in ediff-registry-buffer, so we preserve it
- ;; explictly
+ ;; explicitly
(ediff-eval-in-buffer ediff-registry-buffer
(save-excursion
(cond ((setq wind
@@ -1322,7 +1328,7 @@ If this is a session registry buffer then just bury it."
(bury-buffer)
(beep)
(message
- "Group has active sessions, panel not deleted")))
+ "Session group suspended, not deleted (has active sessions)")))
(ediff-cleanup-meta-buffer parent-buf)
(ediff-kill-buffer-carefully dir-diffs-buffer)
(ediff-kill-buffer-carefully meta-diff-buffer)
@@ -1342,7 +1348,7 @@ If this is a session registry buffer then just bury it."
(kill-buffer buf))
-;; obtain information on a meta record where the user clicked or typed
+;; Obtain information on a meta record where the user clicked or typed
;; BUF is the buffer where this happened and POINT is the position
;; If optional NOERROR arg is given, don't report error and return nil if no
;; meta info is found on line.
diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el
index e5081b45c7..327f9011e1 100644
--- a/lisp/ediff-util.el
+++ b/lisp/ediff-util.el
@@ -138,43 +138,28 @@ to invocation.")
;; Will barf if no ancestor
(define-key ediff-mode-map "/" 'ediff-show-ancestor)
;; In merging, we allow only A->C and B->C copying.
- (define-key ediff-mode-map "a" (function
- (lambda (arg)
- (interactive "P")
- (ediff-diff-to-diff arg "ac"))))
- (define-key ediff-mode-map "b" (function
- (lambda (arg)
- (interactive "P")
- (ediff-diff-to-diff arg "bc"))))
- (define-key ediff-mode-map "r" (function
- (lambda (arg)
- (interactive "P")
- (ediff-restore-diff arg ?c))))
+ (define-key ediff-mode-map "a" 'ediff-copy-A-to-C)
+ (define-key ediff-mode-map "b" 'ediff-copy-B-to-C)
+ (define-key ediff-mode-map "r" 'ediff-restore-diff-in-merge-buffer)
(define-key ediff-mode-map "s" 'ediff-shrink-window-C)
(define-key ediff-mode-map "+" 'ediff-combine-diffs)
(define-key ediff-mode-map "$" 'ediff-toggle-show-clashes-only)
(define-key ediff-mode-map "&" 'ediff-re-merge))
(ediff-3way-comparison-job
- (define-key ediff-mode-map "ab" 'ediff-diff-to-diff)
- (define-key ediff-mode-map "ba" 'ediff-diff-to-diff)
- (define-key ediff-mode-map "ac" 'ediff-diff-to-diff)
- (define-key ediff-mode-map "bc" 'ediff-diff-to-diff)
+ (define-key ediff-mode-map "ab" 'ediff-copy-A-to-B)
+ (define-key ediff-mode-map "ba" 'ediff-copy-B-to-A)
+ (define-key ediff-mode-map "ac" 'ediff-copy-A-to-C)
+ (define-key ediff-mode-map "bc" 'ediff-copy-B-to-C)
(define-key ediff-mode-map "c" nil)
- (define-key ediff-mode-map "ca" 'ediff-diff-to-diff)
- (define-key ediff-mode-map "cb" 'ediff-diff-to-diff)
+ (define-key ediff-mode-map "ca" 'ediff-copy-C-to-A)
+ (define-key ediff-mode-map "cb" 'ediff-copy-C-to-B)
(define-key ediff-mode-map "ra" 'ediff-restore-diff)
(define-key ediff-mode-map "rb" 'ediff-restore-diff)
(define-key ediff-mode-map "rc" 'ediff-restore-diff)
(define-key ediff-mode-map "C" 'ediff-toggle-read-only))
(t ; 2-way comparison
- (define-key ediff-mode-map "a" (function
- (lambda (arg)
- (interactive "P")
- (ediff-diff-to-diff arg "ab"))))
- (define-key ediff-mode-map "b" (function
- (lambda (arg)
- (interactive "P")
- (ediff-diff-to-diff arg "ba"))))
+ (define-key ediff-mode-map "a" 'ediff-copy-A-to-B)
+ (define-key ediff-mode-map "b" 'ediff-copy-B-to-A)
(define-key ediff-mode-map "ra" 'ediff-restore-diff)
(define-key ediff-mode-map "rb" 'ediff-restore-diff))
) ; cond
@@ -208,8 +193,9 @@ to invocation.")
(require 'ediff-wind)
-(or (boundp 'synchronize-minibuffers)
- (defvar synchronize-minibuffers nil))
+;; No longer needed: XEmacs has surrogate minibuffers now.
+;;(or (boundp 'synchronize-minibuffers)
+;; (defvar synchronize-minibuffers nil))
;; Common startup entry for all Ediff functions
;; It now returns control buffer so other functions can do post-processing
@@ -241,7 +227,7 @@ to invocation.")
ediff-windows-job (ediff-windows-job)
ediff-word-mode-job (ediff-word-mode-job))
- (make-local-variable 'ediff-prefer-long-help-message)
+ (make-local-variable 'ediff-use-long-help-message)
(make-local-variable 'ediff-prefer-iconified-control-frame)
(make-local-variable 'ediff-split-window-function)
(make-local-variable 'ediff-default-variant)
@@ -254,13 +240,9 @@ to invocation.")
(if (string-match "buffer" (symbol-name ediff-job-name))
(setq ediff-keep-variants t))
- ;; XEmacs has local-pre-command-hook
- (if ediff-emacs-p
- (make-local-variable 'pre-command-hook))
-
- (if ediff-emacs-p
- (add-hook 'pre-command-hook 'ediff-spy-after-mouse)
- (add-hook 'local-pre-command-hook 'ediff-spy-after-mouse))
+ (make-local-hook 'pre-command-hook)
+ (if (ediff-window-display-p)
+ (add-hook 'pre-command-hook 'ediff-spy-after-mouse))
(setq ediff-mouse-pixel-position (mouse-pixel-position))
;; adjust for merge jobs
@@ -490,7 +472,7 @@ to invocation.")
(defun ediff-help-message-line-length ()
(save-excursion
(goto-char (point-min))
- (if ediff-prefer-long-help-message
+ (if ediff-use-long-help-message
(next-line 1))
(end-of-line)
(current-column)))
@@ -546,7 +528,7 @@ to invocation.")
(t ; long brief msg, not multiframe --- put in the middle
ediff-brief-message-string)
))
- (setq ediff-help-message (if ediff-prefer-long-help-message
+ (setq ediff-help-message (if ediff-use-long-help-message
ediff-long-help-message
ediff-brief-help-message))
(run-hooks 'ediff-display-help-hook))
@@ -703,11 +685,9 @@ Reestablish the default three-window display."
(interactive)
(ediff-barf-if-not-control-buffer)
- ;; force all minibuffer to display ediff's messages.
- ;; when xemacs implements minibufferless frames, this won't be necessary
- (if ediff-xemacs-p (setq synchronize-minibuffers t))
+;; ;; No longer needed: XEmacs has surrogate minibuffers now.
+;; (if ediff-xemacs-p (setq synchronize-minibuffers t))
- (setq ediff-disturbed-overlays nil) ; clear after use
(let (buffer-read-only)
(if (and (ediff-buffer-live-p ediff-buffer-A)
(ediff-buffer-live-p ediff-buffer-B)
@@ -716,9 +696,8 @@ Reestablish the default three-window display."
(ediff-setup-windows
ediff-buffer-A ediff-buffer-B ediff-buffer-C ediff-control-buffer)
(or (eq this-command 'ediff-quit)
- (message
- "You've killed an essential Ediff buffer---Please quit Ediff"
- (beep 1)))
+ (message ediff-KILLED-VITAL-BUFFER
+ (beep 1)))
))
;; set visibility range appropriate to this invocation of Ediff.
@@ -751,7 +730,7 @@ Reestablish the default three-window display."
(raise-frame (window-frame ediff-window-C)))))
(if (and (ediff-window-display-p)
(frame-live-p ediff-control-frame)
- (not ediff-prefer-long-help-message)
+ (not ediff-use-long-help-message)
(not (ediff-frame-iconified-p ediff-control-frame)))
(raise-frame ediff-control-frame))
@@ -773,10 +752,10 @@ Reestablish the default three-window display."
(ediff-recenter-one-window 'C))
(ediff-eval-in-buffer control-buf
- (ediff-recenter-ancestor) ; it checks if ancestor is alive
+ (ediff-recenter-ancestor) ; check if ancestor is alive
(if (and (ediff-multiframe-setup-p)
- (not ediff-prefer-long-help-message)
+ (not ediff-use-long-help-message)
(not (ediff-frame-iconified-p ediff-control-frame)))
;; never grab mouse on quit in this place
(ediff-reset-mouse
@@ -870,7 +849,7 @@ Does nothing if file-A and file-B are in different frames."
On a dumb terminal, switches between ASCII highlighting and no highlighting."
(interactive)
(ediff-barf-if-not-control-buffer)
- (if (not (ediff-window-display-p))
+ (if (not (ediff-has-face-support-p))
(if (eq ediff-highlighting-style 'ascii)
(progn
(message "ASCII highlighting flags removed")
@@ -951,11 +930,11 @@ In both cases, operates on the currrent difference region."
(ediff-barf-if-not-control-buffer)
(let (buffer-read-only)
(erase-buffer)
- (setq ediff-prefer-long-help-message (not ediff-prefer-long-help-message))
+ (setq ediff-use-long-help-message (not ediff-use-long-help-message))
(ediff-set-help-message))
;; remember the icon status of the control frame when the user requested
;; full control message
- (if (and ediff-prefer-long-help-message (ediff-multiframe-setup-p))
+ (if (and ediff-use-long-help-message (ediff-multiframe-setup-p))
(setq ediff-prefer-iconified-control-frame
(ediff-frame-iconified-p ediff-control-frame)))
@@ -971,11 +950,11 @@ If optional argument BUF is specified, toggle read-only in that buffer instead
of the current buffer."
(interactive)
(ediff-barf-if-not-control-buffer)
- (let ((ctl-buf (if (null buf) (current-buffer))))
+ (let ((ctl-buf (if (null buf) (current-buffer)))
+ (buf-type (ediff-char-to-buftype last-command-char)))
(or buf (ediff-recenter))
(or buf
- (setq buf
- (ediff-get-buffer (ediff-char-to-buftype last-command-char))))
+ (setq buf (ediff-get-buffer buf-type)))
(ediff-eval-in-buffer buf ; eval in buf A/B/C
(let* ((file (buffer-file-name buf))
@@ -1009,8 +988,7 @@ of the current buffer."
;; is checked in.
(ediff-eval-in-buffer ctl-buf
(ediff-change-saved-variable
- 'buffer-read-only nil
- (ediff-char-to-buftype last-command-char))))
+ 'buffer-read-only nil buf-type)))
(t
(setq toggle-ro-cmd 'toggle-read-only)
(beep 1) (beep 1)
@@ -1041,16 +1019,22 @@ of the current buffer."
;; in and not checked out for the purpose of patching (since patch won't be
;; able to read such a file anyway).
;; FILE is a string representing file name
-(defsubst ediff-file-checked-out-p (file)
+(defun ediff-file-checked-out-p (file)
(and (stringp file)
(file-exists-p file)
(file-writable-p file)
- (file-exists-p (concat file ",v"))))
-(defsubst ediff-file-checked-in-p (file)
+ (or
+ (file-exists-p (concat file ",v"))
+ (file-exists-p (concat "RCS/" file ",v")))
+ ))
+(defun ediff-file-checked-in-p (file)
(and (stringp file)
(file-exists-p file)
(not (file-writable-p file))
- (file-exists-p (concat file ",v"))))
+ (or
+ (file-exists-p (concat file ",v"))
+ (file-exists-p (concat "RCS/" file ",v")))
+ ))
(defun ediff-swap-buffers ()
"Rotate the display of buffers A, B, and C."
@@ -1063,7 +1047,7 @@ of the current buffer."
(hide-regexp ediff-regexp-hide-A)
(focus-regexp ediff-regexp-focus-A)
(wide-visibility-p (eq ediff-visible-bounds ediff-wide-bounds))
- (overlay (if (ediff-window-display-p)
+ (overlay (if (ediff-has-face-support-p)
ediff-current-diff-overlay-A)))
(if ediff-3way-comparison-job
(progn
@@ -1112,7 +1096,7 @@ of the current buffer."
;; The following is needed for XEmacs, since there one can't move
;; overlay to another buffer. In Emacs, this swap is redundant.
- (if (ediff-window-display-p)
+ (if (ediff-has-face-support-p)
(if ediff-3way-comparison-job
(setq ediff-current-diff-overlay-A ediff-current-diff-overlay-C
ediff-current-diff-overlay-C ediff-current-diff-overlay-B
@@ -1219,8 +1203,7 @@ This is primarily for debugging, but one can use it for fun, too."
Used in ediff-windows/regions only."
(interactive)
(if (eq ediff-buffer-A ediff-buffer-B)
- (error
- "Buffers A and B are the same. Can't narrow to two different regions"))
+ (error ediff-NO-DIFFERENCES))
(if (eq ediff-visible-bounds ediff-wide-bounds)
(setq ediff-visible-bounds ediff-narrow-bounds)
(setq ediff-visible-bounds ediff-wide-bounds))
@@ -1255,7 +1238,7 @@ Used in ediff-windows/regions only."
(narrow-to-region
(ediff-overlay-start overl-B) (ediff-overlay-end overl-B)))
- (if ediff-3way-job
+ (if ediff-3way-comparison-job
(ediff-eval-in-buffer ediff-buffer-C
(narrow-to-region
(ediff-overlay-start overl-C) (ediff-overlay-end overl-C))))
@@ -1277,7 +1260,7 @@ Used in ediff-windows/regions only."
(ediff-buffer-live-p ediff-buffer-B)
(or (not ediff-3way-job) ediff-buffer-C)
))
- (error "You've killed an essential Ediff buffer---Please quit Ediff"))
+ (error ediff-KILLED-VITAL-BUFFER))
(let* ((wind (selected-window))
(wind-A ediff-window-A)
@@ -1308,7 +1291,7 @@ Used in ediff-windows/regions only."
(defun ediff-scroll-vertically (&optional arg)
"Vertically scroll buffers A, B \(and C if appropriate\).
With optional argument ARG, scroll ARG lines; otherwise scroll by nearly
-the height of window-A."
+the one half of the height of window-A."
(interactive "P")
(ediff-barf-if-not-control-buffer)
@@ -1320,7 +1303,7 @@ the height of window-A."
(or (not ediff-3way-job)
(ediff-buffer-live-p ediff-buffer-C))
))
- (error "You've killed an essential Ediff buffer---Please quit Ediff"))
+ (error ediff-KILLED-VITAL-BUFFER))
(ediff-operate-on-windows
(if (memq last-command-char '(?v ?\C-v))
@@ -1364,7 +1347,7 @@ the width of the A/B/C windows."
(or (not ediff-3way-job)
(ediff-buffer-live-p ediff-buffer-C))
))
- (error "You've killed an essential Ediff buffer---Please quit Ediff"))
+ (error ediff-KILLED-VITAL-BUFFER))
(ediff-operate-on-windows
(if (= last-command-char ?<)
@@ -1566,7 +1549,8 @@ With a prefix argument, go back that many differences."
(if (and (>= difference-number -1)
(< difference-number (1+ ediff-number-of-differences)))
(ediff-unselect-and-select-difference difference-number)
- (error "Bad difference number, %d" difference-number)))
+ (error "Bad difference number, %d. Valid numbers are 1 to %d"
+ (1+ difference-number) ediff-number-of-differences)))
(defun ediff-jump-to-difference-at-point ()
"Go to difference closest to the point in buffer A, B, or C.
@@ -1610,8 +1594,8 @@ invoked this command."
;;; Copying diffs.
(defun ediff-diff-to-diff (arg &optional keys)
- "Copy buffer-X'th diff to buffer Y \(X,Y are A, B, or C\).
-If numerical prefix argument, copy this diff specified in the arg.
+ "Copy buffer-X'th difference region to buffer Y \(X,Y are A, B, or C\).
+If numerical prefix argument, copy the difference specified in the arg.
Otherwise, copy the difference given by `ediff-current-difference'.
This command assumes it is bound to a 2-character key sequence, `ab', `ba',
`ac', etc., which is used to determine the types of buffers to be used for
@@ -1623,7 +1607,7 @@ determine the source and the target buffers instead of the command keys."
(interactive "P")
(ediff-barf-if-not-control-buffer)
(or keys (setq keys (this-command-keys)))
- (if arg
+ (if (numberp arg)
(ediff-jump-to-difference arg))
(let* ((key1 (aref keys 0))
(key2 (aref keys 1))
@@ -1636,6 +1620,43 @@ determine the source and the target buffers instead of the command keys."
;; recenter with rehighlighting, but no messages
(ediff-recenter)))
+(defun ediff-copy-A-to-B (arg)
+ "Copy ARGth difference region from buffer A to B.
+ARG is a prefix argument. If nil, copy the current difference region."
+ (interactive "P")
+ (ediff-diff-to-diff arg "ab"))
+
+(defun ediff-copy-B-to-A (arg)
+ "Copy ARGth difference region from buffer B to A.
+ARG is a prefix argument. If nil, copy the current difference region."
+ (interactive "P")
+ (ediff-diff-to-diff arg "ba"))
+
+(defun ediff-copy-A-to-C (arg)
+ "Copy ARGth difference region from buffer A to buffer C.
+ARG is a prefix argument. If nil, copy the current difference region."
+ (interactive "P")
+ (ediff-diff-to-diff arg "ac"))
+
+(defun ediff-copy-B-to-C (arg)
+ "Copy ARGth difference region from buffer B to buffer C.
+ARG is a prefix argument. If nil, copy the current difference region."
+ (interactive "P")
+ (ediff-diff-to-diff arg "bc"))
+
+(defun ediff-copy-C-to-B (arg)
+ "Copy ARGth difference region from buffer C to B.
+ARG is a prefix argument. If nil, copy the current difference region."
+ (interactive "P")
+ (ediff-diff-to-diff arg "cb"))
+
+(defun ediff-copy-C-to-A (arg)
+ "Copy ARGth difference region from buffer C to A.
+ARG is a prefix argument. If nil, copy the current difference region."
+ (interactive "P")
+ (ediff-diff-to-diff arg "ca"))
+
+
;; Copy diff N from FROM-BUF-TYPE \(given as A, B or C\) to TO-BUF-TYPE.
;; If optional DO-NOT-SAVE is non-nil, do not save the old value of the
@@ -1665,10 +1686,8 @@ determine the source and the target buffers instead of the command keys."
n to-buf-type ctrl-buf
reg-to-delete-beg reg-to-delete-end))
- (setq ediff-disturbed-overlays nil) ; clear before use
-
(if (string= reg-to-delete reg-to-copy)
- (setq saved-p nil) ; refuse to copy identical buffers
+ (setq saved-p nil) ; don't copy identical buffers
;; seems ok to copy
(if (or batch-invocation (ediff-test-save-region n to-buf-type))
(condition-case conds
@@ -1676,30 +1695,12 @@ determine the source and the target buffers instead of the command keys."
(ediff-eval-in-buffer to-buf
;; to prevent flags from interfering if buffer is writable
(let ((inhibit-read-only (null buffer-read-only)))
- ;; these two insert a dummy char to overcome a bug in
- ;; XEmacs, which sometimes prevents 0-length extents
- ;; from sensing insertion at its end-points.
- ;; (need to check if 19.12 still has the bug)
- (if ediff-xemacs-p
- (progn
- (goto-char reg-to-delete-end)
- (insert-before-markers "@")))
(goto-char reg-to-delete-end)
- (insert-before-markers reg-to-copy)
+ (insert reg-to-copy)
- ;; delete the dummy char "@"
- (if ediff-xemacs-p
- (delete-char 1))
-
- (if ediff-xemacs-p
- (if (> reg-to-delete-end reg-to-delete-beg)
- (kill-region reg-to-delete-beg
- reg-to-delete-end))
- (if (> reg-to-delete-end reg-to-delete-beg)
- (kill-region reg-to-delete-beg reg-to-delete-end)
- (ediff-move-disturbed-overlays reg-to-delete-beg)
- ))
+ (if (> reg-to-delete-end reg-to-delete-beg)
+ (kill-region reg-to-delete-beg reg-to-delete-end))
))
(or batch-invocation
(setq
@@ -1789,38 +1790,20 @@ determine the source and the target buffers instead of the command keys."
(setq saved-diff (cdr saved-rec))
(if (> ediff-number-of-differences 0)
(error "Nothing saved for diff %d in buffer %S" (1+ n) buf-type)
- (error "No differences found")))
+ (error ediff-NO-DIFFERENCES)))
(setq reg-beg (ediff-get-diff-posn buf-type 'beg n ediff-control-buffer))
(setq reg-end (ediff-get-diff-posn buf-type 'end n ediff-control-buffer))
- (setq ediff-disturbed-overlays nil) ; clear before use
(condition-case conds
(ediff-eval-in-buffer buf
(let ((inhibit-read-only (null buffer-read-only)))
- ;; these two insert a dummy char to overcome a bug in XEmacs,
- ;; which sometimes prevents 0-length extents from sensing
- ;; insertion at its end-points.
- ;; (need to check if 19.12 still has the bug)
- (if ediff-xemacs-p
- (progn
- (goto-char reg-end)
- (insert-before-markers "@")))
(goto-char reg-end)
- (insert-before-markers saved-diff)
+ (insert saved-diff)
- ;; delete dummy char
- (if ediff-xemacs-p
- (delete-char 1))
-
- (if ediff-xemacs-p
- (if (> reg-end reg-beg)
- (kill-region reg-beg reg-end))
- (if (> reg-end reg-beg)
- (kill-region reg-beg reg-end)
- (ediff-move-disturbed-overlays reg-beg)
- ))
+ (if (> reg-end reg-beg)
+ (kill-region reg-beg reg-end))
(setq recovered t)
))
@@ -1852,19 +1835,25 @@ determine the source and the target buffers instead of the command keys."
(defun ediff-restore-diff (arg &optional key)
"Restore ARGth diff from `ediff-killed-diffs-alist'.
-ARG is a prefix argument. If ARG is nil, restore current-difference.
-
+ARG is a prefix argument. If ARG is nil, restore the current-difference.
If the second optional argument, a character, is given, use it to
determine the target buffer instead of last-command-char"
(interactive "P")
(ediff-barf-if-not-control-buffer)
- (if arg
+ (if (numberp arg)
(ediff-jump-to-difference arg))
(ediff-pop-diff ediff-current-difference
(ediff-char-to-buftype (or key last-command-char)))
;; recenter with rehighlighting, but no messages
(let (ediff-verbose-p)
(ediff-recenter)))
+
+(defun ediff-restore-diff-in-merge-buffer (arg)
+ "Restore ARGth diff in the merge buffer.
+ARG is a prefix argument. If nil, restore the current diff."
+ (interactive "P")
+ (ediff-restore-diff arg ?c))
+
(defun ediff-toggle-regexp-match ()
"Toggle between focusing and hiding of difference regions that match
@@ -1990,25 +1979,25 @@ the number seen by the user."
(regex-B ediff-regexp-focus-B)
(regex-C ediff-regexp-focus-C)
(reg-A-match (ediff-eval-in-buffer ediff-buffer-A
- (goto-char (ediff-get-diff-posn 'A 'beg n ctl-buf))
- (re-search-forward
- regex-A
- (ediff-get-diff-posn 'A 'end n ctl-buf)
- t)))
+ (save-restriction
+ (narrow-to-region
+ (ediff-get-diff-posn 'A 'beg n ctl-buf)
+ (ediff-get-diff-posn 'A 'end n ctl-buf))
+ (goto-char (point-min))
+ (re-search-forward regex-A nil t))))
(reg-B-match (ediff-eval-in-buffer ediff-buffer-B
- (goto-char (ediff-get-diff-posn 'B 'beg n ctl-buf))
- (re-search-forward
- regex-B
- (ediff-get-diff-posn 'B 'end n ctl-buf)
- t)))
+ (save-restriction
+ (narrow-to-region
+ (ediff-get-diff-posn 'B 'beg n ctl-buf)
+ (ediff-get-diff-posn 'B 'end n ctl-buf))
+ (re-search-forward regex-B nil t))))
(reg-C-match (if ediff-3way-comparison-job
(ediff-eval-in-buffer ediff-buffer-C
- (goto-char
- (ediff-get-diff-posn 'C 'beg n ctl-buf))
- (re-search-forward
- regex-C
- (ediff-get-diff-posn 'C 'end n ctl-buf)
- t)))))
+ (save-restriction
+ (narrow-to-region
+ (ediff-get-diff-posn 'C 'beg n ctl-buf)
+ (ediff-get-diff-posn 'C 'end n ctl-buf))
+ (re-search-forward regex-C nil t))))))
(not (eval (if ediff-3way-comparison-job
(list ediff-focus-regexp-connective
reg-A-match reg-B-match reg-C-match)
@@ -2031,25 +2020,27 @@ the number seen by the user."
(regex-B ediff-regexp-hide-B)
(regex-C ediff-regexp-hide-C)
(reg-A-match (ediff-eval-in-buffer ediff-buffer-A
- (goto-char (ediff-get-diff-posn 'A 'beg n ctl-buf))
- (re-search-forward
- regex-A
- (ediff-get-diff-posn 'A 'end n ctl-buf)
- t)))
+ (save-restriction
+ (narrow-to-region
+ (ediff-get-diff-posn 'A 'beg n ctl-buf)
+ (ediff-get-diff-posn 'A 'end n ctl-buf))
+ (goto-char (point-min))
+ (re-search-forward regex-A nil t))))
(reg-B-match (ediff-eval-in-buffer ediff-buffer-B
- (goto-char (ediff-get-diff-posn 'B 'beg n ctl-buf))
- (re-search-forward
- regex-B
- (ediff-get-diff-posn 'B 'end n ctl-buf)
- t)))
+ (save-restriction
+ (narrow-to-region
+ (ediff-get-diff-posn 'B 'beg n ctl-buf)
+ (ediff-get-diff-posn 'B 'end n ctl-buf))
+ (goto-char (point-min))
+ (re-search-forward regex-B nil t))))
(reg-C-match (if ediff-3way-comparison-job
(ediff-eval-in-buffer ediff-buffer-C
- (goto-char
- (ediff-get-diff-posn 'C 'beg n ctl-buf))
- (re-search-forward
- regex-C
- (ediff-get-diff-posn 'C 'end n ctl-buf)
- t)))))
+ (save-restriction
+ (narrow-to-region
+ (ediff-get-diff-posn 'C 'beg n ctl-buf)
+ (ediff-get-diff-posn 'C 'end n ctl-buf))
+ (goto-char (point-min))
+ (re-search-forward regex-C nil t))))))
(eval (if ediff-3way-comparison-job
(list ediff-hide-regexp-connective
reg-A-match reg-B-match reg-C-match)
@@ -2196,7 +2187,6 @@ temporarily reverses the meaning of this variable."
(ediff-kill-buffer-carefully ediff-msg-buffer)
(ediff-kill-buffer-carefully ediff-debug-buffer)
- ;;(redraw-display)
(if (and (ediff-window-display-p) (frame-live-p ctl-frame))
(delete-frame ctl-frame))
(ediff-kill-buffer-carefully ctl-buf)
@@ -2378,13 +2368,16 @@ Hit \\[ediff-recenter] to reset the windows afterward."
ediff-number-of-differences) 'end)
(t (1+ ediff-current-difference)))))
- (cond (ediff-ignore-similar-regions
- (princ "\nSkipping regions that differ only in white space & line breaks"))
- (t
- (princ "\nNot skipping regions that differ in white space & line breaks")))
+ (princ
+ (format "\n%s regions that differ only in white space & line breaks"
+ (if ediff-ignore-similar-regions
+ "Skipping" "Not skipping")))
+ (if (and ediff-merge-job ediff-show-clashes-only)
+ (princ
+ "\nFocusing on regions where both buffers differ from the ancestor"))
(cond ((eq ediff-skip-diff-region-function 'ediff-show-all-diffs)
- (princ "\nSelective browsing by regexp is off.\n"))
+ (princ "\nSelective browsing by regexp is off\n"))
((eq ediff-skip-diff-region-function
ediff-hide-regexp-matches-function)
(princ
@@ -2414,31 +2407,6 @@ Hit \\[ediff-recenter] to reset the windows afterward."
(if (window-live-p ediff-control-window)
(select-window ediff-control-window)))
-(defun ediff-documentation ()
- "Jump to Ediff's Info file."
- (interactive)
- (let ((ctl-window ediff-control-window)
- (ctl-buf ediff-control-buffer))
-
- (ediff-skip-unsuitable-frames)
- (condition-case nil
- (progn
- (pop-to-buffer (get-buffer-create "*info*"))
- (info "ediff.info")
- (message "Type `i' to search for a specific topic"))
- (error (beep 1)
- (with-output-to-temp-buffer " *ediff-info*"
- (princ (format "
-The Info file for Ediff does not seem to be installed.
-
-This file is part of the distribution of %sEmacs.
-Please contact your system administrator. "
- (if ediff-xemacs-p "X" ""))))
- (if (window-live-p ctl-window)
- (progn
- (select-window ctl-window)
- (set-window-buffer ctl-window ctl-buf)))))))
-
@@ -2452,7 +2420,7 @@ Please contact your system administrator. "
(ediff-buffer-live-p ediff-buffer-B)
(ediff-valid-difference-p n))
(progn
- (if (and (ediff-window-display-p) ediff-use-faces)
+ (if (and (ediff-has-face-support-p) ediff-use-faces)
(progn
(ediff-highlight-diff n)
(setq ediff-highlighting-style 'face))
@@ -2479,7 +2447,7 @@ Please contact your system administrator. "
(defun ediff-unselect-difference (n)
(if (ediff-valid-difference-p n)
(progn
- (cond ((and (ediff-window-display-p) ediff-use-faces)
+ (cond ((and (ediff-has-face-support-p) ediff-use-faces)
(ediff-unhighlight-diff))
((eq ediff-highlighting-style 'ascii)
(ediff-remove-flags-from-buffer
@@ -2578,18 +2546,35 @@ Please contact your system administrator. "
(file-name-nondirectory default-file) f)))
f))
-;; If `prefix' is given, then it is used as a prefix for the temp file
-;; name. Otherwise, `ediff_' is used. If `file' is given, use this
+;; If PREFIX is given, then it is used as a prefix for the temp file
+;; name. Otherwise, `ediff_' is used. If FILE is given, use this
;; file and don't create a new one.
+;; On MS-DOS, make sure the prefix isn't longer than 7 characters, or
+;; else `make-temp-name' isn't guaranteed to return a unique filename.
;; Also, save buffer from START to END in the file.
;; START defaults to (point-min), END to (point-max)
(defun ediff-make-temp-file (buff &optional prefix given-file start end)
- (let ((f (or given-file
- (make-temp-name (concat
- ediff-temp-file-prefix
- (if prefix
- (concat prefix "_")
- "ediff_"))))))
+ (let ((p (or prefix "ediff"))
+ f)
+ (if (and (eq system-type 'ms-dos) (> (length p) 7))
+ (setq p (substring p 0 7)))
+
+ (setq f (concat ediff-temp-file-prefix p)
+ f (cond (given-file)
+ ((find-file-name-handler f 'find-file-noselect)
+ ;; to thwart file handlers in write-region, e.g., if file
+ ;; name ends with .Z or .gz
+ ;; This is needed so that patches produced by ediff will
+ ;; have more meaningful names
+ (make-temp-name f))
+ ;; Prefix is most often the same as the file name for the
+ ;; variant. Here we are trying to use the original file name
+ ;; but in the temp directory.
+ ((and prefix (not (file-exists-p f))) f)
+ ;; If a file with the orig name exists, add some random stuff
+ ;; to it.
+ (t (make-temp-name f))))
+
;; create the file
(ediff-eval-in-buffer buff
(write-region (if start start (point-min))
@@ -2617,7 +2602,7 @@ Please contact your system administrator. "
;; Signal an error if we can't make them the same, or the user doesn't want
;; to do what is necessary to make them the same.
;; If file has file handlers (indicated by the optional arg), then we
-;; offer to instead of saving. This is one difference with Emerge.
+;; offer to revert instead of saving. This is one difference with Emerge.
;; Another is that we always offer to revert obsolete files, whether they
;; are modified or not.
(defun ediff-verify-file-buffer (&optional file-magic)
@@ -2649,49 +2634,6 @@ Please contact your system administrator. "
(error "Buffer out of sync for file %s" buffer-file-name))))
-
-;; It would be nice to use these two functions as hooks instead of
-;; ediff-insert-in-front and ediff-move-disturbed-overlays.
-;; However, Emacs has a bug that causes BEG and END, below, to be
-;; the same, i.e., the end of inserted text is not passed correctly.
-;; Since the overlay doesn't move when these hooks run,
-;; there is no way to correctly determine the new (desired) position of
-;; the overlay end.
-;; Either this bug is fixed, or (better) use sticky overlays when they will
-;; be implemented in Emacs, like they are in XEmacs.
-;;(defun ediff-capture-inserts-in-front (overl flag beg end &optional len)
-;; (if (and flag (ediff-overlay-get overl 'ediff-diff-num))
-;; (ediff-move-overlay overl beg (ediff-overlay-end overl))
-;; ))
-;;
-;;(defun ediff-capture-inserts-behind (overl flag beg end &optional len)
-;; (if (and flag (ediff-overlay-get overl 'ediff-diff-num))
-;; (ediff-move-overlay overl (ediff-overlay-start overl) (point))
-;; ))
-
-;; to be deleted in due time
-;; Capture overlays that had insertions in the front.
-;; Called when overlay OVERL gets insertion in front.
-(defun ediff-insert-in-front (overl &optional flag beg end length)
- (if (ediff-overlay-get overl 'ediff-diff-num)
- (setq ediff-disturbed-overlays
- (cons overl ediff-disturbed-overlays))))
-
-
-;; to be deleted in due time
-;; We can't move overlays directly in insert-in-front-hooks
-;; because when diff is highlighted with ascii flags, they will disturb
-;; overlays and so they will be included in them, which we don't want.
-(defun ediff-move-disturbed-overlays (posn)
- (mapcar (function (lambda (overl)
- (ediff-move-overlay overl
- posn
- (ediff-overlay-end overl))
- ))
- ediff-disturbed-overlays)
- (setq ediff-disturbed-overlays nil))
-
-
(defun ediff-save-buffer (arg)
"Safe way of saving buffers A, B, C, and the diff output.
`wa' saves buffer A, `wb' saves buffer B, `wc' saves buffer C,
@@ -2721,16 +2663,26 @@ Without an argument, it saves customized diff argument, if available
(save-buffer)))
(defun ediff-compute-custom-diffs-maybe ()
- (or ediff-3way-job
- (let ((file-A (ediff-make-temp-file ediff-buffer-A))
- (file-B (ediff-make-temp-file ediff-buffer-B)))
- (or (ediff-buffer-live-p ediff-custom-diff-buffer)
- (setq ediff-custom-diff-buffer
- (get-buffer-create
- (ediff-unique-buffer-name "*ediff-custom-diff" "*"))))
- (ediff-exec-process
- ediff-custom-diff-program ediff-custom-diff-buffer 'synchronize
- ediff-custom-diff-options file-A file-B))))
+ (let ((buf-A-file-name (buffer-file-name ediff-buffer-A))
+ (buf-B-file-name (buffer-file-name ediff-buffer-B))
+ file-A file-B)
+ (if (stringp buf-A-file-name)
+ (setq buf-A-file-name (file-name-nondirectory buf-A-file-name)))
+ (if (stringp buf-B-file-name)
+ (setq buf-B-file-name (file-name-nondirectory buf-B-file-name)))
+ (setq file-A (ediff-make-temp-file ediff-buffer-A buf-A-file-name)
+ file-B (ediff-make-temp-file ediff-buffer-B buf-B-file-name))
+
+ (or (ediff-buffer-live-p ediff-custom-diff-buffer)
+ (setq ediff-custom-diff-buffer
+ (get-buffer-create
+ (ediff-unique-buffer-name "*ediff-custom-diff" "*"))))
+ (ediff-exec-process
+ ediff-custom-diff-program ediff-custom-diff-buffer 'synchronize
+ ediff-custom-diff-options file-A file-B)
+ (delete-file file-A)
+ (delete-file file-B)
+ ))
(defun ediff-show-diff-output (arg)
(interactive "P")
@@ -2842,13 +2794,12 @@ buffer."
(or n (setq n ediff-current-difference))
(if (or (< n 0) (>= n ediff-number-of-differences))
(if (> ediff-number-of-differences 0)
- (error "There is no diff %d. Valid diffs are 1 to %d"
+ (error "Bad difference number, %d. Valid numbers are 1 to %d"
(1+ n) ediff-number-of-differences)
- (error "No differences found")))
+ (error ediff-NO-DIFFERENCES)))
(setq diff-overlay (ediff-get-diff-overlay n buf-type)))
(if (not (ediff-buffer-live-p (ediff-overlay-buffer diff-overlay)))
- (error
- "You have killed an essential Ediff buffer---Please exit Ediff"))
+ (error ediff-KILLED-VITAL-BUFFER))
(if (eq pos 'beg)
(ediff-overlay-start diff-overlay)
(ediff-overlay-end diff-overlay))
@@ -2900,14 +2851,14 @@ buffer."
;; current difference region
(ediff-set-overlay-face
overlay
- (if (and (ediff-window-display-p)
+ (if (and (ediff-has-face-support-p)
ediff-use-faces ediff-highlight-all-diffs)
(ediff-background-face buf-type ediff-current-difference)))
)))
(defun ediff-unhighlight-diffs-totally-in-one-buffer (buf-type)
(ediff-unselect-and-select-difference -1)
- (if (and (ediff-window-display-p) ediff-use-faces)
+ (if (and (ediff-has-face-support-p) ediff-use-faces)
(let* ((inhibit-quit t)
(current-diff-overlay-var
(intern (format "ediff-current-diff-overlay-%S" buf-type)))
@@ -2963,7 +2914,7 @@ buffer."
;;; Misc
-;; These two functions are here to neutralize XEmacs's unwillingness to
+;; These two functions are here to neutralize XEmacs unwillingless to
;; handle overlays whose buffers were deleted.
(defun ediff-move-overlay (overlay beg end &optional buffer)
"Calls `move-overlay' in Emacs and `set-extent-endpoints' in Lemacs.
@@ -3003,27 +2954,19 @@ Checks if overlay's buffer exists."
(setq beg (eval beg)))
(or (number-or-marker-p end)
(setq end (eval end)))
- (setq overl (ediff-make-overlay beg end buff))
+ (setq overl
+ (if ediff-xemacs-p
+ (make-extent beg end buff)
+ ;; don't advance front, but advance rear
+ (make-overlay beg end buff nil 'rear-advance)))
- (if ediff-xemacs-p
- (progn
- ;; take precautions against detached extents
- (ediff-overlay-put overl 'detachable nil)
- ;; chars inserted at both ends will be inside extent
- (ediff-overlay-put overl 'start-open nil)
- (ediff-overlay-put overl 'end-open nil))
- (ediff-overlay-put overl 'evaporate nil) ; don't detach
- ;; doesn't work since emacs buggily doesn't call these functions
- ;; after the change
- ;;(ediff-overlay-put overl 'insert-in-front-hooks
- ;; '(ediff-capture-inserts-in-front))
- ;;(ediff-overlay-put overl 'insert-behind-hooks
- ;; '(ediff-capture-inserts-behind))
-
- ;; These two are not yet implemented in Emacs
- (ediff-overlay-put overl 'rear-sticky t)
- (ediff-overlay-put overl 'front-sticky t)
- )
+ (if ediff-emacs-p
+ (ediff-overlay-put overl 'evaporate nil) ; don't detach
+ (ediff-overlay-put overl 'detachable nil) ; don't detach
+ ;; don't advance front, but advance rear
+ (ediff-overlay-put overl 'start-open nil)
+ (ediff-overlay-put overl 'end-open nil))
+
(ediff-overlay-put overl 'ediff-diff-num 0)
overl))))
@@ -3285,6 +3228,11 @@ Mail anyway? (y or n) ")
(ediff-restore-variables ediff-protected-variables values-Ancestor)))
))
+;; save BUFFER in FILE. used in hooks.
+(defun ediff-save-buffer-in-file (buffer file)
+ (ediff-eval-in-buffer buffer
+ (write-file file)))
+
;;; Debug
@@ -3309,11 +3257,9 @@ Mail anyway? (y or n) ")
"Toggle profiling Ediff commands."
(interactive)
(ediff-barf-if-not-control-buffer)
- (if ediff-emacs-p
- (make-local-variable 'post-command-hook))
- (let ((pre-hook (if ediff-emacs-p 'pre-command-hook 'local-pre-command-hook))
- (post-hook
- (if ediff-emacs-p 'post-command-hook 'local-post-command-hook)))
+ (make-local-hook 'post-command-hook)
+ (let ((pre-hook 'pre-command-hook)
+ (post-hook 'post-command-hook))
(if (not (equal ediff-command-begin-time '(0 0 0)))
(progn (remove-hook pre-hook 'ediff-save-time)
(remove-hook post-hook 'ediff-calc-command-time)
@@ -3361,6 +3307,63 @@ Mail anyway? (y or n) ")
(ediff-print-diff-vector (intern "ediff-difference-vector-Ancestor"))
))
+
+;;; General utilities
+
+;; this uses comparison-func to decide who is a member
+(defun ediff-member (elt lis comparison-func)
+ (while (and lis (not (funcall comparison-func (car lis) elt)))
+ (setq lis (cdr lis)))
+ lis)
+
+;; this uses comparison-func to decide who is a member, and this determines how
+;; intersection looks like
+(defun ediff-intersection (lis1 lis2 comparison-func)
+ (let ((result (list 'a)))
+ (while lis1
+ (if (ediff-member (car lis1) lis2 comparison-func)
+ (nconc result (list (car lis1))))
+ (setq lis1 (cdr lis1)))
+ (cdr result)))
+
+
+;; eliminates duplicates using comparison-func
+(defun ediff-union (lis1 lis2 comparison-func)
+ (let ((result (list 'a)))
+ (while lis1
+ (or (ediff-member (car lis1) (cdr result) comparison-func)
+ (nconc result (list (car lis1))))
+ (setq lis1 (cdr lis1)))
+ (while lis2
+ (or (ediff-member (car lis2) (cdr result) comparison-func)
+ (nconc result (list (car lis2))))
+ (setq lis2 (cdr lis2)))
+ (cdr result)))
+
+;; eliminates duplicates using comparison-func
+(defun ediff-set-difference (lis1 lis2 comparison-func)
+ (let ((result (list 'a)))
+ (while lis1
+ (or (ediff-member (car lis1) (cdr result) comparison-func)
+ (ediff-member (car lis1) lis2 comparison-func)
+ (nconc result (list (car lis1))))
+ (setq lis1 (cdr lis1)))
+ (cdr result)))
+
+(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)))
+
+
;; don't report error if version control package wasn't found
;;(ediff-load-version-control 'silent)
diff --git a/lisp/ediff-wind.el b/lisp/ediff-wind.el
index d9b3d398e0..34775a9cce 100644
--- a/lisp/ediff-wind.el
+++ b/lisp/ediff-wind.el
@@ -85,29 +85,28 @@ This variable has no effect when buffer-A/B/C are shown in different frames.
In this case, Ediff will use those frames to display these buffers.")
(defconst ediff-control-frame-parameters
- (if (ediff-window-display-p)
- (list
- '(name . "Ediff")
- ;;'(unsplittable . t)
- '(minibuffer . nil)
- '(user-position . t) ; Emacs only
- '(vertical-scroll-bars . nil) ; Emacs only
- '(scrollbar-width . 0) ; XEmacs only
- '(menu-bar-lines . 0) ; Emacs only
- '(visibility . nil) ; doesn't work for XEmacs yet
- ;; don't lower and auto-raise
- '(auto-lower . nil)
- '(auto-raise . t)
- ;; this blocks queries from window manager as to where to put
- ;; ediff's control frame. we put the frame outside the display,
- ;; so the initial frame won't jump all over the screen
- (cons 'top (if (fboundp 'ediff-display-pixel-height)
- (1+ (ediff-display-pixel-height))
- 3000))
- (cons 'left (if (fboundp 'ediff-display-pixel-width)
- (1+ (ediff-display-pixel-width))
- 3000))
- ))
+ (list
+ '(name . "Ediff")
+ ;;'(unsplittable . t)
+ '(minibuffer . nil)
+ '(user-position . t) ; Emacs only
+ '(vertical-scroll-bars . nil) ; Emacs only
+ '(scrollbar-width . 0) ; XEmacs only
+ '(menu-bar-lines . 0) ; Emacs only
+ '(visibility . nil) ; doesn't work for XEmacs yet
+ ;; don't lower and auto-raise
+ '(auto-lower . nil)
+ '(auto-raise . t)
+ ;; this blocks queries from window manager as to where to put
+ ;; ediff's control frame. we put the frame outside the display,
+ ;; so the initial frame won't jump all over the screen
+ (cons 'top (if (fboundp 'ediff-display-pixel-height)
+ (1+ (ediff-display-pixel-height))
+ 3000))
+ (cons 'left (if (fboundp 'ediff-display-pixel-width)
+ (1+ (ediff-display-pixel-width))
+ 3000))
+ )
"Frame parameters for displaying Ediff Control Panel.
Do not specify width and height here. These are computed automatically.")
@@ -266,7 +265,7 @@ into icons, regardless of the window manager.")
(defun ediff-setup-windows-plain-merge (buf-A buf-B buf-C control-buffer)
;; skip dedicated and unsplittable frames
(ediff-destroy-control-frame control-buffer)
- (let ((window-min-height 2)
+ (let ((window-min-height 1)
split-window-function
merge-window-share merge-window-lines
wind-A wind-B wind-C)
@@ -319,7 +318,7 @@ into icons, regardless of the window manager.")
(defun ediff-setup-windows-plain-compare (buf-A buf-B buf-C control-buffer)
;; skip dedicated and unsplittable frames
(ediff-destroy-control-frame control-buffer)
- (let ((window-min-height 2)
+ (let ((window-min-height 1)
split-window-function wind-width-or-height
three-way-comparison
wind-A-start wind-B-start wind-A wind-B wind-C)
@@ -386,7 +385,7 @@ into icons, regardless of the window manager.")
))
-;; dispatch the appropriate window setup function
+;; dispatch an appropriate window setup function
(defun ediff-setup-windows-multiframe (buf-A buf-B buf-C control-buf)
(ediff-eval-in-buffer control-buf
(setq ediff-multiframe t))
@@ -408,7 +407,7 @@ into icons, regardless of the window manager.")
;; Unsplittable frames are taken care of later.
(ediff-skip-unsuitable-frames 'ok-unsplittable)
- (let* ((window-min-height 2)
+ (let* ((window-min-height 1)
(wind-A (ediff-get-visible-buffer-window buf-A))
(wind-B (ediff-get-visible-buffer-window buf-B))
(wind-C (ediff-get-visible-buffer-window buf-C))
@@ -486,7 +485,7 @@ into icons, regardless of the window manager.")
(if use-same-frame
(let ((curr-frame (selected-frame))
- (window-min-height 2))
+ (window-min-height 1))
;; avoid dedicated and non-splittable windows
(ediff-skip-unsuitable-frames)
(or (eq curr-frame (selected-frame))
@@ -583,7 +582,7 @@ into icons, regardless of the window manager.")
;; Unsplittable frames are taken care of later.
(ediff-skip-unsuitable-frames 'ok-unsplittable)
- (let* ((window-min-height 2)
+ (let* ((window-min-height 1)
(wind-A (ediff-get-visible-buffer-window buf-A))
(wind-B (ediff-get-visible-buffer-window buf-B))
(wind-C (ediff-get-visible-buffer-window buf-C))
@@ -754,6 +753,8 @@ into icons, regardless of the window manager.")
(or
(window-dedicated-p (selected-window))
(ediff-frame-iconified-p (selected-frame))
+ (< (frame-height (selected-frame))
+ (* 3 window-min-height))
(if ok-unsplittable
nil
(ediff-frame-unsplittable-p (selected-frame)))))
@@ -769,7 +770,7 @@ into icons, regardless of the window manager.")
;; Prepare or refresh control frame
(defun ediff-setup-control-frame (ctl-buffer designated-minibuffer-frame)
- (let ((window-min-height 2)
+ (let ((window-min-height 1)
ctl-frame-iconified-p dont-iconify-ctl-frame deiconify-ctl-frame
ctl-frame old-ctl-frame lines user-grabbed-mouse
fheight fwidth adjusted-parameters)
@@ -780,20 +781,11 @@ into icons, regardless of the window manager.")
(run-hooks 'ediff-before-setup-control-frame-hook))
(setq old-ctl-frame (ediff-eval-in-buffer ctl-buffer ediff-control-frame))
- ;; Delete the old ctl frame and get a new ctl frame.
- ;; The old ctl frame is deleted to let emacs reset default minibuffer
- ;; frame or when the ctl frame needs to be moved.
- ;; The old frame isn't reused, since ediff-setup-control-frame is called
- ;; very rarely, so the overhead is minimal.
- (if (frame-live-p old-ctl-frame) (delete-frame old-ctl-frame))
- ;;(redraw-display)
- ;; new ctl frame should be created while ctl-buff is current, so that
- ;; the local default-minibuffer-frame will be consulted and
- ;; that ediff-control-frame-parameters will have the right value.
(ediff-eval-in-buffer ctl-buffer
- (let ((default-minibuffer-frame designated-minibuffer-frame))
- (setq ctl-frame (make-frame ediff-control-frame-parameters)
- ediff-control-frame ctl-frame)))
+ (setq ctl-frame (if (frame-live-p old-ctl-frame)
+ old-ctl-frame
+ (make-frame ediff-control-frame-parameters))
+ ediff-control-frame ctl-frame))
(setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame))
(select-frame ctl-frame)
@@ -817,19 +809,21 @@ into icons, regardless of the window manager.")
dont-iconify-ctl-frame))
;; 1 more line for the modeline
- (setq lines (if ediff-xemacs-p
- (+ 2 (count-lines (point-min) (point-max)))
- (1+ (count-lines (point-min) (point-max))))
+ (setq lines (1+ (count-lines (point-min) (point-max)))
fheight lines
fwidth (+ (ediff-help-message-line-length) 2)
adjusted-parameters (append (list
'(visibility . t)
+ ;; possibly change surrogate minibuffer
+ (cons 'minibuffer
+ (minibuffer-window
+ designated-minibuffer-frame))
(cons 'width fwidth)
(cons 'height fheight))
(funcall
ediff-control-frame-position-function
ctl-buffer fwidth fheight)))
- (if ediff-prefer-long-help-message
+ (if ediff-use-long-help-message
(setq adjusted-parameters
(cons '(auto-raise . nil) adjusted-parameters)))
@@ -846,11 +840,12 @@ into icons, regardless of the window manager.")
;;(sit-for 0)
))
- ;; Under OS/2 (emx) we have to call modify frame parameters twice, in
- ;; order to make sure that at least once we do it for non-iconified
- ;; frame. If appears that in the OS/2 port of Emacs, one can't modify
- ;; frame parameters of iconified frames.
- (if (eq system-type 'emx)
+ ;; Under OS/2 (emx) we have to call modify frame parameters twice, in order
+ ;; to make sure that at least once we do it for non-iconified frame. If
+ ;; appears that in the OS/2 port of Emacs, one can't modify frame
+ ;; parameters of iconified frames. As a precaution, we do likewise for
+ ;; windows-nt.
+ (if (memq system-type '(emx windows-nt windows-95))
(modify-frame-parameters ctl-frame adjusted-parameters))
(goto-char (point-min))
@@ -876,15 +871,18 @@ into icons, regardless of the window manager.")
;; resynch so the cursor will move to control frame
;; per RMS suggestion
- (let ((count 7))
- (sit-for .1)
- (while (and (not (frame-visible-p ctl-frame)) (> count 0))
- (setq count (1- count))
- (sit-for .3)))
+ (if (ediff-window-display-p)
+ (let ((count 7))
+ (sit-for .1)
+ (while (and (not (frame-visible-p ctl-frame)) (> count 0))
+ (setq count (1- count))
+ (sit-for .3))))
(or (ediff-frame-iconified-p ctl-frame)
;; don't warp the mouse, unless ediff-grab-mouse = t
- (ediff-reset-mouse ctl-frame (not (eq ediff-grab-mouse t))))
+ (ediff-reset-mouse ctl-frame
+ (or (eq this-command 'ediff-quit)
+ (not (eq ediff-grab-mouse t)))))
(if ediff-xemacs-p
(ediff-eval-in-buffer ctl-buffer
@@ -932,7 +930,7 @@ into icons, regardless of the window manager.")
(- frame-A-top upward-adjustment ediff-control-frame-upward-shift)
ctl-frame-left
(+ frame-A-left
- (if ediff-prefer-long-help-message
+ (if ediff-use-long-help-message
(* (ediff-frame-char-width ctl-frame)
(+ ediff-wide-control-frame-rightward-shift
horizontal-adjustment))
@@ -941,9 +939,6 @@ into icons, regardless of the window manager.")
(+ ctl-frame-width
ediff-narrow-control-frame-leftward-shift
horizontal-adjustment))))))
- ;; keep ctl frame within the visible bounds
- (setq ctl-frame-top (max ctl-frame-top 1)
- ctl-frame-left (max ctl-frame-left 1))
(setq ctl-frame-top
(min ctl-frame-top
(- (ediff-display-pixel-height)
@@ -953,6 +948,9 @@ into icons, regardless of the window manager.")
(min ctl-frame-left
(- (ediff-display-pixel-width)
(* ctl-frame-width (ediff-frame-char-width ctl-frame)))))
+ ;; keep ctl frame within the visible bounds
+ (setq ctl-frame-top (max ctl-frame-top 1)
+ ctl-frame-left (max ctl-frame-left 1))
(list (cons 'top ctl-frame-top)
(cons 'left ctl-frame-left))
@@ -960,7 +958,7 @@ into icons, regardless of the window manager.")
(defun ediff-xemacs-select-frame-hook ()
(if (and (equal (selected-frame) ediff-control-frame)
- (not ediff-prefer-long-help-message))
+ (not ediff-use-long-help-message))
(raise-frame ediff-control-frame)))
(defun ediff-make-wide-display ()
diff --git a/lisp/ediff.el b/lisp/ediff.el
index eac0157d79..d629a3e249 100644
--- a/lisp/ediff.el
+++ b/lisp/ediff.el
@@ -6,8 +6,8 @@
;; Created: February 2, 1994
;; Keywords: comparing, merging, patching, version control.
-(defconst ediff-version "2.47" "The current version of Ediff")
-(defconst ediff-date "October 11, 1995" "Date of last update")
+(defconst ediff-version "2.54" "The current version of Ediff")
+(defconst ediff-date "February 14, 1996" "Date of last update")
;; This file is part of GNU Emacs.
@@ -70,6 +70,8 @@
;; particular, it can do patching, and 2-way and 3-way file comparison,
;; merging, and directory operations.
+
+
;;; Bugs:
;; 1. The undo command doesn't restore deleted regions well. That is, if
@@ -93,6 +95,7 @@
;; buffer used by Ediff) or you can execute them interactively, at any time
;; and on any buffer.
+
;;; Acknowledgements:
;; Ediff was inspired by Dale R. Worley's <[email protected]> emerge.el.
@@ -128,7 +131,7 @@
;;;###autoload
(defun ediff-patch-file (source-filename &optional startup-hooks job-name)
- "Run Ediff by patching FILE-TP-PATCH."
+ "Run Ediff by patching SOURCE-FILENAME."
;; This now returns the control buffer
(interactive
(list (ediff-read-file-name
@@ -160,12 +163,15 @@
;; file for the purpose of patching.
(true-source-filename source-filename)
(target-filename source-filename)
- target-buf buf-to-patch file-name-magic-p ctl-buf)
+ target-buf buf-to-patch file-name-magic-p ctl-buf backup-style)
;; if the user didn't specify a backup extension, use
;; ediff-backup-extension
(if (string= backup-extension "")
(setq backup-extension ediff-backup-extension))
+ (if (string-match "-V" ediff-patch-options)
+ (error
+ "Ediff doesn't take the -V option in `ediff-patch-options'--sorry"))
;; Make a temp file, if source-filename has a magic file handler (or if
;; it is handled via auto-mode-alist and similar magic).
@@ -188,7 +194,9 @@
(ediff-eval-in-buffer ediff-patch-diagnostics
(message "Applying patch ... ")
- ;;(sit-for 0)
+ ;; fix environment for gnu patch, so it won't make numbered extensions
+ (setq backup-style (getenv "VERSION_CONTROL"))
+ (setenv "VERSION_CONTROL" nil)
;; always pass patch the -f option, so it won't ask any questions
(shell-command-on-region
(point-min) (point-max)
@@ -196,7 +204,9 @@
ediff-patch-program ediff-patch-options
backup-extension
(expand-file-name true-source-filename))
- t))
+ t)
+ ;; restore environment for gnu patch
+ (setenv "VERSION_CONTROL" backup-style))
;;(message "Applying patch ... done")(sit-for 0)
(switch-to-buffer ediff-patch-diagnostics)
(sit-for 0) ; synchronize - let the user see diagnostics
@@ -251,8 +261,8 @@
(buffer-name ediff-patch-diagnostics))
ctl-buf))
+;; Used as a startup hook to set `_orig' patch file read-only.
(defun ediff-set-read-only-in-buf-A ()
- "Used as a startup hook to set `_orig' patch file read-only."
(ediff-eval-in-buffer ediff-buffer-A
(toggle-read-only 1)))
@@ -363,15 +373,16 @@
(defalias 'ediff3 'ediff-files3)
+;; Visit FILE and arrange its buffer to Ediff's liking.
+;; FILE is actually a variable symbol that must contain a true file name.
+;; BUFFER-NAME is a variable symbol, which will get the buffer object into
+;; which FILE is read.
+;; LAST-DIR is the directory variable symbol where FILE's
+;; directory name should be returned. HOOKS-VAR is a variable symbol that will
+;; be assigned the hook to be executed after `ediff-startup' is finished.
+;; `ediff-find-file' arranges that the temp files it might create will be
+;; deleted.
(defun ediff-find-file (file-var buffer-name &optional last-dir hooks-var)
- "Visit FILE and arrange its buffer to Ediff's liking.
-FILE is actually a variable symbol that must contain a true file name.
-BUFFER-NAME is a variable symbol, which will get the buffer object into which
-FILE is read. LAST-DIR is the directory variable symbol where FILE's
-directory name should be returned. HOOKS is a variable symbol that will be
-assigned the hook to be executed after `ediff-startup' is finished.
-`ediff-find-file' arranges that the temp files it might create will be
-deleted."
(let* ((file (symbol-value file-var))
(file-magic (find-file-name-handler file 'find-file-noselect))
(temp-file-name-prefix (file-name-nondirectory file)))
@@ -380,7 +391,7 @@ deleted."
((file-directory-p file)
(error "File `%s' is a directory" file)))
- ;; some of the command, below, require full file name
+ ;; some of the commands, below, require full file name
(setq file (expand-file-name file))
;; Record the directory of the file
@@ -509,8 +520,8 @@ deleted."
(if (stringp buf-C-file-name)
(setq buf-C-file-name (file-name-nondirectory buf-C-file-name)))
- (setq file-A (ediff-make-temp-file buf-A buf-A-file-name))
- (setq file-B (ediff-make-temp-file buf-B buf-B-file-name))
+ (setq file-A (ediff-make-temp-file buf-A buf-A-file-name)
+ file-B (ediff-make-temp-file buf-B buf-B-file-name))
(if buf-C-is-alive
(setq file-C (ediff-make-temp-file buf-C buf-C-file-name)))
@@ -1148,9 +1159,8 @@ Continue anyway? (y/n) "))
The file is the optional FILE argument or the file visited by the current
buffer."
(interactive)
- (ediff-load-version-control)
(if (stringp file) (find-file file))
- (let (rev1 rev2 buf1 buf2)
+ (let (rev1 rev2)
(setq rev1
(read-string
(format
@@ -1163,38 +1173,11 @@ buffer."
"Version 2 to merge (default: %s): "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
- (cond ((eq ediff-version-control-package 'vc)
- (save-excursion
- (vc-version-other-window rev1)
- (setq buf1 (current-buffer)))
- (save-excursion
- (or (string= rev2 "")
- (vc-version-other-window rev2))
- (setq buf2 (current-buffer)))
- (setq startup-hooks
- (cons
- (` (lambda ()
- (delete-file (, (buffer-file-name buf1)))
- (or (, (string= rev2 ""))
- (delete-file (, (buffer-file-name buf2))))))
- startup-hooks)))
- ((eq ediff-version-control-package 'rcs)
- (setq buf1 (rcs-ediff-view-revision rev1)
- buf2 (if (string= rev2 "")
- (current-buffer)
- (rcs-ediff-view-revision rev2))))
- ((eq ediff-version-control-package 'generic-sc)
- (save-excursion
- (if (string= rev1 "")
- (setq rev1 (generic-sc-get-latest-rev)))
- (sc-visit-previous-revision rev1)
- (setq buf1 (current-buffer)))
- (save-excursion
- (or (string= rev2 "")
- (sc-visit-previous-revision rev2))
- (setq buf2 (current-buffer))))
- ) ; cond
- (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)))
+ (ediff-load-version-control)
+ ;; ancestor-revision=nil
+ (funcall
+ (intern (format "%S-ediff-merge-internal" ediff-version-control-package))
+ rev1 rev2 nil startup-hooks)))
;;;###autoload
@@ -1203,9 +1186,8 @@ buffer."
The file is the the optional FILE argument or the file visited by the current
buffer."
(interactive)
- (ediff-load-version-control)
(if (stringp file) (find-file file))
- (let (rev1 rev2 ancestor-rev buf1 buf2 ancestor-buf)
+ (let (rev1 rev2 ancestor-rev)
(setq rev1
(read-string
(format
@@ -1224,53 +1206,22 @@ buffer."
"Ancestor version (default: %s): "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
- (cond ((eq ediff-version-control-package 'vc)
- (save-excursion
- (vc-version-other-window rev1)
- (setq buf1 (current-buffer)))
- (save-excursion
- (or (string= rev2 "")
- (vc-version-other-window rev2))
- (setq buf2 (current-buffer)))
- (save-excursion
- (or (string= ancestor-rev "")
- (vc-version-other-window ancestor-rev))
- (setq ancestor-buf (current-buffer)))
- (setq startup-hooks
- (cons
- (` (lambda ()
- (delete-file (, (buffer-file-name buf1)))
- (or (, (string= rev2 ""))
- (delete-file (, (buffer-file-name buf2))))
- (or (, (string= ancestor-rev ""))
- (delete-file (, (buffer-file-name ancestor-buf))))))
- startup-hooks)))
- ((eq ediff-version-control-package 'rcs)
- (setq buf1 (rcs-ediff-view-revision rev1)
- buf2 (if (string= rev2 "")
- (current-buffer)
- (rcs-ediff-view-revision rev2))
- ancestor-buf (if (string= ancestor-rev "")
- (current-buffer)
- (rcs-ediff-view-revision ancestor-rev))))
- ((eq ediff-version-control-package 'generic-sc)
- (save-excursion
- (if (string= rev1 "")
- (setq rev1 (generic-sc-get-latest-rev)))
- (sc-visit-previous-revision rev1)
- (setq buf1 (current-buffer)))
- (save-excursion
- (or (string= rev2 "")
- (sc-visit-previous-revision rev2))
- (setq buf2 (current-buffer)))
- (save-excursion
- (or (string= ancestor-rev "")
- (sc-visit-previous-revision ancestor-rev))
- (setq ancestor-buf (current-buffer))))
- ) ; cond
- (ediff-merge-buffers-with-ancestor
- buf1 buf2 ancestor-buf
- startup-hooks 'ediff-merge-revisions-with-ancestor)))
+ (ediff-load-version-control)
+ (funcall
+ (intern (format "%S-ediff-merge-internal" ediff-version-control-package))
+ rev1 rev2 ancestor-rev startup-hooks)))
+
+;;;###autoload
+(defun run-ediff-from-cvs-buffer (pos)
+ "Run Ediff-merge on appropriate revisions of the selected file.
+First run after `M-x cvs-update'. Then place the cursor on a lide describing a
+file and then run `run-ediff-from-cvs-buffer'."
+ (interactive "d")
+ (ediff-load-version-control)
+ (let ((tin (tin-locate cvs-cookie-handle pos)))
+ (if tin
+ (cvs-run-ediff-on-file-descriptor tin)
+ (error "There is no file to merge"))))
;;; Apply patch
@@ -1369,6 +1320,7 @@ buffer. Use `vc.el' or `rcs.el' depending on `ediff-version-control-package'."
;; Test if version control package is loaded and load if not
;; Is SILENT is non-nil, don't report error if package is not found.
(defun ediff-load-version-control (&optional silent)
+ (require 'ediff-vers)
(or (featurep ediff-version-control-package)
(if (locate-library (symbol-name ediff-version-control-package))
(progn
@@ -1378,105 +1330,6 @@ buffer. Use `vc.el' or `rcs.el' depending on `ediff-version-control-package'."
(error "Version control package %S.el not found. Use vc.el instead"
ediff-version-control-package)))))
-
-(defun vc-ediff-internal (rev1 rev2 &optional startup-hooks)
- "Run Ediff on versions of the current buffer.
-If REV2 is \"\" then compare current buffer with REV1.
-If the current buffer is named `F', the version is named `F.~REV~'.
-If `F.~REV~' already exists, it is used instead of being re-created."
- (let (file1 file2 rev1buf rev2buf)
- (save-excursion
- (vc-version-other-window rev1)
- (setq rev1buf (current-buffer)
- file1 (buffer-file-name)))
- (save-excursion
- (or (string= rev2 "") ; use current buffer
- (vc-version-other-window rev2))
- (setq rev2buf (current-buffer)
- file2 (buffer-file-name)))
- (setq startup-hooks
- (cons (` (lambda ()
- (delete-file (, file1))
- (or (, (string= rev2 "")) (delete-file (, file2)))
- ))
- startup-hooks))
- (ediff-buffers
- rev1buf rev2buf
- startup-hooks
- 'ediff-revision)))
-
-(defun rcs-ediff-view-revision (&optional rev)
- "View previous RCS revision of current file.
-With prefix argument, prompts for a revision name."
- (interactive (list (if current-prefix-arg
- (read-string "Revision: "))))
- (let* ((filename (buffer-file-name (current-buffer)))
- (switches (append '("-p")
- (if rev (list (concat "-r" rev)) nil)))
- (buff (concat (file-name-nondirectory filename) ".~" rev "~")))
- (message "Working ...")
- (setq filename (expand-file-name filename))
- (with-output-to-temp-buffer buff
- (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
- (delete-windows-on output-buffer)
- (save-excursion
- (set-buffer output-buffer)
- (apply 'call-process "co" nil t nil
- ;; -q: quiet (no diagnostics)
- (append switches rcs-default-co-switches
- (list "-q" filename)))))
- (message "")
- buff)))
-
-(defun ediff-rcs-get-output-buffer (file name)
- ;; Get a buffer for RCS output for FILE, make it writable and clean it up.
- ;; Optional NAME is name to use instead of `*RCS-output*'.
- ;; This is a modified version from rcs.el v1.1. I use it here to make
- ;; Ediff immune to changes in rcs.el
- (let* ((default-major-mode 'fundamental-mode) ; no frills!
- (buf (get-buffer-create name)))
- (save-excursion
- (set-buffer buf)
- (setq buffer-read-only nil
- default-directory (file-name-directory (expand-file-name file)))
- (erase-buffer))
- buf))
-
-(defun rcs-ediff-internal (rev1 rev2 &optional startup-hooks)
- "Run Ediff on versions of the current buffer.
-If REV2 is \"\" then use current buffer."
- (let ((rev2buf (if (string= rev2 "")
- (current-buffer)
- (rcs-ediff-view-revision rev2)))
- (rev1buf (rcs-ediff-view-revision rev1)))
-
- ;; rcs.el doesn't create temp version files, so we don't have to delete
- ;; anything in startup hooks to ediff-buffers
- (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)
- ))
-
-(defun generic-sc-get-latest-rev ()
- (cond ((eq sc-mode 'CCASE)
- (eval "main/LATEST"))
- (t (eval "")))
- )
-
-(defun generic-sc-ediff-internal (rev1 rev2 &optional startup-hooks)
- "Run Ediff on versions of the current buffer.
-If REV2 is \"\" then compare current buffer with REV1.
-If the current buffer is named `F', the version is named `F.~REV~'.
-If `F.~REV~' already exists, it is used instead of being re-created."
- (let (rev1buf rev2buf)
- (save-excursion
- (if (or (not rev1) (string= rev1 ""))
- (setq rev1 (generic-sc-get-latest-rev)))
- (sc-visit-previous-revision rev1)
- (setq rev1buf (current-buffer)))
- (save-excursion
- (or (string= rev2 "") ; use current buffer
- (sc-visit-previous-revision rev2))
- (setq rev2buf (current-buffer)))
- (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)))
;;;###autoload
(defun ediff-version ()
@@ -1488,6 +1341,40 @@ When called interactively, displays the version."
(format "Ediff %s of %s" ediff-version ediff-date)))
+;;;###autoload
+(defun ediff-documentation ()
+ "Jump to Ediff's Info file."
+ (interactive)
+ (let ((ctl-window ediff-control-window)
+ (ctl-buf ediff-control-buffer))
+
+ (ediff-skip-unsuitable-frames)
+ (condition-case nil
+ (progn
+ (pop-to-buffer (get-buffer-create "*info*"))
+ (info (if ediff-xemacs-p "ediff.info" "ediff"))
+ (message "Type `i' to search for a specific topic"))
+ (error (beep 1)
+ (with-output-to-temp-buffer " *ediff-info*"
+ (princ (format "
+The Info file for Ediff does not seem to be installed.
+
+This file is part of the distribution of %sEmacs.
+Please contact your system administrator. "
+ (if ediff-xemacs-p "X" ""))))
+ (if (window-live-p ctl-window)
+ (progn
+ (select-window ctl-window)
+ (set-window-buffer ctl-window ctl-buf)))))))
+
+
+
+
+;;; Local Variables:
+;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
+;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
+;;; End:
+
(provide 'ediff)
(require 'ediff-util)
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index f8ff8c9464..b0d671f8df 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -1992,4 +1992,4 @@ Please contact your system administrator. "
(provide 'viper-ex)
-;;; viper-ex.el ends here \ No newline at end of file
+;;; viper-ex.el ends here