the current highlighting style into account.
(ediff-forward-word-function,ediff-whitespace,ediff-word-1,
ediff-word-2,ediff-word-3,ediff-word-4): make them buffer local.
* ediff-init.el (ediff-patch-job): new macro.
* ediff-mult.el (ediff-make-new-meta-list-header): new API function.
(ediff-intersect-directories): use ediff-make-new-meta-list-header.
* ediff-ptch.el (ediff-map-patch-buffer): use
ediff-make-new-meta-list-header.
(ediff-fixup-patch-map): use the meta-list API from ediff-mult.el.
* ediff-util.el (ediff-toggle-hilit): fix toggling of highliting.
(ediff-select-difference): take highlighting style into account.
(ediff-clone-buffer-for-region-comparison): new function.
(ediff-inferior-compare-regions): added comparison of current diff
regions.
* ediff.el (ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): moved to ediff-util.el.
+2002-03-20 Michael Kifer <kifer@cs.stonybrook.edu>
+
+ * ediff-diff.el (ediff-install-fine-diff-if-necessary): take
+ the current highlighting style into account.
+ (ediff-forward-word-function,ediff-whitespace,ediff-word-1,
+ ediff-word-2,ediff-word-3,ediff-word-4): make them buffer local.
+
+ * ediff-init.el (ediff-patch-job): new macro.
+
+ * ediff-mult.el (ediff-make-new-meta-list-header): new API function.
+ (ediff-intersect-directories): use ediff-make-new-meta-list-header.
+
+ * ediff-ptch.el (ediff-map-patch-buffer): use
+ ediff-make-new-meta-list-header.
+ (ediff-fixup-patch-map): use the meta-list API from ediff-mult.el.
+
+ * ediff-util.el (ediff-toggle-hilit): fix toggling of highliting.
+ (ediff-select-difference): take highlighting style into account.
+ (ediff-clone-buffer-for-region-comparison): new function.
+ (ediff-inferior-compare-regions): added comparison of current diff
+ regions.
+
+ * ediff.el (ediff-clone-buffer-for-region-comparison,
+ ediff-clone-buffer-for-window-comparison): moved to ediff-util.el.
+
2002-03-19 pmr-sav <pmr-sav@hamm.pajato.com>
* mail-utils.el (rmail-dont-reply-to):
(put 'woman-faces 'custom-loads '("woman"))
(put 'ps-print-vertical 'custom-loads '("ps-print"))
(put 'supercite-hooks 'custom-loads '("supercite"))
+(put 'chinese-calendar 'custom-loads '("cal-china"))
(put 'vhdl-menu 'custom-loads '("vhdl-mode"))
(put 'gnus-newsrc 'custom-loads '("gnus-start"))
-(put 'chinese-calendar 'custom-loads '("cal-china"))
(put 'expand 'custom-loads '("expand"))
(put 'bookmark 'custom-loads '("bookmark"))
(put 'icon 'custom-loads '("icon"))
(put 'iso-acc 'custom-loads '("iso-acc"))
(put 'gnus-summary-pick 'custom-loads '("gnus-salt"))
(put 'gnus-thread 'custom-loads '("gnus-sum"))
-(put 'languages 'custom-loads '("cus-edit" "info-look" "ada-mode" "antlr-mode" "asm-mode" "cperl-mode" "dcl-mode" "delphi" "f90" "fortran" "hideshow" "icon" "idlwave" "m4-mode" "meta-mode" "modula2" "octave-mod" "pascal" "perl-mode" "prolog" "ps-mode" "sh-script" "simula" "tcl" "vhdl-mode" "sgml-mode"))
+(put 'languages 'custom-loads '("cus-edit" "info-look" "ada-mode" "antlr-mode" "asm-mode" "cperl-mode" "dcl-mode" "delphi" "f90" "fortran" "hideshow" "icon" "idlwave" "m4-mode" "meta-mode" "modula2" "octave-mod" "pascal" "perl-mode" "prolog" "ps-mode" "sh-script" "simula" "tcl" "vhdl-mode" "sgml-mode" "xml-lite"))
(put 'reftex-miscellaneous-configurations 'custom-loads '("reftex-vars"))
(put 'pong 'custom-loads '("pong"))
(put 'ediff-ptch 'custom-loads '("ediff-ptch"))
(put 'nnmail-various 'custom-loads '("nnmail" "nntp"))
(put 'smiley 'custom-loads '("smiley-ems"))
(put 'extensions 'custom-loads '("generic" "time-stamp" "wid-edit" "cust-print" "eldoc" "page-ext"))
-(put 'ebnf-displacement 'custom-loads '("ebnf2ps"))
+(put 'tetris 'custom-loads '("tetris"))
(put 'appt 'custom-loads '("appt"))
+(put 'ebnf-displacement 'custom-loads '("ebnf2ps"))
(put 'snmp 'custom-loads '("snmp-mode"))
(put 'speedbar-faces 'custom-loads '("speedbar" "vhdl-mode"))
(put 'rmail 'custom-loads '("paths" "rmail" "undigest"))
(put 'ps-print-n-up 'custom-loads '("ps-print"))
(put 'eshell-arg 'custom-loads '("esh-arg"))
-(put 'ps-print-printer 'custom-loads '("ps-print"))
+(put 'ps-print-printer 'custom-loads '("lpr" "ps-print"))
(put 'message-various 'custom-loads '("message"))
(put 'term 'custom-loads '("terminal" "term"))
(put 'gnus-summary-exit 'custom-loads '("gnus-sum" "gnus"))
(put 'cperl-indentation-details 'custom-loads '("cperl-mode"))
(put 'mail-extr 'custom-loads '("mail-extr"))
(put 'double 'custom-loads '("double"))
+(put 'xml-lite 'custom-loads '("xml-lite"))
(put 'imenu 'custom-loads '("imenu"))
(put 'eshell-var 'custom-loads '("esh-var"))
(put 'scribe 'custom-loads '("scribe"))
(put 'generic-x 'custom-loads '("generic-x"))
(put 'partial-completion 'custom-loads '("complete"))
(put 'whitespace 'custom-loads '("whitespace"))
-(put 'maint 'custom-loads '("gulp" "lisp-mnt" "emacsbug"))
+(put 'maint 'custom-loads '("emacsbug" "gulp" "lisp-mnt"))
(put 'pages 'custom-loads '("page-ext"))
(put 'message-interface 'custom-loads '("message"))
(put 'diary 'custom-loads '("calendar" "diary-lib"))
(put 'apropos 'custom-loads '("apropos"))
(put 'gomoku 'custom-loads '("gomoku"))
(put 'eshell-pred 'custom-loads '("em-pred"))
-(put 'tools 'custom-loads '("add-log" "calculator" "compare-w" "diff-mode" "diff" "ediff" "elide-head" "emerge" "gud" "pcvs-defs" "smerge-mode" "speedbar" "tempo" "tooltip" "vc" "which-func" "copyright" "rcompile" "compile" "ebrowse" "etags" "glasses" "make-mode"))
+(put 'tools 'custom-loads '("add-log" "calculator" "compare-w" "diff-mode" "diff" "ediff" "elide-head" "emerge" "gud" "pcvs-defs" "smerge-mode" "speedbar" "tempo" "tooltip" "vc" "which-func" "rcompile" "copyright" "compile" "ebrowse" "etags" "glasses" "make-mode"))
(put 'gnus-topic 'custom-loads '("gnus-topic"))
(put 'sgml 'custom-loads '("sgml-mode"))
(put 'keyboard 'custom-loads '("mule" "chistory" "type-break"))
(put 'gnus-article-mime 'custom-loads '("gnus-art" "mm-uu"))
(put 'emulations 'custom-loads '("crisp" "tpu-edt" "vip" "viper"))
(put 'compression 'custom-loads '("jka-compr"))
-(put 'games 'custom-loads '("5x5" "bruce" "decipher" "dunnet" "fortune" "gametree" "gomoku" "handwrite" "hanoi" "landmark" "mpuz" "pong" "solitaire" "spook" "yow"))
+(put 'games 'custom-loads '("5x5" "bruce" "decipher" "dunnet" "fortune" "gametree" "gomoku" "handwrite" "hanoi" "landmark" "mpuz" "pong" "solitaire" "spook" "tetris" "yow"))
(put 'nnmail-retrieve 'custom-loads '("nnmail"))
(put 'gnus-duplicate 'custom-loads '("gnus-dup"))
(put 'find-function 'custom-loads '("find-func"))
(put 'change-log 'custom-loads '("add-log"))
(put 'gnus-group-levels 'custom-loads '("gnus-group" "gnus-start" "gnus"))
(put 'cperl 'custom-loads '("cperl-mode"))
-(put 'bs-appearance 'custom-loads '("bs" "button"))
+(put 'bs-appearance 'custom-loads '("bs"))
+(put 'nil 'custom-loads '("button"))
(put 'pcmpl-cvs 'custom-loads '("pcmpl-cvs"))
(put 'eshell-mode 'custom-loads '("esh-mode"))
(put 'files 'custom-loads '("mule" "files" "autoinsert" "autorevert" "cus-edit" "filecache" "recentf" "shadow" "ange-ftp"))
(put 'gnus-article-hiding 'custom-loads '("gnus-art" "gnus-sum"))
(put 'vhdl-mode 'custom-loads '("vhdl-mode"))
(put 'lpr 'custom-loads '("lpr"))
-(put 'ispell 'custom-loads '("ispell"))
+(put 'ispell 'custom-loads '("flyspell" "ispell"))
(put 'auto-revert 'custom-loads '("autorevert"))
(put 'advice 'custom-loads '("advice"))
(put 'picture 'custom-loads '("picture"))
(put 'reftex-index-support 'custom-loads '("reftex-vars"))
(put 'pascal 'custom-loads '("pascal"))
(put 'rmail-retrieve 'custom-loads '("rmail" "rmailsum"))
-(put 'data 'custom-loads '("text-mode" "arc-mode" "forms" "hexl" "jka-compr" "saveplace" "sort" "tar-mode" "time-stamp" "timeclock" "snmp-mode"))
+(put 'data 'custom-loads '("text-mode" "arc-mode" "forms" "hexl" "jka-compr" "saveplace" "sort" "tar-mode" "time-stamp" "snmp-mode" "timeclock"))
(put 'mail 'custom-loads '("simple" "startup" "time" "gnus" "mail-utils" "mm-decode" "message" "imap" "starttls" "emacsbug" "feedmail" "mail-extr" "mail-hist" "mailalias" "metamail" "mh-e" "mspools" "rmail" "sendmail" "smtpmail" "supercite" "uce" "eudc-vars" "fortune"))
(put 'paren-blinking 'custom-loads '("simple"))
(put 'gnus-summary-sort 'custom-loads '("gnus-sum"))
(custom-put-if-not 'elide-head 'group-documentation "Eliding copyright headers and the like in source files.")
(custom-put-if-not 'ps-line-number-color 'custom-version "21.1")
(custom-put-if-not 'ps-line-number-color 'standard-value t)
-(custom-put-if-not 'sgml-xml 'custom-version "21.2")
-(custom-put-if-not 'sgml-xml 'standard-value t)
(custom-put-if-not 'confirm-kill-emacs 'custom-version "21.1")
(custom-put-if-not 'confirm-kill-emacs 'standard-value t)
-(custom-put-if-not 'vc-rcs-checkout-switches 'custom-version "21.1")
-(custom-put-if-not 'vc-rcs-checkout-switches 'standard-value t)
(custom-put-if-not 'change-log-conditionals-face 'custom-version "21.1")
(custom-put-if-not 'change-log-conditionals-face 'group-documentation nil)
(custom-put-if-not 'mail-source 'custom-version "21.1")
(custom-put-if-not 'ps-line-spacing 'standard-value t)
(custom-put-if-not 'help-highlight-p 'custom-version "20.3")
(custom-put-if-not 'help-highlight-p 'standard-value t)
+(custom-put-if-not 'ange-ftp-raw-login 'custom-version "21.3")
+(custom-put-if-not 'ange-ftp-raw-login 'standard-value t)
(custom-put-if-not 'ps-paragraph-spacing 'custom-version "21.1")
(custom-put-if-not 'ps-paragraph-spacing 'standard-value t)
+(custom-put-if-not 'auto-hscroll-mode 'custom-version "21.1")
+(custom-put-if-not 'auto-hscroll-mode 'standard-value t)
(custom-put-if-not 'flyspell-incorrect-hook 'custom-version "21.1")
(custom-put-if-not 'flyspell-incorrect-hook 'standard-value t)
+(custom-put-if-not 'mode-line-inactive 'custom-version "21.2")
+(custom-put-if-not 'mode-line-inactive 'group-documentation nil)
(custom-put-if-not 'browse-url-mosaic-program 'custom-version "20.3")
(custom-put-if-not 'browse-url-mosaic-program 'standard-value t)
(custom-put-if-not 'vc-cvs-register-switches 'custom-version "21.1")
(custom-put-if-not 'ps-print-footer-frame 'standard-value t)
(custom-put-if-not 'tildify 'custom-version "21.1")
(custom-put-if-not 'tildify 'group-documentation "Adding missing hard spaces or other text fragments into texts.")
-(custom-put-if-not 'vc-rcs-checkin-switches 'custom-version "21.1")
-(custom-put-if-not 'vc-rcs-checkin-switches 'standard-value t)
(custom-put-if-not 'normal-erase-is-backspace 'custom-version "21.1")
(custom-put-if-not 'normal-erase-is-backspace 'standard-value t)
(custom-put-if-not 'gnus-article-banner-alist 'custom-version "21.1")
(custom-put-if-not 'gnus-auto-expirable-marks 'standard-value t)
(custom-put-if-not 'sql-interbase-options 'custom-version "20.8")
(custom-put-if-not 'sql-interbase-options 'standard-value t)
-(custom-put-if-not 'automatic-hscrolling 'custom-version "21.1")
-(custom-put-if-not 'automatic-hscrolling 'standard-value t)
(custom-put-if-not 'custom-buffer-done-function 'custom-version "21.1")
(custom-put-if-not 'custom-buffer-done-function 'standard-value t)
(custom-put-if-not 'gnus-article-mime-match-handle-function 'custom-version "21.1")
(custom-put-if-not 'sql-db2-options 'standard-value t)
(custom-put-if-not 'cwarn 'custom-version "21.1")
(custom-put-if-not 'cwarn 'group-documentation "Highlight suspicious C and C++ constructions.")
+(custom-put-if-not 'sgml-xml-mode 'custom-version "21.2")
+(custom-put-if-not 'sgml-xml-mode 'standard-value t)
(custom-put-if-not 'message-buffer-naming-style 'custom-version "21.1")
(custom-put-if-not 'message-buffer-naming-style 'standard-value t)
(custom-put-if-not 'ps-footer-font-size 'custom-version "21.1")
(custom-put-if-not 'keyboard-coding-system 'standard-value t)
(custom-put-if-not 'sql-sybase-options 'custom-version "20.8")
(custom-put-if-not 'sql-sybase-options 'standard-value t)
+(custom-put-if-not 'vc-cvs-sticky-tag-display 'custom-version "21.3")
+(custom-put-if-not 'vc-cvs-sticky-tag-display 'standard-value t)
(custom-put-if-not 'gnus-read-newsrc-file 'custom-version "21.1")
(custom-put-if-not 'gnus-read-newsrc-file 'standard-value t)
(custom-put-if-not 'recentf 'custom-version "21.1")
(custom-put-if-not 'vc-dired-terse-display 'standard-value t)
(custom-put-if-not 'server-kill-new-buffers 'custom-version "21.1")
(custom-put-if-not 'server-kill-new-buffers 'standard-value t)
+(custom-put-if-not 'vc-cvs-sticky-date-format-string 'custom-version "21.3")
+(custom-put-if-not 'vc-cvs-sticky-date-format-string 'standard-value t)
(custom-put-if-not 'speedbar-hide-button-brackets-flag 'custom-version "21.1")
(custom-put-if-not 'speedbar-hide-button-brackets-flag 'standard-value t)
(custom-put-if-not 'delphi 'custom-version "21.1")
(custom-put-if-not 'eval-expression-print-level 'custom-version "21.1")
(custom-put-if-not 'eval-expression-print-level 'standard-value t)
-(defvar custom-versions-load-alist '((20.3 "xscheme") ("20.3.3" "dos-vars") (21.1 "ange-ftp") ("21.3" "replace") ("20.4" "files" "help" "sh-script" "compile") (21.3 "ange-ftp") ("21.2" "add-log" "sgml-mode") ("20.3" "desktop" "easymenu" "hscroll" "dabbrev" "ffap" "rmail" "paren" "mailabbrev" "frame" "uce" "mouse" "diary-lib" "sendmail" "simple" "debug" "hexl" "vcursor" "vc" "compile" "etags" "help-mode" "browse-url" "add-log" "find-func" "cus-edit" "replace") ("21.1" "server" "debug" "rmailedit" "dabbrev" "isearch" "gnus-start" "mule" "hideshow" "sendmail" "paths" "sgml-mode" "net-utils" "cperl-mode" "rmail" "font-lock" "gnus-nocem" "vc-hooks" "paren" "faces" "fortran" "vc" "etags" "cus-edit" "frame" "vc-sccs" "gnus-group" "gnus-sum" "add-log" "find-func" "wid-edit" "smtpmail" "vc-rcs" "files" "nnmail" "message" "ps-print" "vc-cvs" "simple" "gnus-agent" "flyspell" "gnus-art" "browse-url" "speedbar") ("20.8" "sql"))
+(defvar custom-versions-load-alist '((20.3 "xscheme") ("20.3.3" "dos-vars") (21.1 "ange-ftp") ("20.4" "files" "help" "sh-script" "compile") ("21.2" "add-log" "sgml-mode") ("21.3" "vc-cvs" "replace" "ange-ftp") (21.3 "ange-ftp") ("20.3" "desktop" "easymenu" "hscroll" "dabbrev" "ffap" "rmail" "paren" "mailabbrev" "frame" "uce" "mouse" "diary-lib" "sendmail" "simple" "debug" "hexl" "vcursor" "vc" "compile" "etags" "help-mode" "browse-url" "add-log" "find-func" "cus-edit" "replace") ("21.1" "server" "debug" "rmailedit" "dabbrev" "isearch" "gnus-start" "mule" "hideshow" "sendmail" "paths" "sgml-mode" "net-utils" "cperl-mode" "rmail" "font-lock" "gnus-nocem" "vc-hooks" "paren" "faces" "vc-rcs" "fortran" "vc" "etags" "cus-edit" "vc-sccs" "gnus-group" "gnus-sum" "add-log" "find-func" "frame" "wid-edit" "smtpmail" "files" "nnmail" "message" "ps-print" "vc-cvs" "simple" "gnus-agent" "flyspell" "gnus-art" "browse-url" "speedbar") ("20.8" "sql"))
"For internal use by custom.")
(provide 'cus-load)
;; Interface to ediff-make-fine-diffs. Checks for auto-refine limit, etc.
(defun ediff-install-fine-diff-if-necessary (n)
- (cond ((eq ediff-auto-refine 'on)
+ (cond ((and (eq ediff-auto-refine 'on)
+ ediff-use-faces
+ (not (eq ediff-highlighting-style 'off))
+ (not (eq ediff-highlighting-style 'ascii)))
(if (and
(> ediff-auto-refine-limit
(- (ediff-get-diff-posn 'A 'end n)
(defvar ediff-forward-word-function 'ediff-forward-word
"*Function to call to move to the next word.
Used for splitting difference regions into individual words.")
+(make-variable-buffer-local 'ediff-forward-word-function)
(defvar ediff-whitespace " \n\t\f"
"*Characters constituting white space.
These characters are ignored when differing regions are split into words.")
+(make-variable-buffer-local 'ediff-whitespace)
(defvar ediff-word-1
(ediff-cond-compile-for-xemacs-or-emacs "a-zA-Z---_" "-[:word:]_")
"*Characters that constitute words of type 1.
More precisely, [ediff-word-1] is a regexp that matches type 1 words.
See `ediff-forward-word' for more details.")
+(make-variable-buffer-local 'ediff-word-1)
(defvar ediff-word-2 "0-9.,"
"*Characters that constitute words of type 2.
More precisely, [ediff-word-2] is a regexp that matches type 2 words.
See `ediff-forward-word' for more details.")
+(make-variable-buffer-local 'ediff-word-2)
(defvar ediff-word-3 "`'?!:;\"{}[]()"
"*Characters that constitute words of type 3.
More precisely, [ediff-word-3] is a regexp that matches type 3 words.
See `ediff-forward-word' for more details.")
+(make-variable-buffer-local 'ediff-word-3)
(defvar ediff-word-4
(concat "^" ediff-word-1 ediff-word-2 ediff-word-3 ediff-whitespace)
"*Characters that constitute words of type 4.
More precisely, [ediff-word-4] is a regexp that matches type 4 words.
See `ediff-forward-word' for more details.")
+(make-variable-buffer-local 'ediff-word-4)
;; Split region along word boundaries. Each word will be on its own line.
;; Output to buffer out-buffer.
(ediff-force-faces)
((ediff-color-display-p))
(ediff-emacs-p (memq (ediff-device-type) '(pc)))
- (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))))
+ (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))
+ ))
;; toolbar support for emacs hasn't been implemented in ediff
(defun ediff-has-toolbar-support-p ()
ediff-merge-revisions-with-ancestor)))
(ediff-defvar-local ediff-merge-job nil "")
+(defmacro ediff-patch-job ()
+ `(eq ediff-job-name 'epatch))
+
(defmacro ediff-merge-with-ancestor-job ()
`(memq
ediff-job-name
:type 'boolean
:group 'ediff-highlighting)
-;; A var local to each control panel buffer. Indicates highlighting style
-;; in effect for this buffer: `face', `ascii', nil -- temporarily
-;; unhighlighted, `off' -- turned off \(on a dumb terminal only\).
-(ediff-defvar-local ediff-highlighting-style nil "")
-
;; The suffix of the control buffer name.
(ediff-defvar-local ediff-control-buffer-suffix nil "")
(error nil)))
+;; A var local to each control panel buffer. Indicates highlighting style
+;; in effect for this buffer: `face', `ascii',
+;; `off' -- turned off \(on a dumb terminal only\).
+(ediff-defvar-local ediff-highlighting-style
+ (if (and (ediff-has-face-support-p) ediff-use-faces) 'face 'ascii)
+ "")
+
+
(if (ediff-has-face-support-p)
(ediff-cond-compile-for-xemacs-or-emacs
(progn ; xemacs
;; 3. Provide a list of pairs or triples of file names (or buffers,
;; depending on the particular Ediff operation you want to invoke)
;; in the following format:
-;; (descriptor-header (nil nil (obj1 nil) (obj2 nil) (obj3 nil))
+;; (HEADER (nil nil (obj1 nil) (obj2 nil) (obj3 nil))
;; (...) ...)
;; The function ediff-make-new-meta-list-element can be used to create
-;; 2nd and subsequent elements of that list.
-;; Actually, the format of this list is pretty much up to the
-;; developer. The only thing is that it must be a list of lists,
-;; and the first list must describe the meta session, and subsequent
-;; elements must describe individual sessions.
-;; This descriptor-header must be a list of SIX elements (nil or
-;; string). The function ediff-redraw-registry-buffer displays the
+;; 2nd and subsequent elements of that list (i.e., after the
+;; description header). See ediff-make-new-meta-list-element for the
+;; explanation of the two nil placeholders in such elements.
+;;
+;; There is API for extracting the components of the members of the
+;; above list. Search for `API for ediff-meta-list' for details.
+;;
+;; HEADER must be a list of SIX elements (nil or string):
+;; (regexp metaobj1 metaobj2 metaobj3 merge-save-buffer
+;; comparison-function)
+;; The function ediff-redraw-registry-buffer displays the
;; 1st - 4th of these in the registry buffer.
+;; For some jobs some of the members of the header might be nil.
+;; The meaning of metaobj1, metaobj2, and metaobj3 depend on the job.
+;; Typically these are directories where the files to be compared are
+;; found.
;; Also, keep in mind that the function ediff-prepare-meta-buffer
;; (which see) prepends the session group buffer to the descriptor, so
;; the descriptor becomes 7-long.
;; to any of Ediff major entries (such as ediff-files, epatch, etc.).
;; See how this is done in ediff-filegroup-action.
;;
-;; Session descriptions are of the form (obj1 obj2 obj3), which
-;; describe objects relevant to the session. Usually they are names of
-;; files, but sometimes they may be other things. For instance, obj3
-;; is nil for jobs that involve only two files. For patch jobs, obj2
-;; and obj3 are markers that specify the patch corresponding to the
-;; file (whose name is obj1).
+;; Session descriptions are of the form
+;; (nil nil (obj1 . nil) (obj2 . nil) (obj3 . nil))
+;; which describe the objects relevant to the session.
+;; Use ediff-make-new-meta-list-element to create these things.
+;; Usually obj1/2/3 are names of files, but they may also be other
+;; things for some jobs. For instance, obj3 is nil for jobs that
+;; involve only two files. For patch jobs, obj2 and obj3 are markers
+;; that specify the patch corresponding to the file
+;; (whose name is obj1).
+;; The nil's are placeholders, which are used internally by ediff.
;; 4. Write a function that makes a call to ediff-prepare-meta-buffer
;; passing all this info.
;; You may be able to use ediff-directories-internal as a template.
(nth 3 elt))
(defsubst ediff-get-session-objC (elt)
(nth 4 elt))
+;; Take the "name" component of the object into acount. ObjA/C/B is of the form
+;; (name . equality-indicator)
(defsubst ediff-get-session-objA-name (elt)
(car (nth 2 elt)))
(defsubst ediff-get-session-objB-name (elt)
;; Create a new element for the meta list out of obj1/2/3, which usually are
;; files
;;
-;; The first nil in such an is later replaced with the session buffer. The
-;; second nil is reserved for session status.
+;; The first nil in such an element is later replaced with the session buffer.
+;; The second nil is reserved for session status.
;;
;; Also, session objects A/B/C are turned into lists of the form (obj nil).
-;; This nill is a placeholder for eq-indicator. It is either nil or =.
+;; This nil is a placeholder for eq-indicator. It is either nil or =.
;; If it is discovered that this file is = to some other
;; file in the same session, eq-indicator is changed to `='.
;; Curently, the eq-indicator is used only for 2 and 3-file jobs.
(defun ediff-make-new-meta-list-element (obj1 obj2 obj3)
(list nil nil (list obj1 nil) (list obj2 nil) (list obj3 nil)))
+;; Constructs a meta list header.
+;; OBJA, OBJB, OBJC are usually directories involved, but can be different for
+;; different jobs. For instance, multifile patch has only OBJA, which is the
+;; patch buffer.
+(defun ediff-make-new-meta-list-header (regexp
+ objA objB objC
+ merge-auto-store-dir
+ comparison-func)
+ (list regexp objA objB objC merge-auto-store-dir comparison-func))
+
;; The activity marker is either or + (active session, i.e., ediff is currently
;; run in it), or - (finished session, i.e., we've ran ediff in it and then
;; exited). Return nil, if session is neither active nor finished
;; If a file is a directory in dir1 but not dir2 (or vice versa), it is not
;; included in the intersection. However, a regular file that is a dir in dir3
;; is included, since dir3 files are supposed to be ancestors for merging.
-;; Returns a list of the form:
-;; (DIFF-LIST META-HEADER (f1 f2 f3) (f1 f2 f3) ...)
-;; dir3, f3 can be nil if intersecting only 2 directories.
;; If COMPARISON-FUNC is given, use it. Otherwise, use string=
+;;
+;; Returns a list of the form:
+;; (COMMON-PART DIFF-LIST)
+;; COMMON-PART is car and DIFF-LIST is cdr.
+;;
+;; COMMON-PART is of the form:
+;; (META-HEADER (f1 f2 f3) (f1 f2 f3) ...)
+;; f3 can be nil if intersecting only 2 directories.
+;; Each triple (f1 f2 f3) represents the files to be compared in the
+;; corresponding ediff subsession.
+;;
;; DIFF-LIST is of the form:
;; (META-HEADER (file . num) (file . num)...)
;; where num encodes the set of dirs where the file is found:
;; 2 - only dir1; 3 - only dir2; 5 - only dir3; 6 - dir1&2; 10 - dir1&3; etc.
-;; META-HEADER is of the form
-;; It contains the meta info about this ediff operation
+;; META-HEADER:
+;; Contains the meta info about this ediff operation
;; (regexp dir1 dir2 dir3 merge-auto-store-dir comparison-func)
;; Later the meta-buffer is prepended to this list.
+;;
+;; Some operations might use a different meta header. For instance,
+;; ediff-multifile-patch doesn't have dir2 and dir3, and regexp,
+;; comparison-func don't apply.
+;;
(defun ediff-intersect-directories (jobname
regexp dir1 dir2
&optional
difflist)
(setq difflist (cons
;; diff metalist header
- (list regexp
- auxdir1 auxdir2 auxdir3
- merge-autostore-dir
- comparison-func)
+ (ediff-make-new-meta-list-header regexp
+ auxdir1 auxdir2 auxdir3
+ merge-autostore-dir
+ comparison-func)
difflist))
(setq common-part
(cons
;; metalist header
- (list regexp
- auxdir1 auxdir2 auxdir3
- merge-autostore-dir
- comparison-func)
+ (ediff-make-new-meta-list-header regexp
+ auxdir1 auxdir2 auxdir3
+ merge-autostore-dir
+ comparison-func)
(mapcar
(lambda (elt)
(ediff-make-new-meta-list-element
(cons
;; header -- has 6 elements. Meta buffer is prepended later by
;; ediff-prepare-meta-buffer
- (list regexp auxdir1 nil nil merge-autostore-dir nil)
+ (ediff-make-new-meta-list-header regexp
+ auxdir1 nil nil
+ merge-autostore-dir nil)
(mapcar (lambda (elt) (ediff-make-new-meta-list-element
(concat auxdir1 elt) nil nil))
common))
(or (ediff-buffer-live-p session-buf) ; either an active patch session
(null session-buf) ; or it is a virgin session
(error
- "Patch has been already applied to this file--cannot be repeated!"))
+ "Patch has already been applied to this file -- can't repeat!"))
(ediff-with-current-buffer meta-patchbuf
(save-restriction
(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)
(load "ediff.el" nil nil 'nosuffix))
))
count)))
;; Scan BUF (which is supposed to contain a patch) and make a list of the form
-;; ((filename1 marker1 marker2) (filename2 marker1 marker2) ...)
-;; where filenames are files to which patch would have applied the patch;
-;; marker1 delimits the beginning of the corresponding patch and marker2 does
-;; it for the end. This list is then assigned to ediff-patch-map.
-;; Returns the number of elements in the list ediff-patch-map
+;; ((nil nil filename-spec1 marker1 marker2)
+;; (nil nil filename-spec2 marker1 marker2) ...)
+;; where filename-spec[12] are files to which the `patch' program would
+;; have applied the patch.
+;; nin, nil are placeholders. See ediff-make-new-meta-list-element in
+;; ediff-meta.el for the explanations.
+;; In the beginning we don't know exactly which files need to be patched.
+;; We usually come up with two candidates and ediff-file-name-sans-prefix
+;; resolves this later.
+;;
+;; The marker `marker1' delimits the beginning of the corresponding patch and
+;; `marker2' does it for the end.
+;; The result of ediff-map-patch-buffer is a list, which is then assigned
+;; to ediff-patch-map.
+;; The function returns the number of elements in the list ediff-patch-map
(defun ediff-map-patch-buffer (buf)
(ediff-with-current-buffer buf
(let ((count 0)
end2 (or (match-end 3) (match-end 5)))
;; possible-file-names is holding the new file names until we
;; insert the old file name in the patch map
- ;; It is a pair (filename from 1st header line . fn from 2nd line)
+ ;; It is a pair
+ ;; (filename-from-1st-header-line . fn from 2nd line)
(setq possible-file-names
(cons (if (and beg1 end1)
(buffer-substring beg1 end1)
(goto-char mark2-end)
(if filenames
- (setq patch-map (cons (list filenames mark1 mark2) patch-map)))
+ (setq patch-map
+ (cons (ediff-make-new-meta-list-element
+ filenames mark1 mark2)
+ patch-map)))
(setq mark1 mark2
mark1-end mark2-end
filenames possible-file-names))
(setq opoint (point)
count (1+ count))))
(setq mark2 (point-max-marker)
- patch-map (cons (list possible-file-names mark1 mark2) patch-map))
+ patch-map (cons (ediff-make-new-meta-list-element
+ possible-file-names mark1 mark2)
+ patch-map))
(setq ediff-patch-map (nreverse patch-map))
count)))
;; directory part of filename
(file-name-as-directory filename)
(file-name-directory filename)))
+ ;; Filename-spec is objA; at this point it is represented as
+ ;; (file1 . file2). We get it using ediff-get-session-objA
;; directory part of the first file in the patch
- (base-dir1 (file-name-directory (car (car (car ediff-patch-map)))))
- (base-dir2 (file-name-directory (cdr (car (car ediff-patch-map)))))
+ (base-dir1 (file-name-directory
+ (car (ediff-get-session-objA-name (car ediff-patch-map)))))
+ ;; directory part of the 2nd file in the patch
+ (base-dir2 (file-name-directory
+ (cdr (ediff-get-session-objA-name (car ediff-patch-map)))))
)
;; chop off base-dirs
- (mapcar (lambda (triple)
- (or (string= (car (car triple)) "/dev/null")
- (setcar (car triple)
- (ediff-file-name-sans-prefix
- (car (car triple)) base-dir1)))
- (or (string= (cdr (car triple)) "/dev/null")
- (setcdr (car triple)
+ (mapcar (lambda (session-info)
+ (let ((proposed-file-names
+ (ediff-get-session-objA-name session-info)))
+ (or (string= (car proposed-file-names) "/dev/null")
+ (setcar proposed-file-names
+ (ediff-file-name-sans-prefix
+ (car proposed-file-names) base-dir1)))
+ (or (string=
+ (cdr proposed-file-names) "/dev/null")
+ (setcdr proposed-file-names
(ediff-file-name-sans-prefix
- (cdr (car triple)) base-dir2)))
- )
+ (cdr proposed-file-names) base-dir2)))
+ ))
ediff-patch-map)
;; take the given file name into account
(or (file-directory-p filename)
(string= "/dev/null" filename)
- (progn
- (setcar (car ediff-patch-map)
- (cons (file-name-nondirectory filename)
- (file-name-nondirectory filename)))))
+ (setcar (ediff-get-session-objA (car ediff-patch-map))
+ (cons (file-name-nondirectory filename)
+ (file-name-nondirectory filename))))
;; prepend actual-dir
- (mapcar (lambda (triple)
- (if (and (string-match "^/null/" (car (car triple)))
- (string-match "^/null/" (cdr (car triple))))
- ;; couldn't strip base-dir1 and base-dir2
- ;; hence, something wrong
- (progn
- (with-output-to-temp-buffer ediff-msg-buffer
- (ediff-with-current-buffer standard-output
- (fundamental-mode))
- (princ
- (format "
+ (mapcar (lambda (session-info)
+ (let ((proposed-file-names
+ (ediff-get-session-objA-name session-info)))
+ (if (and (string-match "^/null/" (car proposed-file-names))
+ (string-match "^/null/" (cdr proposed-file-names)))
+ ;; couldn't strip base-dir1 and base-dir2
+ ;; hence, something is wrong
+ (progn
+ (with-output-to-temp-buffer ediff-msg-buffer
+ (ediff-with-current-buffer standard-output
+ (fundamental-mode))
+ (princ
+ (format "
The patch file contains a context diff for
%s
%s
If you don't know and still would like to apply patches to
other files, enter /dev/null
"
- (substring (car (car triple)) 6)
- (substring (cdr (car triple)) 6))))
- (let ((directory t)
- user-file)
- (while directory
- (setq user-file
- (read-file-name
- "Please enter file name: "
- actual-dir actual-dir t))
- (if (not (file-directory-p user-file))
- (setq directory nil)
- (setq directory t)
- (beep)
- (message "%s is a directory" user-file)
- (sit-for 2)))
- (setcar triple (cons user-file user-file))))
- (setcar (car triple)
- (expand-file-name
- (concat actual-dir (car (car triple)))))
- (setcdr (car triple)
- (expand-file-name
- (concat actual-dir (cdr (car triple))))))
- )
+ (substring (car proposed-file-names) 6)
+ (substring (cdr proposed-file-names) 6))))
+ (let ((directory t)
+ user-file)
+ (while directory
+ (setq user-file
+ (read-file-name
+ "Please enter file name: "
+ actual-dir actual-dir t))
+ (if (not (file-directory-p user-file))
+ (setq directory nil)
+ (setq directory t)
+ (beep)
+ (message "%s is a directory" user-file)
+ (sit-for 2)))
+ (setcar (ediff-get-session-objA session-info)
+ (cons user-file user-file))))
+ (setcar proposed-file-names
+ (expand-file-name
+ (concat actual-dir (car proposed-file-names))))
+ (setcdr proposed-file-names
+ (expand-file-name
+ (concat actual-dir (cdr proposed-file-names)))))
+ ))
ediff-patch-map)
;; check for the shorter existing file in each pair and discard the other
;; one
- (mapcar (lambda (triple)
- (let* ((file1 (car (car triple)))
- (file2 (cdr (car triple)))
+ (mapcar (lambda (session-info)
+ (let* ((file1 (car (ediff-get-session-objA-name session-info)))
+ (file2 (cdr (ediff-get-session-objA-name session-info)))
+ (session-file-object
+ (ediff-get-session-objA session-info))
(f1-exists (file-exists-p file1))
(f2-exists (file-exists-p file2)))
(cond
((and (< (length file2) (length file1))
f2-exists)
- (setcar triple file2))
+ ;; replace file-pair with the winning file2
+ (setcar session-file-object file2))
((and (< (length file1) (length file2))
f1-exists)
- (setcar triple file1))
+ ;; replace file-pair with the winning file1
+ (setcar session-file-object file1))
((and f1-exists f2-exists
(string= file1 file2))
- (setcar triple file1))
+ (setcar session-file-object file1))
((and f1-exists f2-exists)
(with-output-to-temp-buffer ediff-msg-buffer
(ediff-with-current-buffer standard-output
Type `n' to use %s as the target.
"
file1 file2 file2 file1)))
- (setcar triple
+ (setcar session-file-object
(if (y-or-n-p (format "Use %s ? " file2))
file2 file1)))
- (f2-exists (setcar triple file2))
- (f1-exists (setcar triple file1))
+ (f2-exists (setcar session-file-object file2))
+ (f1-exists (setcar session-file-object file1))
(t
(with-output-to-temp-buffer ediff-msg-buffer
(ediff-with-current-buffer standard-output
(beep)
(message "%s is a directory" target)
(sit-for 2)))
- (setcar triple target))))))
+ (setcar session-file-object target))))))
ediff-patch-map)
))
(ediff-patch-file-internal
patch-buf
(if (and ediff-patch-map
- (not (string-match "^/dev/null" (car (car ediff-patch-map))))
- (> (length (car (car ediff-patch-map))) 1))
- (car (car ediff-patch-map))
+ (not (string-match
+ "^/dev/null"
+ ;; this is the file to patch
+ (ediff-get-session-objA-name (car ediff-patch-map))))
+ (> (length
+ (ediff-get-session-objA-name (car ediff-patch-map)))
+ 1))
+ (ediff-get-session-objA-name (car ediff-patch-map))
filename)
startup-hooks)
(ediff-multi-patch-internal patch-buf startup-hooks))
(setq meta-buf (ediff-prepare-meta-buffer
'ediff-filegroup-action
(ediff-with-current-buffer patch-buf
- ;; nil replaces a regular expression
- (cons (list nil (format "%S" patch-buf))
+ (cons (ediff-make-new-meta-list-header
+ nil ; regexp
+ (format "%S" patch-buf) ; obj A
+ nil nil ; objects B,C
+ nil ; merge-auto-store-dir
+ nil ; comparison-func
+ )
ediff-patch-map))
"*Ediff Session Group Panel"
'ediff-redraw-directory-group-buffer
(define-key ediff-mode-map "wb" 'ediff-save-buffer)
(define-key ediff-mode-map "wd" 'ediff-save-buffer)
(define-key ediff-mode-map "=" 'ediff-inferior-compare-regions)
- (if (fboundp 'ediff-show-patch-diagnostics)
+ (if (and (fboundp 'ediff-show-patch-diagnostics) (ediff-patch-job))
(define-key ediff-mode-map "P" 'ediff-show-patch-diagnostics))
(if ediff-3way-job
(progn
On a dumb terminal, switches between ASCII highlighting and no highlighting."
(interactive)
(ediff-barf-if-not-control-buffer)
- (if (not (ediff-has-face-support-p))
- (if (eq ediff-highlighting-style 'ascii)
- (progn
- (message "ASCII highlighting flags removed")
- (ediff-unselect-and-select-difference ediff-current-difference
- 'unselect-only)
- (setq ediff-highlighting-style 'off))
- (ediff-unselect-and-select-difference ediff-current-difference
- 'select-only))
- (ediff-unselect-and-select-difference ediff-current-difference
- 'unselect-only)
- ;; cycle through highlighting
- (cond ((and ediff-use-faces ediff-highlight-all-diffs)
- (message "Unhighlighting unselected difference regions")
- (setq ediff-highlight-all-diffs nil))
- (ediff-use-faces
- (message "Highlighting with ASCII flags")
- (setq ediff-use-faces nil))
- (t
- (message "Re-highlighting all difference regions")
- (setq ediff-use-faces t
- ediff-highlight-all-diffs t)))
-
- (if (and ediff-use-faces ediff-highlight-all-diffs)
- (ediff-paint-background-regions)
- (ediff-paint-background-regions 'unhighlight))
-
- (ediff-unselect-and-select-difference
- ediff-current-difference 'select-only))
- )
+
+ (ediff-unselect-and-select-difference
+ ediff-current-difference 'unselect-only)
+ ;; cycle through highlighting
+ (cond ((and ediff-use-faces
+ (ediff-has-face-support-p)
+ ediff-highlight-all-diffs)
+ (message "Unhighlighting unselected difference regions")
+ (setq ediff-highlight-all-diffs nil
+ ediff-highlighting-style 'face))
+ ((or (and ediff-use-faces (ediff-has-face-support-p)
+ (eq ediff-highlighting-style 'face)) ; has face support
+ (and (not (ediff-has-face-support-p)) ; no face support
+ (eq ediff-highlighting-style 'off)))
+ (message "Highlighting with ASCII flags")
+ (setq ediff-highlighting-style 'ascii
+ ediff-highlight-all-diffs nil
+ ediff-use-faces nil))
+ ((eq ediff-highlighting-style 'ascii)
+ (message "ASCII highlighting flags removed")
+ (setq ediff-highlighting-style 'off
+ ediff-highlight-all-diffs nil))
+ ((ediff-has-face-support-p) ; catch-all for cases with face support
+ (message "Re-highlighting all difference regions")
+ (setq ediff-use-faces t
+ ediff-highlighting-style 'face
+ ediff-highlight-all-diffs t)))
+
+ (if (and ediff-use-faces ediff-highlight-all-diffs)
+ (ediff-paint-background-regions)
+ (ediff-paint-background-regions 'unhighlight))
+
+ (ediff-unselect-and-select-difference
+ ediff-current-difference 'select-only))
(defun ediff-toggle-autorefine ()
(ediff-buffer-live-p ediff-buffer-B)
(ediff-valid-difference-p n))
(progn
- (if (and (ediff-has-face-support-p) ediff-use-faces)
- (progn
- (ediff-highlight-diff n)
- (setq ediff-highlighting-style 'face))
- (setq ediff-highlighting-style 'ascii)
- (ediff-place-flags-in-buffer
- 'A ediff-buffer-A ediff-control-buffer n)
- (ediff-place-flags-in-buffer
- 'B ediff-buffer-B ediff-control-buffer n)
- (if ediff-3way-job
- (ediff-place-flags-in-buffer
- 'C ediff-buffer-C ediff-control-buffer n))
- (if (ediff-buffer-live-p ediff-ancestor-buffer)
- (ediff-place-flags-in-buffer
- 'Ancestor ediff-ancestor-buffer
- ediff-control-buffer n))
- )
+ (cond
+ ((and (ediff-has-face-support-p) ediff-use-faces)
+ (ediff-highlight-diff n))
+ ((eq ediff-highlighting-style 'ascii)
+ (ediff-place-flags-in-buffer
+ 'A ediff-buffer-A ediff-control-buffer n)
+ (ediff-place-flags-in-buffer
+ 'B ediff-buffer-B ediff-control-buffer n)
+ (if ediff-3way-job
+ (ediff-place-flags-in-buffer
+ 'C ediff-buffer-C ediff-control-buffer n))
+ (if (ediff-buffer-live-p ediff-ancestor-buffer)
+ (ediff-place-flags-in-buffer
+ 'Ancestor ediff-ancestor-buffer
+ ediff-control-buffer n))
+ ))
(ediff-install-fine-diff-if-necessary n)
(run-hooks 'ediff-select-hook))))
ediff-ancestor-buffer
(ediff-get-diff-overlay n 'Ancestor)))
))
- (setq ediff-highlighting-style nil)
;; unhighlight fine diffs
(ediff-set-fine-diff-properties ediff-current-difference 'default)
(setq ediff-current-difference n)
) ; end protected section
- (ediff-with-current-buffer control-buf (ediff-refresh-mode-lines))
- )))
+ (ediff-with-current-buffer control-buf (ediff-refresh-mode-lines)))
+ ))
)
(save-buffer)))
+
+;; idea suggested by Hannu Koivisto <azure@iki.fi>
+(defun ediff-clone-buffer-for-region-comparison (buff region-name)
+ (let ((cloned-buff (ediff-make-cloned-buffer buff region-name))
+ (wind (ediff-get-visible-buffer-window buff))
+ (pop-up-windows t)
+ other-wind
+ msg-buf)
+ (ediff-with-current-buffer cloned-buff
+ (setq ediff-temp-indirect-buffer t))
+ (if (window-live-p wind)
+ (set-window-buffer wind cloned-buff))
+ (pop-to-buffer cloned-buff)
+ (with-temp-buffer
+ (erase-buffer)
+ (insert
+ (format "\n ******* Mark a region in buffer %s *******\n"
+ (buffer-name cloned-buff)))
+ (insert
+ (format "\n\t When done, type %s Use %s to abort\n "
+ (ediff-format-bindings-of 'exit-recursive-edit)
+ (ediff-format-bindings-of 'abort-recursive-edit)))
+ (goto-char (point-min))
+ (setq msg-buf (current-buffer))
+ (other-window 1)
+ (set-window-buffer (selected-window) msg-buf)
+ (shrink-window-if-larger-than-buffer)
+ (if (window-live-p wind)
+ (select-window wind))
+ (condition-case nil
+ (recursive-edit)
+ (quit
+ (ediff-kill-buffer-carefully cloned-buff)))
+ )
+ cloned-buff))
+
+
+(defun ediff-clone-buffer-for-window-comparison (buff wind region-name)
+ (let ((cloned-buff (ediff-make-cloned-buffer buff region-name)))
+ (ediff-with-current-buffer cloned-buff
+ (setq ediff-temp-indirect-buffer t))
+ (set-window-buffer wind cloned-buff)
+ cloned-buff))
+
+(defun ediff-clone-buffer-for-current-diff-comparison (buff buf-type reg-name)
+ (let ((cloned-buff (ediff-make-cloned-buffer buff reg-name))
+ (reg-start (ediff-get-diff-posn buf-type 'beg))
+ (reg-end (ediff-get-diff-posn buf-type 'end)))
+ (ediff-with-current-buffer cloned-buff
+ ;; set region to be the current diff region
+ (goto-char reg-start)
+ (set-mark reg-end)
+ (setq ediff-temp-indirect-buffer t))
+ cloned-buff))
+
+
+
+(defun ediff-make-cloned-buffer (buff region-name)
+ (ediff-make-indirect-buffer
+ buff (concat
+ (if (stringp buff) buff (buffer-name buff))
+ region-name (symbol-name (gensym)))))
+
+
+(defun ediff-make-indirect-buffer (base-buf indirect-buf-name)
+ (ediff-cond-compile-for-xemacs-or-emacs
+ (make-indirect-buffer base-buf indirect-buf-name) ; xemacs
+ (make-indirect-buffer base-buf indirect-buf-name 'clone) ; emacs
+ ))
+
+
;; This function operates only from an ediff control buffer
(defun ediff-compute-custom-diffs-maybe ()
(let ((buf-A-file-name (buffer-file-name ediff-buffer-A))
(zmacs-regions t)
(ctl-buf (current-buffer))
quit-now
+ use-current-diff-p
begA begB endA endB bufA bufB)
+ (if (ediff-valid-difference-p ediff-current-difference)
+ (progn
+ (ediff-set-fine-diff-properties ediff-current-difference 'default)
+ (ediff-unhighlight-diff)))
+ (ediff-paint-background-regions 'unhighlight)
+
(cond ((ediff-merge-job)
(setq bufB ediff-buffer-C)
;; ask which buffer to compare to the merge buffer
bufB ediff-buffer-B
possibilities nil)))
- (setq bufA (ediff-clone-buffer-for-region-comparison
- (buffer-name bufA) "-Region.A-"))
+ (if (and (ediff-valid-difference-p ediff-current-difference)
+ (y-or-n-p "Compare currently highlighted difference regions? "))
+ (setq use-current-diff-p t))
+
+ (setq bufA (if use-current-diff-p
+ (ediff-clone-buffer-for-current-diff-comparison
+ bufA 'A "-Region.A-")
+ (ediff-clone-buffer-for-region-comparison bufA "-Region.A-")))
(ediff-with-current-buffer bufA
(setq begA (region-beginning)
endA (region-end))
(or (eobp) (forward-char)) ; include the newline char
(setq endA (point)))
- (setq bufB (ediff-clone-buffer-for-region-comparison
- (buffer-name bufB) "-Region.B-"))
+ (setq bufB (if use-current-diff-p
+ (ediff-clone-buffer-for-current-diff-comparison
+ bufB 'B "-Region.B-")
+ (ediff-clone-buffer-for-region-comparison bufB "-Region.B-")))
(ediff-with-current-buffer bufB
(setq begB (region-beginning)
endB (region-end))
(or (eobp) (forward-char)) ; include the newline char
(setq endB (point)))
+
(ediff-regions-internal
bufA begA endA bufB begB endB
- nil ; setup-hook
- 'ediff-regions-linewise ; job name
- nil ; no word mode
+ nil ; setup-hook
+ (if use-current-diff-p ; job name
+ 'ediff-regions-wordwise
+ 'ediff-regions-linewise)
+ (if use-current-diff-p ; word mode, if diffing current diff
+ t nil)
;; setup param to pass to ediff-setup
(list (cons 'ediff-split-window-function ediff-split-window-function)))
))
buffer-A beg-A end-A buffer-B beg-B end-B
startup-hooks job-name word-mode nil)))
-;; Suggested by Hannu Koivisto <azure@iki.fi>
-(defun ediff-clone-buffer-for-region-comparison (buff-name region-name)
- (let ((cloned-buff (ediff-make-indirect-buffer
- buff-name
- (concat buff-name region-name
- (symbol-name (gensym)))))
- (wind (ediff-get-visible-buffer-window buff-name))
- (pop-up-windows t)
- other-wind
- msg-buf)
- (ediff-with-current-buffer cloned-buff
- (setq ediff-temp-indirect-buffer t))
- (if (window-live-p wind)
- (set-window-buffer wind cloned-buff))
- (pop-to-buffer cloned-buff)
- (with-temp-buffer
- (erase-buffer)
- (insert
- (format "\n ******* Mark a region in buffer %s *******\n"
- (buffer-name cloned-buff)))
- (insert
- (format "\n\t When done, type %s Use %s to abort\n "
- (ediff-format-bindings-of 'exit-recursive-edit)
- (ediff-format-bindings-of 'abort-recursive-edit)))
- (goto-char (point-min))
- (setq msg-buf (current-buffer))
- (other-window 1)
- (set-window-buffer (selected-window) msg-buf)
- (shrink-window-if-larger-than-buffer)
- (select-window wind)
- (recursive-edit)
- )
- cloned-buff))
-
-(defun ediff-clone-buffer-for-window-comparison (buff wind region-name)
- (let ((cloned-buff (ediff-make-indirect-buffer
- buff
- (concat (buffer-name buff)
- region-name (symbol-name (gensym))))))
- (ediff-with-current-buffer cloned-buff
- (setq ediff-temp-indirect-buffer t))
- (set-window-buffer wind cloned-buff)
- cloned-buff))
-
-(defun ediff-make-indirect-buffer (base-buf indirect-buf-name)
- (ediff-cond-compile-for-xemacs-or-emacs
- (make-indirect-buffer base-buf indirect-buf-name) ; xemacs
- (make-indirect-buffer base-buf indirect-buf-name 'clone) ; emacs
- ))
;;;###autoload
(defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks)
(setq rev1
(read-string
(format
- "Version 1 to merge (default: %s's latest version): "
+ "Version 1 to merge (default: %s's working version): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
rev2
(setq rev1
(read-string
(format
- "Version 1 to merge (default: %s's latest version): "
+ "Version 1 to merge (default: %s's working version): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
rev2
(let (rev1 rev2)
(setq rev1
(read-string
- (format "Version 1 to compare (default: %s's latest version): "
+ (format "Version 1 to compare (default: %s's working version): "
(file-name-nondirectory file)))
rev2
(read-string