1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-27 10:54:40 +00:00
emacs/lisp/ediff.el

1541 lines
53 KiB
EmacsLisp
Raw Normal View History

1995-03-16 22:31:54 +00:00
;;; ediff.el --- a comprehensive visual interface to diff & patch
1996-01-14 07:34:30 +00:00
;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03, 05 Free Software Foundation, Inc.
1994-05-02 05:16:59 +00:00
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
1994-05-02 05:16:59 +00:00
;; Created: February 2, 1994
;; Keywords: comparing, merging, patching, tools, unix
1994-05-02 05:16:59 +00:00
(defconst ediff-version "2.80" "The current version of Ediff")
(defconst ediff-date "June 3, 2005" "Date of last update")
1996-06-22 01:54:34 +00:00
1994-05-02 05:16:59 +00:00
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
1996-01-14 07:34:30 +00:00
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
1994-05-02 05:16:59 +00:00
;;; Commentary:
1995-03-16 22:31:54 +00:00
;; Never read that diff output again!
1996-06-22 01:54:34 +00:00
;; Apply patch interactively!
1995-03-16 22:31:54 +00:00
;; Merge with ease!
1994-05-02 05:16:59 +00:00
;; This package provides a convenient way of simultaneous browsing through
;; the differences between a pair (or a triple) of files or buffers. The
1995-03-16 22:31:54 +00:00
;; files being compared, file-A, file-B, and file-C (if applicable) are
;; shown in separate windows (side by side, one above the another, or in
;; separate frames), and the differences are highlighted as you step
;; through them. You can also copy difference regions from one buffer to
;; another (and recover old differences if you change your mind).
1994-05-02 05:16:59 +00:00
;; Ediff also supports merging operations on files and buffers, including
1999-11-01 07:16:15 +00:00
;; merging using ancestor versions. Both comparison and merging operations can
;; be performed on directories, i.e., by pairwise comparison of files in those
;; directories.
1994-05-02 05:16:59 +00:00
;; In addition, Ediff can apply a patch to a file and then let you step
;; though both files, the patched and the original one, simultaneously,
1994-05-02 05:16:59 +00:00
;; difference-by-difference. You can even apply a patch right out of a
;; mail buffer, i.e., patches received by mail don't even have to be saved.
;; Since Ediff lets you copy differences between buffers, you can, in
;; effect, apply patches selectively (i.e., you can copy a difference
1995-03-16 22:31:54 +00:00
;; region from file_orig to file, thereby undoing any particular patch that
1994-05-02 05:16:59 +00:00
;; you don't like).
;; Ediff is aware of version control, which lets the user compare
1999-11-01 07:16:15 +00:00
;; files with their older versions. Ediff can also work with remote and
;; compressed files. Details are given below.
1996-06-22 01:54:34 +00:00
;; Finally, Ediff supports directory-level comparison, merging and patching.
;; See the on-line manual for details.
1994-05-02 05:16:59 +00:00
;; This package builds upon the ideas borrowed from emerge.el and several
1999-11-01 07:16:15 +00:00
;; Ediff's functions are adaptations from emerge.el. Much of the functionality
;; Ediff provides is also influenced by emerge.el.
1999-11-01 07:16:15 +00:00
;; The present version of Ediff supersedes Emerge. It provides a superior user
;; interface and has numerous major features not found in Emerge. In
;; particular, it can do patching, and 2-way and 3-way file comparison,
;; merging, and directory operations.
1996-02-16 06:36:35 +00:00
1994-05-02 05:16:59 +00:00
;;; Bugs:
1999-11-01 07:16:15 +00:00
;; 1. The undo command doesn't restore deleted regions well. That is, if
1994-05-02 05:16:59 +00:00
;; you delete all characters in a difference region and then invoke
1995-03-16 22:31:54 +00:00
;; `undo', the reinstated text will most likely be inserted outside of
1994-05-10 00:48:00 +00:00
;; what Ediff thinks is the current difference region. (This problem
1995-03-16 22:31:54 +00:00
;; doesn't seem to exist with XEmacs.)
1994-05-10 00:48:00 +00:00
;;
;; If at any point you feel that difference regions are no longer correct,
;; you can hit '!' to recompute the differences.
;; 2. On a monochrome display, the repertoire of faces with which to
1999-11-01 07:16:15 +00:00
;; highlight fine differences is limited. By default, Ediff is using
;; underlining. However, if the region is already underlined by some other
1994-05-10 00:48:00 +00:00
;; overlays, there is no simple way to temporarily remove that residual
1999-11-01 07:16:15 +00:00
;; underlining. This problem occurs when a buffer is highlighted with
;; hilit19.el or font-lock.el packages. If this residual highlighting gets
;; in the way, you can do the following. Both font-lock.el and hilit19.el
;; provide commands for unhighlighting buffers. You can either place these
;; commands in `ediff-prepare-buffer-hook' (which will unhighlight every
1994-05-10 00:48:00 +00:00
;; buffer used by Ediff) or you can execute them interactively, at any time
;; and on any buffer.
1995-03-16 22:31:54 +00:00
1996-02-16 06:36:35 +00:00
1995-03-16 22:31:54 +00:00
;;; Acknowledgements:
;; Ediff was inspired by Dale R. Worley's <drw@math.mit.edu> emerge.el.
;; Ediff would not have been possible without the help and encouragement of
1999-11-01 07:16:15 +00:00
;; its many users. See Ediff on-line Info for the full list of those who
;; helped. Improved defaults in Ediff file-name reading commands.
1995-03-16 22:31:54 +00:00
;;; Code:
1997-05-31 01:10:39 +00:00
(provide 'ediff)
1997-05-31 01:10:39 +00:00
;; Compiler pacifier
1997-07-17 19:37:07 +00:00
(defvar cvs-cookie-handle)
(defvar ediff-last-dir-patch)
(defvar ediff-patch-default-directory)
1996-09-20 01:10:05 +00:00
(and noninteractive
(eval-when-compile
(load-library "dired")
1997-05-31 01:10:39 +00:00
(load-library "info")
(load "pcl-cvs" 'noerror)))
(eval-when-compile
(let ((load-path (cons (expand-file-name ".") load-path)))
(or (featurep 'ediff-init)
(load "ediff-init.el" nil nil 'nosuffix))
(or (featurep 'ediff-mult)
(load "ediff-mult.el" nil nil 'nosuffix))
(or (featurep 'ediff-ptch)
(load "ediff-ptch.el" nil nil 'nosuffix))
(or (featurep 'ediff-vers)
(load "ediff-vers.el" nil nil 'nosuffix))
))
;; end pacifier
(require 'ediff-init)
(require 'ediff-mult) ; required because of the registry stuff
(defgroup ediff nil
"A comprehensive visual interface to diff & patch"
1997-08-22 03:15:57 +00:00
:tag "Ediff"
1997-05-31 01:10:39 +00:00
:group 'tools)
(defcustom ediff-use-last-dir nil
1997-07-17 19:37:07 +00:00
"*If t, Ediff will use previous directory as default when reading file name."
1997-05-31 01:10:39 +00:00
:type 'boolean
:group 'ediff)
1996-06-22 01:54:34 +00:00
1997-07-17 19:37:07 +00:00
;; Last directory used by an Ediff command for file-A.
(defvar ediff-last-dir-A nil)
;; Last directory used by an Ediff command for file-B.
(defvar ediff-last-dir-B nil)
;; Last directory used by an Ediff command for file-C.
(defvar ediff-last-dir-C nil)
;; Last directory used by an Ediff command for the ancestor file.
(defvar ediff-last-dir-ancestor nil)
;; Last directory used by an Ediff command as the output directory for merge.
(defvar ediff-last-merge-autostore-dir nil)
1994-05-02 05:16:59 +00:00
1996-02-16 06:36:35 +00:00
;; Used as a startup hook to set `_orig' patch file read-only.
(defun ediff-set-read-only-in-buf-A ()
1997-07-31 04:04:23 +00:00
(ediff-with-current-buffer ediff-buffer-A
(toggle-read-only 1)))
1994-05-02 05:16:59 +00:00
;; Return a plausible default for ediff's first file:
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
;; In dired, return the file number FILENO (or 0) in the list
;; (all-selected-files, filename under the cursor), where directories are
;; ignored. Otherwise, return DEFAULT file name, if non-nil. Else,
;; if the buffer is visiting a file, return that file name.
(defun ediff-get-default-file-name (&optional default fileno)
(cond ((eq major-mode 'dired-mode)
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
(let ((current (dired-get-filename nil 'no-error))
(marked (condition-case nil
(dired-get-marked-files 'no-dir)
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(error nil)))
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
aux-list choices result)
(or (integerp fileno) (setq fileno 0))
(if (stringp default)
(setq aux-list (cons default aux-list)))
(if (and (stringp current) (not (file-directory-p current)))
(setq aux-list (cons current aux-list)))
(setq choices (nconc marked aux-list))
(setq result (elt choices fileno))
(or result
default)))
((stringp default) default)
((buffer-file-name (current-buffer))
(file-name-nondirectory (buffer-file-name (current-buffer))))
))
1995-03-16 22:31:54 +00:00
;;; Compare files/buffers
1994-05-02 05:16:59 +00:00
;;;###autoload
(defun ediff-files (file-A file-B &optional startup-hooks)
1995-03-16 22:31:54 +00:00
"Run Ediff on a pair of files, FILE-A and FILE-B."
1994-05-02 05:16:59 +00:00
(interactive
1995-03-16 22:31:54 +00:00
(let ((dir-A (if ediff-use-last-dir
ediff-last-dir-A
default-directory))
dir-B f)
(list (setq f (ediff-read-file-name
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
"File A to compare"
2003-02-04 11:26:42 +00:00
dir-A
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(ediff-get-default-file-name)
'no-dirs))
2003-02-04 11:26:42 +00:00
(ediff-read-file-name "File B to compare"
1995-03-16 22:31:54 +00:00
(setq dir-B
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-B
1995-03-16 22:31:54 +00:00
(file-name-directory f)))
(progn
(setq file-name-history
(cons (ediff-abbreviate-file-name
1995-03-16 22:31:54 +00:00
(expand-file-name
(file-name-nondirectory f)
dir-B))
file-name-history))
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
(ediff-get-default-file-name f 1)))
1995-03-16 22:31:54 +00:00
)))
2003-02-04 11:26:42 +00:00
(ediff-files-internal file-A
1995-03-16 22:31:54 +00:00
(if (file-directory-p file-B)
(expand-file-name
(file-name-nondirectory file-A) file-B)
file-B)
nil ; file-C
startup-hooks
'ediff-files))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defun ediff-files3 (file-A file-B file-C &optional startup-hooks)
"Run Ediff on three files, FILE-A, FILE-B, and FILE-C."
(interactive
(let ((dir-A (if ediff-use-last-dir
ediff-last-dir-A
default-directory))
dir-B dir-C f ff)
(list (setq f (ediff-read-file-name
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
"File A to compare"
dir-A
(ediff-get-default-file-name)
'no-dirs))
2003-02-04 11:26:42 +00:00
(setq ff (ediff-read-file-name "File B to compare"
1995-03-16 22:31:54 +00:00
(setq dir-B
(if ediff-use-last-dir
ediff-last-dir-B
(file-name-directory f)))
(progn
(setq file-name-history
(cons
(ediff-abbreviate-file-name
1995-03-16 22:31:54 +00:00
(expand-file-name
(file-name-nondirectory f)
dir-B))
file-name-history))
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
(ediff-get-default-file-name f 1))))
2003-02-04 11:26:42 +00:00
(ediff-read-file-name "File C to compare"
1995-03-16 22:31:54 +00:00
(setq dir-C (if ediff-use-last-dir
ediff-last-dir-C
(file-name-directory ff)))
(progn
(setq file-name-history
(cons (ediff-abbreviate-file-name
1995-03-16 22:31:54 +00:00
(expand-file-name
(file-name-nondirectory ff)
dir-C))
file-name-history))
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
(ediff-get-default-file-name ff 2)))
1994-05-02 05:16:59 +00:00
)))
2003-02-04 11:26:42 +00:00
(ediff-files-internal file-A
1994-05-10 00:48:00 +00:00
(if (file-directory-p file-B)
(expand-file-name
(file-name-nondirectory file-A) file-B)
file-B)
1995-03-16 22:31:54 +00:00
(if (file-directory-p file-C)
(expand-file-name
(file-name-nondirectory file-A) file-C)
file-C)
startup-hooks
'ediff-files3))
1994-05-02 05:16:59 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defalias 'ediff3 'ediff-files3)
1994-05-02 05:16:59 +00:00
2003-02-04 11:26:42 +00:00
;; Visit FILE and arrange its buffer to Ediff's liking.
1996-02-16 06:36:35 +00:00
;; 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
1999-11-01 07:16:15 +00:00
;; directory name should be returned. HOOKS-VAR is a variable symbol that will
1996-02-16 06:36:35 +00:00
;; 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.
1995-03-16 22:31:54 +00:00
(defun ediff-find-file (file-var buffer-name &optional last-dir hooks-var)
(let* ((file (symbol-value file-var))
1997-09-06 04:16:05 +00:00
(file-magic (ediff-filename-magic-p file))
1995-03-16 22:31:54 +00:00
(temp-file-name-prefix (file-name-nondirectory file)))
(cond ((not (file-readable-p file))
(error "File `%s' does not exist or is not readable" file))
((file-directory-p file)
(error "File `%s' is a directory" file)))
2003-02-04 11:26:42 +00:00
1996-02-16 06:36:35 +00:00
;; some of the commands, below, require full file name
1995-03-16 22:31:54 +00:00
(setq file (expand-file-name file))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;; Record the directory of the file
(if last-dir
(set last-dir (expand-file-name (file-name-directory file))))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;; Setup the buffer
(set buffer-name (find-file-noselect file))
2003-02-04 11:26:42 +00:00
1997-07-31 04:04:23 +00:00
(ediff-with-current-buffer (symbol-value buffer-name)
1995-03-16 22:31:54 +00:00
(widen) ; Make sure the entire file is seen
1997-05-31 01:10:39 +00:00
(cond (file-magic ; file has a handler, such as jka-compr-handler or
;;; ange-ftp-hook-function--arrange for temp file
1995-03-16 22:31:54 +00:00
(ediff-verify-file-buffer 'magic)
(setq file
(ediff-make-temp-file
(current-buffer) temp-file-name-prefix))
1999-11-25 04:34:23 +00:00
(set hooks-var (cons `(lambda () (delete-file ,file))
1995-03-16 22:31:54 +00:00
(symbol-value hooks-var))))
;; file processed via auto-mode-alist, a la uncompress.el
((not (equal (file-truename file)
(file-truename (buffer-file-name))))
(setq file
(ediff-make-temp-file
(current-buffer) temp-file-name-prefix))
1999-11-25 04:34:23 +00:00
(set hooks-var (cons `(lambda () (delete-file ,file))
1995-03-16 22:31:54 +00:00
(symbol-value hooks-var))))
(t ;; plain file---just check that the file matches the buffer
(ediff-verify-file-buffer))))
(set file-var file)))
1997-11-01 01:46:51 +00:00
;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer
(defun ediff-files-internal (file-A file-B file-C startup-hooks job-name
&optional merge-buffer-file)
1995-03-16 22:31:54 +00:00
(let (buf-A buf-B buf-C)
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(if (string= file-A file-B)
(error "Files A and B are the same"))
(if (stringp file-C)
(or (and (string= file-A file-C) (error "Files A and C are the same"))
(and (string= file-B file-C) (error "Files B and C are the same"))))
(message "Reading file %s ... " file-A)
;;(sit-for 0)
1995-03-16 22:31:54 +00:00
(ediff-find-file 'file-A 'buf-A 'ediff-last-dir-A 'startup-hooks)
(message "Reading file %s ... " file-B)
;;(sit-for 0)
1995-03-16 22:31:54 +00:00
(ediff-find-file 'file-B 'buf-B 'ediff-last-dir-B 'startup-hooks)
(if (stringp file-C)
1995-03-16 22:31:54 +00:00
(progn
(message "Reading file %s ... " file-C)
;;(sit-for 0)
1995-03-16 22:31:54 +00:00
(ediff-find-file
'file-C 'buf-C
(if (eq job-name 'ediff-merge-files-with-ancestor)
'ediff-last-dir-ancestor 'ediff-last-dir-C)
'startup-hooks)))
(ediff-setup buf-A file-A
buf-B file-B
buf-C file-C
startup-hooks
1997-11-01 01:46:51 +00:00
(list (cons 'ediff-job-name job-name))
merge-buffer-file)))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defalias 'ediff 'ediff-files)
1994-05-02 05:16:59 +00:00
;;;###autoload
(defun ediff-backup (file)
"Run Ediff on FILE and its backup file.
Uses the latest backup, if there are several numerical backups.
If this file is a backup, `ediff' it with its original."
(interactive (list (read-file-name "Ediff (file with backup): ")))
;; The code is taken from `diff-backup'.
(require 'diff)
(let (bak ori)
(if (backup-file-name-p file)
(setq bak file
ori (file-name-sans-versions file))
(setq bak (or (diff-latest-backup-file file)
(error "No backup found for %s" file))
ori file))
(ediff-files bak ori)))
1994-05-02 05:16:59 +00:00
;;;###autoload
1995-03-16 22:31:54 +00:00
(defun ediff-buffers (buffer-A buffer-B &optional startup-hooks job-name)
1994-05-02 05:16:59 +00:00
"Run Ediff on a pair of buffers, BUFFER-A and BUFFER-B."
2003-02-04 11:26:42 +00:00
(interactive
1995-03-16 22:31:54 +00:00
(let (bf)
(list (setq bf (read-buffer "Buffer A to compare: "
(ediff-other-buffer "") t))
(read-buffer "Buffer B to compare: "
(progn
;; realign buffers so that two visible bufs will be
;; at the top
(save-window-excursion (other-window 1))
(ediff-other-buffer bf))
t))))
(or job-name (setq job-name 'ediff-buffers))
(ediff-buffers-internal buffer-A buffer-B nil startup-hooks job-name))
1996-06-22 01:54:34 +00:00
;;;###autoload
(defalias 'ebuffers 'ediff-buffers)
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defun ediff-buffers3 (buffer-A buffer-B buffer-C
&optional startup-hooks job-name)
"Run Ediff on three buffers, BUFFER-A, BUFFER-B, and BUFFER-C."
2003-02-04 11:26:42 +00:00
(interactive
1995-03-16 22:31:54 +00:00
(let (bf bff)
(list (setq bf (read-buffer "Buffer A to compare: "
(ediff-other-buffer "") t))
(setq bff (read-buffer "Buffer B to compare: "
(progn
;; realign buffers so that two visible
;; bufs will be at the top
(save-window-excursion (other-window 1))
(ediff-other-buffer bf))
t))
(read-buffer "Buffer C to compare: "
(progn
;; realign buffers so that three visible
;; bufs will be at the top
(save-window-excursion (other-window 1))
(ediff-other-buffer (list bf bff)))
t)
)))
(or job-name (setq job-name 'ediff-buffers3))
(ediff-buffers-internal buffer-A buffer-B buffer-C startup-hooks job-name))
1996-06-22 01:54:34 +00:00
;;;###autoload
(defalias 'ebuffers3 'ediff-buffers3)
1995-03-16 22:31:54 +00:00
2003-02-04 11:26:42 +00:00
1997-11-01 01:46:51 +00:00
;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer
(defun ediff-buffers-internal (buf-A buf-B buf-C startup-hooks job-name
&optional merge-buffer-file)
1995-03-16 22:31:54 +00:00
(let* ((buf-A-file-name (buffer-file-name (get-buffer buf-A)))
(buf-B-file-name (buffer-file-name (get-buffer buf-B)))
(buf-C-is-alive (ediff-buffer-live-p buf-C))
(buf-C-file-name (if buf-C-is-alive
(buffer-file-name (get-buffer buf-B))))
file-A file-B file-C)
(if (not (ediff-buffer-live-p buf-A))
(error "Buffer %S doesn't exist" buf-A))
(if (not (ediff-buffer-live-p buf-B))
(error "Buffer %S doesn't exist" buf-B))
(let ((ediff-job-name job-name))
(if (and ediff-3way-comparison-job
(not buf-C-is-alive))
(error "Buffer %S doesn't exist" buf-C)))
(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)))
(if (stringp buf-C-file-name)
(setq buf-C-file-name (file-name-nondirectory buf-C-file-name)))
2003-02-04 11:26:42 +00:00
1996-02-16 06:36:35 +00:00
(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))
1995-03-16 22:31:54 +00:00
(if buf-C-is-alive
(setq file-C (ediff-make-temp-file buf-C buf-C-file-name)))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(ediff-setup (get-buffer buf-A) file-A
(get-buffer buf-B) file-B
(if buf-C-is-alive (get-buffer buf-C))
file-C
1999-11-25 04:34:23 +00:00
(cons `(lambda ()
(delete-file ,file-A)
(delete-file ,file-B)
(if (stringp ,file-C) (delete-file ,file-C)))
1995-03-16 22:31:54 +00:00
startup-hooks)
(list (cons 'ediff-job-name job-name))
1997-11-01 01:46:51 +00:00
merge-buffer-file)))
;;; Directory and file group operations
;; Get appropriate default name for directory:
;; If ediff-use-last-dir, use ediff-last-dir-A.
;; In dired mode, use the directory that is under the point (if any);
;; otherwise, use default-directory
(defun ediff-get-default-directory-name ()
(cond (ediff-use-last-dir ediff-last-dir-A)
((eq major-mode 'dired-mode)
(let ((f (dired-get-filename nil 'noerror)))
(if (and (stringp f) (file-directory-p f))
f
default-directory)))
(t default-directory)))
;;;###autoload
(defun ediff-directories (dir1 dir2 regexp)
"Run Ediff on a pair of directories, DIR1 and DIR2, comparing files that have
the same name in both. The third argument, REGEXP, is nil or a regular
expression; only file names that match the regexp are considered."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp))
f)
1996-06-22 01:54:34 +00:00
(list (setq f (ediff-read-file-name "Directory A to compare:" dir-A nil))
2003-02-04 11:26:42 +00:00
(ediff-read-file-name "Directory B to compare:"
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-B
(ediff-strip-last-dir f))
nil)
(read-string
(if (stringp default-regexp)
(format "Filter through regular expression (default %s): "
default-regexp)
"Filter through regular expression: ")
nil
'ediff-filtering-regexp-history
(eval ediff-default-filtering-regexp))
)))
(ediff-directories-internal
dir1 dir2 nil regexp 'ediff-files 'ediff-directories
))
;;;###autoload
(defalias 'edirs 'ediff-directories)
;;;###autoload
(defun ediff-directory-revisions (dir1 regexp)
"Run Ediff on a directory, DIR1, comparing its files with their revisions.
The second argument, REGEXP, is a regular expression that filters the file
1999-11-01 07:16:15 +00:00
names. Only the files that are under revision control are taken into account."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp))
)
(list (ediff-read-file-name
1996-06-22 01:54:34 +00:00
"Directory to compare with revision:" dir-A nil)
(read-string
(if (stringp default-regexp)
(format "Filter through regular expression (default %s): "
default-regexp)
"Filter through regular expression: ")
nil
'ediff-filtering-regexp-history
(eval ediff-default-filtering-regexp))
)))
(ediff-directory-revisions-internal
dir1 regexp 'ediff-revision 'ediff-directory-revisions
))
;;;###autoload
(defalias 'edir-revisions 'ediff-directory-revisions)
;;;###autoload
(defun ediff-directories3 (dir1 dir2 dir3 regexp)
"Run Ediff on three directories, DIR1, DIR2, and DIR3, comparing files that
have the same name in all three. The last argument, REGEXP, is nil or a
regular expression; only file names that match the regexp are considered."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp))
f)
1996-06-22 01:54:34 +00:00
(list (setq f (ediff-read-file-name "Directory A to compare:" dir-A nil))
2003-02-04 11:26:42 +00:00
(setq f (ediff-read-file-name "Directory B to compare:"
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-B
(ediff-strip-last-dir f))
nil))
2003-02-04 11:26:42 +00:00
(ediff-read-file-name "Directory C to compare:"
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-C
(ediff-strip-last-dir f))
nil)
(read-string
(if (stringp default-regexp)
(format "Filter through regular expression (default %s): "
default-regexp)
"Filter through regular expression: ")
nil
'ediff-filtering-regexp-history
(eval ediff-default-filtering-regexp))
)))
(ediff-directories-internal
dir1 dir2 dir3 regexp 'ediff-files3 'ediff-directories3
))
;;;###autoload
(defalias 'edirs3 'ediff-directories3)
;;;###autoload
1999-11-01 07:16:15 +00:00
(defun ediff-merge-directories (dir1 dir2 regexp &optional merge-autostore-dir)
"Run Ediff on a pair of directories, DIR1 and DIR2, merging files that have
the same name in both. The third argument, REGEXP, is nil or a regular
expression; only file names that match the regexp are considered."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp))
f)
1996-06-22 01:54:34 +00:00
(list (setq f (ediff-read-file-name "Directory A to merge:" dir-A nil))
2003-02-04 11:26:42 +00:00
(ediff-read-file-name "Directory B to merge:"
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-B
(ediff-strip-last-dir f))
nil)
(read-string
(if (stringp default-regexp)
(format "Filter through regular expression (default %s): "
default-regexp)
"Filter through regular expression: ")
nil
'ediff-filtering-regexp-history
(eval ediff-default-filtering-regexp))
)))
(ediff-directories-internal
dir1 dir2 nil regexp 'ediff-merge-files 'ediff-merge-directories
1999-11-01 07:16:15 +00:00
nil merge-autostore-dir
))
;;;###autoload
(defalias 'edirs-merge 'ediff-merge-directories)
;;;###autoload
1999-11-01 07:16:15 +00:00
(defun ediff-merge-directories-with-ancestor (dir1 dir2 ancestor-dir regexp
&optional
merge-autostore-dir)
1996-06-22 01:54:34 +00:00
"Merge files in directories DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors.
1999-11-01 07:16:15 +00:00
Ediff merges files that have identical names in DIR1, DIR2. If a pair of files
1996-06-22 01:54:34 +00:00
in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge
without ancestor. The fourth argument, REGEXP, is nil or a regular expression;
only file names that match the regexp are considered."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp))
f)
1996-06-22 01:54:34 +00:00
(list (setq f (ediff-read-file-name "Directory A to merge:" dir-A nil))
2003-02-04 11:26:42 +00:00
(setq f (ediff-read-file-name "Directory B to merge:"
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-B
(ediff-strip-last-dir f))
nil))
1996-06-22 01:54:34 +00:00
(ediff-read-file-name "Ancestor directory:"
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-C
(ediff-strip-last-dir f))
nil)
(read-string
(if (stringp default-regexp)
(format "Filter through regular expression (default %s): "
default-regexp)
"Filter through regular expression: ")
nil
'ediff-filtering-regexp-history
(eval ediff-default-filtering-regexp))
)))
(ediff-directories-internal
1996-06-22 01:54:34 +00:00
dir1 dir2 ancestor-dir regexp
'ediff-merge-files-with-ancestor 'ediff-merge-directories-with-ancestor
1999-11-01 07:16:15 +00:00
nil merge-autostore-dir
))
;;;###autoload
1999-11-01 07:16:15 +00:00
(defun ediff-merge-directory-revisions (dir1 regexp
&optional merge-autostore-dir)
"Run Ediff on a directory, DIR1, merging its files with their revisions.
The second argument, REGEXP, is a regular expression that filters the file
1999-11-01 07:16:15 +00:00
names. Only the files that are under revision control are taken into account."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp))
)
(list (ediff-read-file-name
1996-06-22 01:54:34 +00:00
"Directory to merge with revisions:" dir-A nil)
(read-string
(if (stringp default-regexp)
(format "Filter through regular expression (default %s): "
default-regexp)
"Filter through regular expression: ")
nil
'ediff-filtering-regexp-history
(eval ediff-default-filtering-regexp))
)))
(ediff-directory-revisions-internal
dir1 regexp 'ediff-merge-revisions 'ediff-merge-directory-revisions
1999-11-01 07:16:15 +00:00
nil merge-autostore-dir
))
;;;###autoload
(defalias 'edir-merge-revisions 'ediff-merge-directory-revisions)
;;;###autoload
1999-11-01 07:16:15 +00:00
(defun ediff-merge-directory-revisions-with-ancestor (dir1 regexp
&optional
merge-autostore-dir)
"Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors.
The second argument, REGEXP, is a regular expression that filters the file
1999-11-01 07:16:15 +00:00
names. Only the files that are under revision control are taken into account."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp))
)
(list (ediff-read-file-name
1996-06-22 01:54:34 +00:00
"Directory to merge with revisions and ancestors:" dir-A nil)
(read-string
(if (stringp default-regexp)
(format "Filter through regular expression (default %s): "
default-regexp)
"Filter through regular expression: ")
nil
'ediff-filtering-regexp-history
(eval ediff-default-filtering-regexp))
)))
(ediff-directory-revisions-internal
dir1 regexp 'ediff-merge-revisions-with-ancestor
'ediff-merge-directory-revisions-with-ancestor
1999-11-01 07:16:15 +00:00
nil merge-autostore-dir
))
;;;###autoload
(defalias
'edir-merge-revisions-with-ancestor
2003-02-04 11:26:42 +00:00
'ediff-merge-directory-revisions-with-ancestor)
;;;###autoload
(defalias 'edirs-merge-with-ancestor 'ediff-merge-directories-with-ancestor)
;; Run ediff-action (ediff-files, ediff-merge, ediff-merge-with-ancestors)
;; on a pair of directories (three directories, in case of ancestor).
;; The third argument, REGEXP, is nil or a regular expression;
;; only file names that match the regexp are considered.
;; JOBNAME is the symbol indicating the meta-job to be performed.
1999-11-01 07:16:15 +00:00
;; MERGE-AUTOSTORE-DIR is the directory in which to store merged files.
2003-02-04 11:26:42 +00:00
(defun ediff-directories-internal (dir1 dir2 dir3 regexp action jobname
1999-11-01 07:16:15 +00:00
&optional startup-hooks
merge-autostore-dir)
;; ediff-read-file-name is set to attach a previously entered file name if
1999-11-01 07:16:15 +00:00
;; the currently entered file is a directory. This code takes care of that.
(setq dir1 (if (file-directory-p dir1) dir1 (file-name-directory dir1))
dir2 (if (file-directory-p dir2) dir2 (file-name-directory dir2)))
(if (stringp dir3)
(setq dir3 (if (file-directory-p dir3) dir3 (file-name-directory dir3))))
(cond ((string= dir1 dir2)
(error "Directories A and B are the same: %s" dir1))
((and (eq jobname 'ediff-directories3)
(string= dir1 dir3))
(error "Directories A and C are the same: %s" dir1))
((and (eq jobname 'ediff-directories3)
(string= dir2 dir3))
(error "Directories B and C are the same: %s" dir1)))
1999-11-01 07:16:15 +00:00
(if merge-autostore-dir
(or (stringp merge-autostore-dir)
(error "%s: Directory for storing merged files must be a string"
jobname)))
2003-02-04 11:26:42 +00:00
(let (;; dir-diff-struct is of the form (common-list diff-list)
;; It is a structure where ediff-intersect-directories returns
;; commonalities and differences among directories
dir-diff-struct
meta-buf)
1999-11-01 07:16:15 +00:00
(if (and ediff-autostore-merges
(ediff-merge-metajob jobname)
(not merge-autostore-dir))
2003-02-04 11:26:42 +00:00
(setq merge-autostore-dir
1999-11-01 07:16:15 +00:00
(read-file-name "Save merged files in directory: "
(if ediff-use-last-dir
1996-09-20 01:10:05 +00:00
ediff-last-merge-autostore-dir
(ediff-strip-last-dir dir1))
1999-11-01 07:16:15 +00:00
nil
'must-match)))
1996-09-20 01:10:05 +00:00
;; verify we are not merging into an orig directory
1999-11-01 07:16:15 +00:00
(if merge-autostore-dir
1996-09-20 01:10:05 +00:00
(cond ((and (stringp dir1) (string= merge-autostore-dir dir1))
1999-11-01 07:16:15 +00:00
(or (y-or-n-p
"Directory for saving merged files = Directory A. Sure? ")
1996-09-20 01:10:05 +00:00
(error "Directory merge aborted")))
((and (stringp dir2) (string= merge-autostore-dir dir2))
1999-11-01 07:16:15 +00:00
(or (y-or-n-p
"Directory for saving merged files = Directory B. Sure? ")
1996-09-20 01:10:05 +00:00
(error "Directory merge aborted")))
((and (stringp dir3) (string= merge-autostore-dir dir3))
(or (y-or-n-p
1999-11-01 07:16:15 +00:00
"Directory for saving merged files = Ancestor Directory. Sure? ")
1996-09-20 01:10:05 +00:00
(error "Directory merge aborted")))))
2003-02-04 11:26:42 +00:00
(setq dir-diff-struct (ediff-intersect-directories
jobname
regexp dir1 dir2 dir3 merge-autostore-dir))
(setq startup-hooks
;; this sets various vars in the meta buffer inside
;; ediff-prepare-meta-buffer
1999-11-25 04:34:23 +00:00
(cons `(lambda ()
;; tell what to do if the user clicks on a session record
(setq ediff-session-action-function (quote ,action))
2003-02-04 11:26:42 +00:00
;; set ediff-dir-difference-list
(setq ediff-dir-difference-list
(cdr (quote ,dir-diff-struct))))
startup-hooks))
2003-02-04 11:26:42 +00:00
(setq meta-buf (ediff-prepare-meta-buffer
1996-06-22 01:54:34 +00:00
'ediff-filegroup-action
(car dir-diff-struct)
"*Ediff Session Group Panel"
'ediff-redraw-directory-group-buffer
jobname
startup-hooks))
(ediff-show-meta-buffer meta-buf)
))
1999-11-01 07:16:15 +00:00
;; MERGE-AUTOSTORE-DIR can be given to tell ediff where to store the merged
;; files
2003-02-04 11:26:42 +00:00
(defun ediff-directory-revisions-internal (dir1 regexp action jobname
1999-11-01 07:16:15 +00:00
&optional startup-hooks
merge-autostore-dir)
(setq dir1 (if (file-directory-p dir1) dir1 (file-name-directory dir1)))
1996-09-20 01:10:05 +00:00
1999-11-01 07:16:15 +00:00
(if merge-autostore-dir
(or (stringp merge-autostore-dir)
(error "%S: Directory for storing merged files must be a string"
jobname)))
(let (file-list meta-buf)
2003-02-04 11:26:42 +00:00
(if (and ediff-autostore-merges
1999-11-01 07:16:15 +00:00
(ediff-merge-metajob jobname)
(not merge-autostore-dir))
2003-02-04 11:26:42 +00:00
(setq merge-autostore-dir
1999-11-01 07:16:15 +00:00
(read-file-name "Save merged files in directory: "
(if ediff-use-last-dir
ediff-last-merge-autostore-dir
(ediff-strip-last-dir dir1))
nil
'must-match)))
1996-09-20 01:10:05 +00:00
;; verify merge-autostore-dir != dir1
1999-11-01 07:16:15 +00:00
(if (and merge-autostore-dir
1996-09-20 01:10:05 +00:00
(stringp dir1)
(string= merge-autostore-dir dir1))
(or (y-or-n-p
1999-11-01 07:16:15 +00:00
"Directory for saving merged file = directory A. Sure? ")
1996-09-20 01:10:05 +00:00
(error "Merge of directory revisions aborted")))
2003-02-04 11:26:42 +00:00
(setq file-list
1996-09-20 01:10:05 +00:00
(ediff-get-directory-files-under-revision
jobname regexp dir1 merge-autostore-dir))
(setq startup-hooks
;; this sets various vars in the meta buffer inside
;; ediff-prepare-meta-buffer
1999-11-25 04:34:23 +00:00
(cons `(lambda ()
;; tell what to do if the user clicks on a session record
(setq ediff-session-action-function (quote ,action)))
startup-hooks))
2003-02-04 11:26:42 +00:00
(setq meta-buf (ediff-prepare-meta-buffer
1996-06-22 01:54:34 +00:00
'ediff-filegroup-action
file-list
"*Ediff Session Group Panel"
'ediff-redraw-directory-group-buffer
jobname
startup-hooks))
(ediff-show-meta-buffer meta-buf)
))
1995-03-16 22:31:54 +00:00
;;; Compare regions and windows
;;;###autoload
(defun ediff-windows-wordwise (dumb-mode &optional wind-A wind-B startup-hooks)
"Compare WIND-A and WIND-B, which are selected by clicking, wordwise.
1995-03-16 22:31:54 +00:00
With prefix argument, DUMB-MODE, or on a non-windowing display, works as
follows:
If WIND-A is nil, use selected window.
If WIND-B is nil, use window next to WIND-A."
(interactive "P")
(ediff-windows dumb-mode wind-A wind-B
startup-hooks 'ediff-windows-wordwise 'word-mode))
2003-02-04 11:26:42 +00:00
;;;###autoload
(defun ediff-windows-linewise (dumb-mode &optional wind-A wind-B startup-hooks)
"Compare WIND-A and WIND-B, which are selected by clicking, linewise.
With prefix argument, DUMB-MODE, or on a non-windowing display, works as
follows:
If WIND-A is nil, use selected window.
If WIND-B is nil, use window next to WIND-A."
(interactive "P")
(ediff-windows dumb-mode wind-A wind-B
startup-hooks 'ediff-windows-linewise nil))
2003-02-04 11:26:42 +00:00
;; Compare WIND-A and WIND-B, which are selected by clicking.
;; With prefix argument, DUMB-MODE, or on a non-windowing display,
;; works as follows:
;; If WIND-A is nil, use selected window.
;; If WIND-B is nil, use window next to WIND-A.
(defun ediff-windows (dumb-mode wind-A wind-B startup-hooks job-name word-mode)
(if (or dumb-mode (not (ediff-window-display-p)))
1995-03-16 22:31:54 +00:00
(setq wind-A (ediff-get-next-window wind-A nil)
wind-B (ediff-get-next-window wind-B wind-A))
(setq wind-A (ediff-get-window-by-clicking wind-A nil 1)
wind-B (ediff-get-window-by-clicking wind-B wind-A 2)))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(let ((buffer-A (window-buffer wind-A))
(buffer-B (window-buffer wind-B))
beg-A end-A beg-B end-B)
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(save-excursion
(save-window-excursion
1996-01-05 22:21:28 +00:00
(sit-for 0) ; sync before using window-start/end -- a precaution
1995-03-16 22:31:54 +00:00
(select-window wind-A)
(setq beg-A (window-start)
end-A (window-end))
(select-window wind-B)
(setq beg-B (window-start)
end-B (window-end))))
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(setq buffer-A
(ediff-clone-buffer-for-window-comparison
buffer-A wind-A "-Window.A-")
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
buffer-B
(ediff-clone-buffer-for-window-comparison
buffer-B wind-B "-Window.B-"))
1995-03-16 22:31:54 +00:00
(ediff-regions-internal
buffer-A beg-A end-A buffer-B beg-B end-B
1997-05-31 01:10:39 +00:00
startup-hooks job-name word-mode nil)))
2003-02-04 11:26:42 +00:00
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks)
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
"Run Ediff on a pair of regions in specified buffers.
Regions \(i.e., point and mark\) are assumed to be set in advance except
for the second region in the case both regions are from the same buffer.
In such a case the user is asked to interactively establish the second
region.
1995-03-16 22:31:54 +00:00
This function is effective only for relatively small regions, up to 200
1999-11-01 07:16:15 +00:00
lines. For large regions, use `ediff-regions-linewise'."
2003-02-04 11:26:42 +00:00
(interactive
1995-03-16 22:31:54 +00:00
(let (bf)
(list (setq bf (read-buffer "Region's A buffer: "
(ediff-other-buffer "") t))
(read-buffer "Region's B buffer: "
(progn
;; realign buffers so that two visible bufs will be
;; at the top
(save-window-excursion (other-window 1))
(ediff-other-buffer bf))
t))))
(if (not (ediff-buffer-live-p buffer-A))
(error "Buffer %S doesn't exist" buffer-A))
(if (not (ediff-buffer-live-p buffer-B))
(error "Buffer %S doesn't exist" buffer-B))
2003-02-04 11:26:42 +00:00
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(let ((buffer-A
(ediff-clone-buffer-for-region-comparison buffer-A "-Region.A-"))
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(buffer-B
(ediff-clone-buffer-for-region-comparison buffer-B "-Region.B-"))
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
reg-A-beg reg-A-end reg-B-beg reg-B-end)
1995-03-16 22:31:54 +00:00
(save-excursion
(set-buffer buffer-A)
(setq reg-A-beg (region-beginning)
reg-A-end (region-end))
(set-buffer buffer-B)
(setq reg-B-beg (region-beginning)
reg-B-end (region-end)))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(ediff-regions-internal
(get-buffer buffer-A) reg-A-beg reg-A-end
(get-buffer buffer-B) reg-B-beg reg-B-end
1997-05-31 01:10:39 +00:00
startup-hooks 'ediff-regions-wordwise 'word-mode nil)))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks)
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
"Run Ediff on a pair of regions in specified buffers.
Regions \(i.e., point and mark\) are assumed to be set in advance except
for the second region in the case both regions are from the same buffer.
In such a case the user is asked to interactively establish the second
region.
1995-03-16 22:31:54 +00:00
Each region is enlarged to contain full lines.
This function is effective for large regions, over 100-200
1999-11-01 07:16:15 +00:00
lines. For small regions, use `ediff-regions-wordwise'."
2003-02-04 11:26:42 +00:00
(interactive
1995-03-16 22:31:54 +00:00
(let (bf)
(list (setq bf (read-buffer "Region A's buffer: "
(ediff-other-buffer "") t))
(read-buffer "Region B's buffer: "
(progn
;; realign buffers so that two visible bufs will be
;; at the top
(save-window-excursion (other-window 1))
(ediff-other-buffer bf))
t))))
(if (not (ediff-buffer-live-p buffer-A))
1995-03-16 22:31:54 +00:00
(error "Buffer %S doesn't exist" buffer-A))
(if (not (ediff-buffer-live-p buffer-B))
1995-03-16 22:31:54 +00:00
(error "Buffer %S doesn't exist" buffer-B))
2003-02-04 11:26:42 +00:00
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(let ((buffer-A
(ediff-clone-buffer-for-region-comparison buffer-A "-Region.A-"))
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(buffer-B
(ediff-clone-buffer-for-region-comparison buffer-B "-Region.B-"))
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
reg-A-beg reg-A-end reg-B-beg reg-B-end)
1995-03-16 22:31:54 +00:00
(save-excursion
(set-buffer buffer-A)
(setq reg-A-beg (region-beginning)
reg-A-end (region-end))
;; enlarge the region to hold full lines
2003-02-04 11:26:42 +00:00
(goto-char reg-A-beg)
1995-03-16 22:31:54 +00:00
(beginning-of-line)
(setq reg-A-beg (point))
2003-02-04 11:26:42 +00:00
(goto-char reg-A-end)
1995-03-16 22:31:54 +00:00
(end-of-line)
(or (eobp) (forward-char)) ; include the newline char
(setq reg-A-end (point))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(set-buffer buffer-B)
(setq reg-B-beg (region-beginning)
reg-B-end (region-end))
;; enlarge the region to hold full lines
2003-02-04 11:26:42 +00:00
(goto-char reg-B-beg)
1995-03-16 22:31:54 +00:00
(beginning-of-line)
(setq reg-B-beg (point))
2003-02-04 11:26:42 +00:00
(goto-char reg-B-end)
1995-03-16 22:31:54 +00:00
(end-of-line)
(or (eobp) (forward-char)) ; include the newline char
(setq reg-B-end (point))
) ; save excursion
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(ediff-regions-internal
(get-buffer buffer-A) reg-A-beg reg-A-end
(get-buffer buffer-B) reg-B-beg reg-B-end
1997-07-17 19:37:07 +00:00
startup-hooks 'ediff-regions-linewise nil nil))) ; no word mode
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;; compare region beg-A to end-A of buffer-A
2003-02-04 11:26:42 +00:00
;; to regions beg-B -- end-B in buffer-B.
1995-03-16 22:31:54 +00:00
(defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B
1997-05-31 01:10:39 +00:00
startup-hooks job-name word-mode
setup-parameters)
1995-03-16 22:31:54 +00:00
(let ((tmp-buffer (get-buffer-create ediff-tmp-buffer))
overl-A overl-B
file-A file-B)
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;; in case beg/end-A/B aren't markers--make them into markers
1997-07-31 04:04:23 +00:00
(ediff-with-current-buffer buffer-A
1995-03-16 22:31:54 +00:00
(setq beg-A (move-marker (make-marker) beg-A)
end-A (move-marker (make-marker) end-A)))
1997-07-31 04:04:23 +00:00
(ediff-with-current-buffer buffer-B
1995-03-16 22:31:54 +00:00
(setq beg-B (move-marker (make-marker) beg-B)
end-B (move-marker (make-marker) end-B)))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;; make file-A
(if word-mode
(ediff-wordify beg-A end-A buffer-A tmp-buffer)
(ediff-copy-to-buffer beg-A end-A buffer-A tmp-buffer))
(setq file-A (ediff-make-temp-file tmp-buffer "regA"))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;; make file-B
(if word-mode
(ediff-wordify beg-B end-B buffer-B tmp-buffer)
(ediff-copy-to-buffer beg-B end-B buffer-B tmp-buffer))
(setq file-B (ediff-make-temp-file tmp-buffer "regB"))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(setq overl-A (ediff-make-bullet-proof-overlay beg-A end-A buffer-A))
(setq overl-B (ediff-make-bullet-proof-overlay beg-B end-B buffer-B))
(ediff-setup buffer-A file-A
buffer-B file-B
nil nil ; buffer & file C
1999-11-25 04:34:23 +00:00
(cons `(lambda ()
(delete-file ,file-A)
(delete-file ,file-B))
1994-05-02 05:16:59 +00:00
startup-hooks)
1997-05-31 01:10:39 +00:00
(append
(list (cons 'ediff-word-mode word-mode)
(cons 'ediff-narrow-bounds (list overl-A overl-B))
(cons 'ediff-job-name job-name))
1997-11-01 01:46:51 +00:00
setup-parameters))
1995-03-16 22:31:54 +00:00
))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;; Merge files and buffers
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defalias 'ediff-merge 'ediff-merge-files)
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(defsubst ediff-merge-on-startup ()
(ediff-do-merge 0)
;; Can't remember why this is here, but it may cause the automatically merged
;; buffer to be lost. So, keep the buffer modified.
;;(ediff-with-current-buffer ediff-buffer-C
;; (set-buffer-modified-p nil))
)
1995-03-16 22:31:54 +00:00
;;;###autoload
1997-11-01 01:46:51 +00:00
(defun ediff-merge-files (file-A file-B
;; MERGE-BUFFER-FILE is the file to be
2003-02-04 11:26:42 +00:00
;; associated with the merge buffer
1997-11-01 01:46:51 +00:00
&optional startup-hooks merge-buffer-file)
1995-03-16 22:31:54 +00:00
"Merge two files without ancestor."
(interactive
(let ((dir-A (if ediff-use-last-dir
ediff-last-dir-A
default-directory))
dir-B f)
(list (setq f (ediff-read-file-name
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
"File A to merge"
dir-A
(ediff-get-default-file-name)
'no-dirs))
2003-02-04 11:26:42 +00:00
(ediff-read-file-name "File B to merge"
1995-03-16 22:31:54 +00:00
(setq dir-B
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-B
1995-03-16 22:31:54 +00:00
(file-name-directory f)))
(progn
(setq file-name-history
(cons (ediff-abbreviate-file-name
1995-03-16 22:31:54 +00:00
(expand-file-name
(file-name-nondirectory f)
dir-B))
file-name-history))
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
(ediff-get-default-file-name f 1)))
1995-03-16 22:31:54 +00:00
)))
(setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
2003-02-04 11:26:42 +00:00
(ediff-files-internal file-A
1995-03-16 22:31:54 +00:00
(if (file-directory-p file-B)
(expand-file-name
(file-name-nondirectory file-A) file-B)
file-B)
nil ; file-C
startup-hooks
1997-11-01 01:46:51 +00:00
'ediff-merge-files
merge-buffer-file))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defun ediff-merge-files-with-ancestor (file-A file-B file-ancestor
1997-11-01 01:46:51 +00:00
&optional
startup-hooks
;; MERGE-BUFFER-FILE is the file
;; to be associated with the
;; merge buffer
merge-buffer-file)
1995-03-16 22:31:54 +00:00
"Merge two files with ancestor."
(interactive
(let ((dir-A (if ediff-use-last-dir
ediff-last-dir-A
default-directory))
dir-B dir-ancestor f ff)
(list (setq f (ediff-read-file-name
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
"File A to merge"
dir-A
(ediff-get-default-file-name)
'no-dirs))
2003-02-04 11:26:42 +00:00
(setq ff (ediff-read-file-name "File B to merge"
1995-03-16 22:31:54 +00:00
(setq dir-B
(if ediff-use-last-dir
2003-02-04 11:26:42 +00:00
ediff-last-dir-B
1995-03-16 22:31:54 +00:00
(file-name-directory f)))
(progn
(setq file-name-history
(cons
(ediff-abbreviate-file-name
1995-03-16 22:31:54 +00:00
(expand-file-name
(file-name-nondirectory f)
dir-B))
file-name-history))
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
(ediff-get-default-file-name f 1))))
2003-02-04 11:26:42 +00:00
(ediff-read-file-name "Ancestor file"
1995-03-16 22:31:54 +00:00
(setq dir-ancestor
(if ediff-use-last-dir
ediff-last-dir-ancestor
(file-name-directory ff)))
(progn
(setq file-name-history
(cons (ediff-abbreviate-file-name
1995-03-16 22:31:54 +00:00
(expand-file-name
(file-name-nondirectory ff)
dir-ancestor))
file-name-history))
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu> * viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
2000-10-29 04:56:45 +00:00
(ediff-get-default-file-name ff 2)))
1995-03-16 22:31:54 +00:00
)))
(setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
2003-02-04 11:26:42 +00:00
(ediff-files-internal file-A
1995-03-16 22:31:54 +00:00
(if (file-directory-p file-B)
(expand-file-name
(file-name-nondirectory file-A) file-B)
file-B)
file-ancestor
startup-hooks
1997-11-01 01:46:51 +00:00
'ediff-merge-files-with-ancestor
merge-buffer-file))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
(defalias 'ediff-merge-with-ancestor 'ediff-merge-files-with-ancestor)
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
1997-11-01 01:46:51 +00:00
(defun ediff-merge-buffers (buffer-A buffer-B
&optional
;; MERGE-BUFFER-FILE is the file to be
;; associated with the merge buffer
startup-hooks job-name merge-buffer-file)
1995-03-16 22:31:54 +00:00
"Merge buffers without ancestor."
2003-02-04 11:26:42 +00:00
(interactive
1995-03-16 22:31:54 +00:00
(let (bf)
(list (setq bf (read-buffer "Buffer A to merge: "
(ediff-other-buffer "") t))
(read-buffer "Buffer B to merge: "
(progn
;; realign buffers so that two visible bufs will be
;; at the top
(save-window-excursion (other-window 1))
(ediff-other-buffer bf))
t))))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
(or job-name (setq job-name 'ediff-merge-buffers))
(ediff-buffers-internal
1997-11-01 01:46:51 +00:00
buffer-A buffer-B nil startup-hooks job-name merge-buffer-file))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
1997-11-01 01:46:51 +00:00
(defun ediff-merge-buffers-with-ancestor (buffer-A buffer-B buffer-ancestor
&optional
startup-hooks
job-name
;; MERGE-BUFFER-FILE is the
;; file to be associated
;; with the merge buffer
merge-buffer-file)
1995-03-16 22:31:54 +00:00
"Merge buffers with ancestor."
2003-02-04 11:26:42 +00:00
(interactive
1995-03-16 22:31:54 +00:00
(let (bf bff)
(list (setq bf (read-buffer "Buffer A to merge: "
(ediff-other-buffer "") t))
(setq bff (read-buffer "Buffer B to merge: "
(progn
;; realign buffers so that two visible
;; bufs will be at the top
(save-window-excursion (other-window 1))
(ediff-other-buffer bf))
t))
(read-buffer "Ancestor buffer: "
(progn
;; realign buffers so that three visible
;; bufs will be at the top
(save-window-excursion (other-window 1))
(ediff-other-buffer (list bf bff)))
t)
)))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
(setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
(or job-name (setq job-name 'ediff-merge-buffers-with-ancestor))
(ediff-buffers-internal
1997-11-01 01:46:51 +00:00
buffer-A buffer-B buffer-ancestor startup-hooks job-name merge-buffer-file))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
1997-11-01 01:46:51 +00:00
(defun ediff-merge-revisions (&optional file startup-hooks merge-buffer-file)
;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer
1995-03-16 22:31:54 +00:00
"Run Ediff by merging two revisions of a file.
The file is the optional FILE argument or the file visited by the current
buffer."
(interactive)
(if (stringp file) (find-file file))
1996-02-16 06:36:35 +00:00
(let (rev1 rev2)
(setq rev1
(read-string
(format
"Version 1 to merge (default: %s's working version): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
rev2
(read-string
(format
"Version 2 to merge (default: %s): "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
1996-02-16 06:36:35 +00:00
(ediff-load-version-control)
;; ancestor-revision=nil
(funcall
1996-09-20 01:10:05 +00:00
(intern (format "ediff-%S-merge-internal" ediff-version-control-package))
1997-11-01 01:46:51 +00:00
rev1 rev2 nil startup-hooks merge-buffer-file)))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;;###autoload
1997-11-01 01:46:51 +00:00
(defun ediff-merge-revisions-with-ancestor (&optional
file startup-hooks
;; MERGE-BUFFER-FILE is the file to
;; be associated with the merge
;; buffer
merge-buffer-file)
"Run Ediff by merging two revisions of a file with a common ancestor.
2002-01-13 10:09:20 +00:00
The file is the optional FILE argument or the file visited by the current
buffer."
(interactive)
(if (stringp file) (find-file file))
1996-02-16 06:36:35 +00:00
(let (rev1 rev2 ancestor-rev)
(setq rev1
(read-string
(format
"Version 1 to merge (default: %s's working version): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
rev2
(read-string
(format
"Version 2 to merge (default: %s): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
ancestor-rev
(read-string
(format
1999-11-01 07:16:15 +00:00
"Ancestor version (default: %s's base revision): "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
1996-02-16 06:36:35 +00:00
(ediff-load-version-control)
(funcall
1996-09-20 01:10:05 +00:00
(intern (format "ediff-%S-merge-internal" ediff-version-control-package))
1997-11-01 01:46:51 +00:00
rev1 rev2 ancestor-rev startup-hooks merge-buffer-file)))
1996-02-16 06:36:35 +00:00
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
;; MK: Check. This function doesn't seem to be used any more by pcvs or pcl-cvs
1996-02-16 06:36:35 +00:00
;;;###autoload
(defun run-ediff-from-cvs-buffer (pos)
"Run Ediff-merge on appropriate revisions of the selected file.
1999-11-01 07:16:15 +00:00
First run after `M-x cvs-update'. Then place the cursor on a line describing a
1996-02-16 06:36:35 +00:00
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"))))
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;;; Apply patch
1996-06-22 01:54:34 +00:00
;;;###autoload
1999-11-01 07:16:15 +00:00
(defun ediff-patch-file (&optional arg patch-buf)
"Run Ediff by patching SOURCE-FILENAME.
If optional PATCH-BUF is given, use the patch in that buffer
and don't ask the user.
If prefix argument, then: if even argument, assume that the patch is in a
buffer. If odd -- assume it is in a file."
(interactive "P")
(let (source-dir source-file)
1996-06-22 01:54:34 +00:00
(require 'ediff-ptch)
1999-11-01 07:16:15 +00:00
(setq patch-buf
(ediff-get-patch-buffer
(if arg (prefix-numeric-value arg)) patch-buf))
1996-06-22 01:54:34 +00:00
(setq source-dir (cond (ediff-use-last-dir ediff-last-dir-patch)
((and (not ediff-patch-default-directory)
(buffer-file-name patch-buf))
(file-name-directory
(expand-file-name
(buffer-file-name patch-buf))))
(t default-directory)))
(setq source-file
2003-02-04 11:26:42 +00:00
(read-file-name
1999-11-01 07:16:15 +00:00
"File to patch (directory, if multifile patch): "
;; use an explicit initial file
source-dir nil nil (ediff-get-default-file-name)))
1996-06-22 01:54:34 +00:00
(ediff-dispatch-file-patching-job patch-buf source-file)))
1995-03-16 22:31:54 +00:00
1996-06-22 01:54:34 +00:00
;;;###autoload
1999-11-01 07:16:15 +00:00
(defun ediff-patch-buffer (&optional arg patch-buf)
"Run Ediff by patching BUFFER-NAME.
Without prefix argument: asks if the patch is in some buffer and prompts for
the buffer or a file, depending on the answer.
With prefix arg=1: assumes the patch is in a file and prompts for the file.
With prefix arg=2: assumes the patch is in a buffer and prompts for the buffer."
1999-11-01 07:16:15 +00:00
(interactive "P")
(require 'ediff-ptch)
(setq patch-buf
(ediff-get-patch-buffer
(if arg (prefix-numeric-value arg)) patch-buf))
(ediff-patch-buffer-internal
patch-buf
(read-buffer
"Which buffer to patch? "
(current-buffer))))
2003-02-04 11:26:42 +00:00
1999-11-01 07:16:15 +00:00
1996-06-22 01:54:34 +00:00
;;;###autoload
(defalias 'epatch 'ediff-patch-file)
;;;###autoload
(defalias 'epatch-buffer 'ediff-patch-buffer)
1995-03-16 22:31:54 +00:00
1994-05-02 05:16:59 +00:00
1995-03-16 22:31:54 +00:00
2003-02-04 11:26:42 +00:00
;;; Versions Control functions
1994-05-02 05:16:59 +00:00
;;;###autoload
(defun ediff-revision (&optional file startup-hooks)
"Run Ediff by comparing versions of a file.
The file is an optional FILE argument or the file entered at the prompt.
Default: the file visited by the current buffer.
Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'."
;; if buffer is non-nil, use that buffer instead of the current buffer
(interactive "P")
(if (not (stringp file))
(setq file
(ediff-read-file-name "Compare revisions for file"
(if ediff-use-last-dir
ediff-last-dir-A
default-directory)
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): new macro that replaces viper-emacs-p and viper-xemacs-p in many cases. Used to reduce the number of warnings. * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-standard-value): moved here from viper.el. (viper-set-unread-command-events): moved to viper-util.el (viper-check-minibuffer-overlay): make sure viper-minibuffer-overlay is moved to cover the entire input field. * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. (viper-read-key-sequence, viper-set-unread-command-events, viper-char-symbol-sequence-p, viper-char-array-p): moved here. * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, viper-event-vector-p): moved to viper-util.el * viper.el (viper-standard-value): moved to viper-cmd.el. Use viper-cond-compile-for-xemacs-or-emacs. * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new macro designed to be used in many places where ediff-emacs-p or ediff-xemacs-p was previously used. Reduces the number of warnings. Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue of ediff-xemacs-p. (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents): moved to ediff-util.el. (ediff-event-key): moved here. * ediff-merge.el: got rid of unreferenced variables. * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. (ediff-cleanup-mess): improved the way windows are set up after quitting ediff. (ediff-janitor): use ediff-dispose-of-variant-according-to-user. (ediff-dispose-of-variant-according-to-user): new function designed to be smarter and also understands indirect buffers. (ediff-highlight-diff-in-one-buffer, ediff-unhighlight-diff-in-one-buffer, ediff-unhighlight-diffs-totally-in-one-buffer, ediff-highlight-diff, ediff-highlight-diff, ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, ediff-get-region-contents, ediff-make-current-diff-overlay): moved here. (ediff-format-bindings-of): new function by Hannu Koivisto <azure@iki.fi>. (ediff-setup): make sure the merge buffer is always widened and modifiable. (ediff-write-merge-buffer-and-maybe-kill): refuse to write the result of a merge into a file visited by another buffer. (ediff-arrange-autosave-in-merge-jobs): check if the merge file is visited by another buffer and ask to save/delete that buffer. (ediff-verify-file-merge-buffer): new function to do the above. * ediff-vers.el: load ediff-init.el at compile time. * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. * ediff.el (ediff-windows, ediff-regions-wordwise, ediff-regions-linewise): use indirect buffers to improve robustness and make it possible to compare regions of the same buffer (even overlapping regions). (ediff-clone-buffer-for-region-comparison, ediff-clone-buffer-for-window-comparison): new functions. (ediff-files-internal): refuse to compare identical files. (ediff-regions-internal): get rid of the warning about comparing regions of the same buffer. * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. Plus the following fixes courtesy of Dave Love: Doc fixes. (ediff-word-1): Use word class and move - to the front per regexp documentation. (ediff-wordify): Bind forward-word-function outside loop. (ediff-copy-to-buffer): Use insert-buffer-substring rather than consing buffer contents. (ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
(ediff-get-default-file-name)
2003-02-04 11:26:42 +00:00
'no-dirs)))
(find-file file)
(if (and (buffer-modified-p)
(y-or-n-p (message "Buffer %s is modified. Save buffer? "
(buffer-name))))
(save-buffer (current-buffer)))
(let (rev1 rev2)
(setq rev1
(read-string
(format "Revision 1 to compare (default: %s's latest revision): "
(file-name-nondirectory file)))
rev2
2003-02-04 11:26:42 +00:00
(read-string
(format "Revision 2 to compare (default: %s's current state): "
(file-name-nondirectory file))))
(ediff-load-version-control)
(funcall
1996-09-20 01:10:05 +00:00
(intern (format "ediff-%S-internal" ediff-version-control-package))
rev1 rev2 startup-hooks)
))
1997-07-17 19:37:07 +00:00
;;;###autoload
(defalias 'erevision 'ediff-revision)
2003-02-04 11:26:42 +00:00
1995-03-16 22:31:54 +00:00
;; 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)
1996-02-16 06:36:35 +00:00
(require 'ediff-vers)
1995-03-16 22:31:54 +00:00
(or (featurep ediff-version-control-package)
(if (locate-library (symbol-name ediff-version-control-package))
(progn
(message "") ; kill the message from `locate-library'
(require ediff-version-control-package))
1995-03-16 22:31:54 +00:00
(or silent
1999-11-01 07:16:15 +00:00
(error "Version control package %S.el not found. Use vc.el instead"
1995-03-16 22:31:54 +00:00
ediff-version-control-package)))))
1994-05-10 00:48:00 +00:00
1995-10-14 03:14:39 +00:00
;;;###autoload
(defun ediff-version ()
"Return string describing the version of Ediff.
When called interactively, displays the version."
(interactive)
(if (interactive-p)
(message (ediff-version))
(format "Ediff %s of %s" ediff-version ediff-date)))
1994-05-02 05:16:59 +00:00
1996-02-16 06:36:35 +00:00
;;;###autoload
1996-09-20 01:10:05 +00:00
(defun ediff-documentation (&optional node)
"Display Ediff's manual.
With optional NODE, goes to that node."
1996-02-16 06:36:35 +00:00
(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"))
1996-09-20 01:10:05 +00:00
(if node
(Info-goto-node node)
(message "Type `i' to search for a specific topic"))
(raise-frame (selected-frame)))
1996-02-16 06:36:35 +00:00
(error (beep 1)
1996-06-22 01:54:34 +00:00
(with-output-to-temp-buffer ediff-msg-buffer
(ediff-with-current-buffer standard-output
(fundamental-mode))
1996-09-20 01:10:05 +00:00
(princ ediff-BAD-INFO))
1996-02-16 06:36:35 +00:00
(if (window-live-p ctl-window)
(progn
(select-window ctl-window)
(set-window-buffer ctl-window ctl-buf)))))))
2003-02-04 11:26:42 +00:00
1996-02-16 06:36:35 +00:00
(dolist (mess '("^Errors in diff output. Diff output is in "
"^Hmm... I don't see an Ediff command around here...$"
"^Undocumented command! Type `G' in Ediff Control Panel to drop a note to the Ediff maintainer$"
": This command runs in Ediff Control Buffer only!$"
": Invalid op in ediff-check-version$"
"^ediff-shrink-window-C can be used only for merging jobs$"
"^Lost difference info on these directories$"
"^This command is inapplicable in the present context$"
"^This session group has no parent$"
"^Can't hide active session, $"
"^Ediff: something wrong--no multiple diffs buffer$"
"^Can't make context diff for Session $"
"^The patch buffer wasn't found$"
"^Aborted$"
"^This Ediff session is not part of a session group$"
"^No active Ediff sessions or corrupted session registry$"
"^No session info in this line$"
"^`.*' is not an ordinary file$"
"^Patch appears to have failed$"
"^Recomputation of differences cancelled$"
"^No fine differences in this mode$"
"^Lost connection to ancestor buffer...sorry$"
"^Not merging with ancestor$"
"^Don't know how to toggle read-only in buffer "
"Emacs is not running as a window application$"
"^This command makes sense only when merging with an ancestor$"
"^At end of the difference list$"
"^At beginning of the difference list$"
"^Nothing saved for diff .* in buffer "
"^Buffer is out of sync for file "
"^Buffer out of sync for file "
"^Output from `diff' not found$"
"^You forgot to specify a region in buffer "
"^All right. Make up your mind and come back...$"
"^Current buffer is not visiting any file$"
"^Failed to retrieve revision: $"
"^Can't determine display width.$"
"^File `.*' does not exist or is not readable$"
"^File `.*' is a directory$"
"^Buffer .* doesn't exist$"
"^Directories . and . are the same: "
"^Directory merge aborted$"
"^Merge of directory revisions aborted$"
"^Buffer .* doesn't exist$"
"^There is no file to merge$"
"^Version control package .*.el not found. Use vc.el instead$"))
(add-to-list 'debug-ignored-errors mess))
1996-02-16 06:36:35 +00:00
;;; Local Variables:
;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
1997-07-31 04:04:23 +00:00
;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
1996-02-16 06:36:35 +00:00
;;; End:
1995-03-16 22:31:54 +00:00
(require 'ediff-util)
1994-05-02 05:16:59 +00:00
1999-11-01 07:16:15 +00:00
(run-hooks 'ediff-load-hook)
2003-09-01 15:45:59 +00:00
;;; arch-tag: 97c71396-db02-4f41-8b48-6a51c3348fcc
1994-05-02 05:16:59 +00:00
;;; ediff.el ends here