Mercurial > hg > xemacs-beta
comparison lisp/ediff/ediff-init.el @ 12:bcdc7deadc19 r19-15b7
Import from CVS: tag r19-15b7
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:48:16 +0200 |
parents | 376386a54a3c |
children | 9ee227acff29 |
comparison
equal
deleted
inserted
replaced
11:91ffe8bd52e4 | 12:bcdc7deadc19 |
---|---|
60 (defun ediff-has-face-support-p () | 60 (defun ediff-has-face-support-p () |
61 (cond ((ediff-window-display-p)) | 61 (cond ((ediff-window-display-p)) |
62 (ediff-force-faces) | 62 (ediff-force-faces) |
63 (ediff-emacs-p (memq (ediff-device-type) '(pc))) | 63 (ediff-emacs-p (memq (ediff-device-type) '(pc))) |
64 (ediff-xemacs-p (memq (ediff-device-type) '(tty pc))))) | 64 (ediff-xemacs-p (memq (ediff-device-type) '(tty pc))))) |
65 | 65 |
66 | 66 |
67 ;; Defines SYMBOL as an advertised local variable. | 67 ;; Defines SYMBOL as an advertised local variable. |
68 ;; Performs a defvar, then executes `make-variable-buffer-local' on | 68 ;; Performs a defvar, then executes `make-variable-buffer-local' on |
69 ;; the variable. Also sets the `permanent-local' property, | 69 ;; the variable. Also sets the `permanent-local' property, |
70 ;; so that `kill-all-local-variables' (called by major-mode setting | 70 ;; so that `kill-all-local-variables' (called by major-mode setting |
71 ;; commands) won't destroy Ediff control variables. | 71 ;; commands) won't destroy Ediff control variables. |
280 ediff-merge-directories-with-ancestor | 280 ediff-merge-directories-with-ancestor |
281 ediff-merge-directory-revisions | 281 ediff-merge-directory-revisions |
282 ediff-merge-directory-revisions-with-ancestor | 282 ediff-merge-directory-revisions-with-ancestor |
283 ;; add more here | 283 ;; add more here |
284 ))) | 284 ))) |
285 (defsubst ediff-merge-metajob (&optional metajob) | |
286 (memq (or metajob ediff-metajob-name) | |
287 '(ediff-merge-directories | |
288 ediff-merge-directories-with-ancestor | |
289 ediff-merge-directory-revisions | |
290 ediff-merge-directory-revisions-with-ancestor | |
291 ediff-merge-filegroups-with-ancestor | |
292 ;; add more here | |
293 ))) | |
285 | 294 |
286 (defsubst ediff-metajob3 (&optional metajob) | 295 (defsubst ediff-metajob3 (&optional metajob) |
287 (memq (or metajob ediff-metajob-name) | 296 (memq (or metajob ediff-metajob-name) |
288 '(ediff-merge-directories-with-ancestor | 297 '(ediff-merge-directories-with-ancestor |
289 ediff-merge-filegroups-with-ancestor | 298 ediff-merge-filegroups-with-ancestor |
291 ediff-filegroups3))) | 300 ediff-filegroups3))) |
292 (defsubst ediff-comparison-metajob3 (&optional metajob) | 301 (defsubst ediff-comparison-metajob3 (&optional metajob) |
293 (memq (or metajob ediff-metajob-name) | 302 (memq (or metajob ediff-metajob-name) |
294 '(ediff-directories3 ediff-filegroups3))) | 303 '(ediff-directories3 ediff-filegroups3))) |
295 | 304 |
296 (defsubst ediff-barf-if-not-control-buffer (&optional meta-buf) | 305 ;; with no argument, checks if we are in ediff-control-buffer |
297 (or (eq (if meta-buf ediff-meta-buffer ediff-control-buffer) | 306 ;; with argument, checks if we are in ediff-meta-buffer |
298 (current-buffer)) | 307 (defun ediff-in-control-buffer-p (&optional meta-buf-p) |
308 (and (boundp 'ediff-control-buffer) | |
309 (eq (if meta-buf-p ediff-meta-buffer ediff-control-buffer) | |
310 (current-buffer)))) | |
311 | |
312 (defsubst ediff-barf-if-not-control-buffer (&optional meta-buf-p) | |
313 (or (ediff-in-control-buffer-p meta-buf-p) | |
299 (error "%S: This command runs in Ediff Control Buffer only!" | 314 (error "%S: This command runs in Ediff Control Buffer only!" |
300 this-command))) | 315 this-command))) |
301 | |
302 | 316 |
303 ;; Hook variables | 317 ;; Hook variables |
304 | 318 |
305 (defvar ediff-before-setup-windows-hook nil | 319 (defvar ediff-before-setup-windows-hook nil |
306 "*Hooks to run before Ediff sets its window configuration. | 320 "*Hooks to run before Ediff sets its window configuration. |
343 "*Hooks to run in the Ediff control buffer after finishing Ediff.") | 357 "*Hooks to run in the Ediff control buffer after finishing Ediff.") |
344 (defvar ediff-cleanup-hook nil | 358 (defvar ediff-cleanup-hook nil |
345 "*Hooks to run on exiting Ediff but before killing the control buffer. | 359 "*Hooks to run on exiting Ediff but before killing the control buffer. |
346 This is a place to do various cleanups, such as deleting the variant buffers. | 360 This is a place to do various cleanups, such as deleting the variant buffers. |
347 Ediff provides a function, `ediff-janitor', as one such possible hook.") | 361 Ediff provides a function, `ediff-janitor', as one such possible hook.") |
348 | 362 (defvar ediff-quit-merge-hook 'ediff-maybe-save-and-delete-merge |
349 | 363 "*Hooks to run before quitting a merge job. |
350 ;; Help messages | 364 The most common use is to save and delete the merge buffer.") |
351 | 365 |
352 (defconst ediff-long-help-message-head | |
353 " Moving around | Toggling features | Manipulations | |
354 =====================|===========================|=============================" | |
355 "The head of the full help message.") | |
356 (defconst ediff-long-help-message-tail | |
357 "=====================|===========================|============================= | |
358 R -show registry | | M -show session group | |
359 D -diff output | E -browse Ediff manual| G -send bug report | |
360 i -status info | ? -help off | z/q -suspend/quit | |
361 ------------------------------------------------------------------------------- | |
362 X,Y (x,y) on the left are meta-symbols for the keys A,B,C (a,b,c). | |
363 X,Y on the right are meta-symbols for buffers A,B,C. | |
364 A,B,C on the right denote the working buffers A,B,C, respectively." | |
365 "The tail of the full-help message.") | |
366 | |
367 (defconst ediff-long-help-message-compare3 | |
368 " | |
369 p,DEL -previous diff | | -vert/horiz split | xy -copy buf X's region to Y | |
370 n,SPC -next diff | h -hiliting | rx -restore buf X's old diff | |
371 j -jump to diff | @ -auto-refinement | * -refine current region | |
372 gx -goto X's point| | ! -update diff regions | |
373 C-l -recenter | ## -ignore whitespace | | |
374 v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X | |
375 </> -scroll lt/rt | X -read-only in buf X | wd -save diff output | |
376 | m -wide display | ~ -rotate buffers | |
377 " | |
378 "Help message usually used for 3-way comparison. | |
379 Normally, not a user option. See `ediff-help-message' for details.") | |
380 | |
381 (defconst ediff-long-help-message-compare2 | |
382 " | |
383 p,DEL -previous diff | | -vert/horiz split |a/b -copy A/B's region to B/A | |
384 n,SPC -next diff | h -hiliting | rx -restore buf X's old diff | |
385 j -jump to diff | @ -auto-refinement | * -refine current region | |
386 gx -goto X's point| | ! -update diff regions | |
387 C-l -recenter | ## -ignore whitespace | | |
388 v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X | |
389 </> -scroll lt/rt | X -read-only in buf X | wd -save diff output | |
390 ~ -swap variants | m -wide display | | |
391 " | |
392 "Help message usually used for 2-way comparison. | |
393 Normally, not a user option. See `ediff-help-message' for details.") | |
394 | |
395 (defconst ediff-long-help-message-narrow2 | |
396 " | |
397 p,DEL -previous diff | | -vert/horiz split |a/b -copy A/B's region to B/A | |
398 n,SPC -next diff | h -hiliting | rx -restore buf X's old diff | |
399 j -jump to diff | @ -auto-refinement | * -refine current region | |
400 gx -goto X's point| % -narrow/widen buffs | ! -update diff regions | |
401 C-l -recenter | ## -ignore whitespace | | |
402 v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X | |
403 </> -scroll lt/rt | X -read-only in buf X | wd -save diff output | |
404 ~ -swap variants | m -wide display | | |
405 " | |
406 "Help message when comparing windows or regions line-by-line. | |
407 Normally, not a user option. See `ediff-help-message' for details.") | |
408 | |
409 (defconst ediff-long-help-message-word-mode | |
410 " | |
411 p,DEL -previous diff | | -vert/horiz split | xy -copy buf X's region to Y | |
412 n,SPC -next diff | h -hiliting | rx -restore buf X's old diff | |
413 j -jump to diff | | | |
414 gx -goto X's point| % -narrow/widen buffs | ! -recompute diffs | |
415 C-l -recenter | | | |
416 v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X | |
417 </> -scroll lt/rt | X -read-only in buf X | wd -save diff output | |
418 ~ -swap variants | m -wide display | | |
419 " | |
420 "Help message when comparing windows or regions word-by-word. | |
421 Normally, not a user option. See `ediff-help-message' for details.") | |
422 | |
423 (defconst ediff-long-help-message-merge | |
424 " | |
425 p,DEL -previous diff | | -vert/horiz split | x -copy buf X's region to C | |
426 n,SPC -next diff | h -hiliting | r -restore buf C's old diff | |
427 j -jump to diff | @ -auto-refinement | * -refine current region | |
428 gx -goto X's point| ## -ignore whitespace | ! -update diff regions | |
429 C-l -recenter | #f/#h -focus/hide regions | + -combine diff regions | |
430 v/V -scroll up/dn | X -read-only in buf X | wx -save buf X | |
431 </> -scroll lt/rt | m -wide display | wd -save diff output | |
432 ~ -swap variants | s -shrink window C | / -show ancestor buff | |
433 | $ -show clashes only | & -merge w/new default | |
434 " | |
435 "Help message during merging. | |
436 Normally, not a user option. See `ediff-help-message' for details.") | |
437 | |
438 ;; The actual long help message. | |
439 (ediff-defvar-local ediff-long-help-message "" | |
440 "Normally, not a user option. See `ediff-help-message' for details.") | |
441 | |
442 (defconst ediff-brief-message-string | |
443 " ? - help " | |
444 "Contents of the brief help message.") | |
445 ;; The actual brief help message | |
446 (ediff-defvar-local ediff-brief-help-message "" | |
447 "Normally, not a user option. See `ediff-help-message' for details.") | |
448 | |
449 (ediff-defvar-local ediff-brief-help-message-function nil | |
450 "The brief help message that the user can customize. | |
451 If the user sets this to a parameter-less function, Ediff will use it to | |
452 produce the brief help message. This function must return a string.") | |
453 (ediff-defvar-local ediff-long-help-message-function nil | |
454 "The long help message that the user can customize. | |
455 See `ediff-brief-help-message-function' for more.") | |
456 | |
457 (defvar ediff-use-long-help-message nil | |
458 "*If t, Ediff displays a long help message. Short help message otherwise.") | |
459 | |
460 ;; The actual help message. | |
461 (ediff-defvar-local ediff-help-message "" | |
462 "The actual help message. | |
463 Normally, the user shouldn't touch this. However, if you want Ediff to | |
464 start up with different help messages for different jobs, you can change | |
465 the value of this variable and the variables `ediff-help-message-*' in | |
466 `ediff-startup-hook'.") | |
467 | 366 |
468 ;; Error messages | 367 ;; Error messages |
469 (defconst ediff-KILLED-VITAL-BUFFER | 368 (defconst ediff-KILLED-VITAL-BUFFER |
470 "You have killed a vital Ediff buffer---you must leave Ediff now!") | 369 "You have killed a vital Ediff buffer---you must leave Ediff now!") |
471 (defconst ediff-NO-DIFFERENCES | 370 (defconst ediff-NO-DIFFERENCES |
472 "Sorry, comparison of identical variants is not what I am made for...") | 371 "Sorry, comparison of identical variants is not what I am made for...") |
473 (defconst ediff-BAD-DIFF-NUMBER | 372 (defconst ediff-BAD-DIFF-NUMBER |
474 ;; %S stands for this-command, %d - diff number, %d - max diff | 373 ;; %S stands for this-command, %d - diff number, %d - max diff |
475 "%S: Bad diff region number, %d. Valid numbers are 1 to %d") | 374 "%S: Bad diff region number, %d. Valid numbers are 1 to %d") |
375 (defconst ediff-BAD-INFO (format " | |
376 *** The Info file for Ediff, a part of the standard distribution | |
377 *** of %sEmacs, does not seem to be properly installed. | |
378 *** | |
379 *** Please contact your system administrator. " | |
380 (if ediff-xemacs-p "X" ""))) | |
476 | 381 |
477 ;; Selective browsing | 382 ;; Selective browsing |
478 | 383 |
479 (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs | 384 (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs |
480 "Function that determines the next/previous diff region to show. | 385 "Function that determines the next/previous diff region to show. |
511 ;; connective that determines whether to hide regions that match both or | 416 ;; connective that determines whether to hide regions that match both or |
512 ;; one of the regexps | 417 ;; one of the regexps |
513 (ediff-defvar-local ediff-hide-regexp-connective 'and "") | 418 (ediff-defvar-local ediff-hide-regexp-connective 'and "") |
514 | 419 |
515 | 420 |
516 (defvar ediff-ange-ftp-ftp-name (if ediff-xemacs-p | |
517 'ange-ftp-ftp-path | |
518 'ange-ftp-ftp-name) | |
519 "Function ange-ftp uses to find out if file is remote.") | |
520 | |
521 | |
522 ;; Copying difference regions between buffers. | 421 ;; Copying difference regions between buffers. |
523 (ediff-defvar-local ediff-killed-diffs-alist nil | 422 (ediff-defvar-local ediff-killed-diffs-alist nil |
524 "A list of killed diffs. | 423 "A list of killed diffs. |
525 A diff is saved here if it is replaced by a diff | 424 A diff is saved here if it is replaced by a diff |
526 from another buffer. This alist has the form: | 425 from another buffer. This alist has the form: |
611 (ediff-defvar-local ediff-buffer-values-orig-C nil "") | 510 (ediff-defvar-local ediff-buffer-values-orig-C nil "") |
612 ;; The original values of ediff-protected-variables for buffer Ancestor | 511 ;; The original values of ediff-protected-variables for buffer Ancestor |
613 (ediff-defvar-local ediff-buffer-values-orig-Ancestor nil "") | 512 (ediff-defvar-local ediff-buffer-values-orig-Ancestor nil "") |
614 ;; Buffer-local variables to be saved then restored during Ediff sessions | 513 ;; Buffer-local variables to be saved then restored during Ediff sessions |
615 ;; Buffer-local variables to be saved then restored during Ediff sessions | 514 ;; Buffer-local variables to be saved then restored during Ediff sessions |
616 (defconst ediff-protected-variables '(buffer-read-only | 515 (defconst ediff-protected-variables '( |
617 ;;; synchronize-minibuffers | 516 ;;buffer-read-only |
618 mode-line-format)) | 517 mode-line-format)) |
619 | 518 |
620 ;; Vector of differences between the variants. Each difference is | 519 ;; Vector of differences between the variants. Each difference is |
621 ;; represented by a vector of two overlays plus a vector of fine diffs, | 520 ;; represented by a vector of two overlays plus a vector of fine diffs, |
622 ;; plus a no-fine-diffs flag. The first overlay spans the | 521 ;; plus a no-fine-diffs flag. The first overlay spans the |
691 (fset 'ediff-read-event (symbol-function 'next-command-event)) | 590 (fset 'ediff-read-event (symbol-function 'next-command-event)) |
692 (fset 'ediff-overlayp (symbol-function 'extentp)) | 591 (fset 'ediff-overlayp (symbol-function 'extentp)) |
693 (fset 'ediff-make-overlay (symbol-function 'make-extent)) | 592 (fset 'ediff-make-overlay (symbol-function 'make-extent)) |
694 (fset 'ediff-delete-overlay (symbol-function 'delete-extent))) | 593 (fset 'ediff-delete-overlay (symbol-function 'delete-extent))) |
695 (fset 'ediff-read-event (symbol-function 'read-event)) | 594 (fset 'ediff-read-event (symbol-function 'read-event)) |
696 (fset 'ediff-overlayp (symbol-function 'overlayp)) | |
697 (fset 'ediff-overlayp (symbol-function 'overlayp)) | 595 (fset 'ediff-overlayp (symbol-function 'overlayp)) |
698 (fset 'ediff-make-overlay (symbol-function 'make-overlay)) | 596 (fset 'ediff-make-overlay (symbol-function 'make-overlay)) |
699 (fset 'ediff-delete-overlay (symbol-function 'delete-overlay))) | 597 (fset 'ediff-delete-overlay (symbol-function 'delete-overlay))) |
700 | 598 |
701 ;; Check the current version against the major and minor version numbers | 599 ;; Check the current version against the major and minor version numbers |
857 ediff-even-diff-face-Ancestor | 755 ediff-even-diff-face-Ancestor |
858 ediff-odd-diff-face-Ancestor)) | 756 ediff-odd-diff-face-Ancestor)) |
859 (copy-face 'secondary-selection face)))) | 757 (copy-face 'secondary-selection face)))) |
860 )) | 758 )) |
861 | 759 |
760 (defun ediff-set-face-pixmap (face pixmap) | |
761 "Set face pixmap on a monochrome display." | |
762 (if (and (ediff-window-display-p) (not (ediff-color-display-p))) | |
763 (condition-case nil | |
764 (set-face-background-pixmap face pixmap) | |
765 (error | |
766 (message "Pixmap not found for %S: %s" (face-name face) pixmap) | |
767 (sit-for 1))))) | |
768 | |
862 (defun ediff-hide-face (face) | 769 (defun ediff-hide-face (face) |
863 (if (and (ediff-has-face-support-p) ediff-emacs-p) | 770 (if (and (ediff-has-face-support-p) ediff-emacs-p) |
864 (add-to-list 'facemenu-unlisted-faces face))) | 771 (add-to-list 'facemenu-unlisted-faces face))) |
865 | 772 |
866 (defvar ediff-current-diff-face-A | 773 (defvar ediff-current-diff-face-A |
926 (progn | 833 (progn |
927 (make-face 'ediff-current-diff-face-Ancestor) | 834 (make-face 'ediff-current-diff-face-Ancestor) |
928 (ediff-hide-face 'ediff-current-diff-face-Ancestor) | 835 (ediff-hide-face 'ediff-current-diff-face-Ancestor) |
929 (or (face-differs-from-default-p 'ediff-current-diff-face-Ancestor) | 836 (or (face-differs-from-default-p 'ediff-current-diff-face-Ancestor) |
930 (copy-face | 837 (copy-face |
931 'ediff-current-diff-face-C 'ediff-current-diff-face-Ancestor)))) | 838 'ediff-current-diff-face-C 'ediff-current-diff-face-Ancestor)) |
839 'ediff-current-diff-face-Ancestor)) | |
932 "Face for highlighting the selected difference in the ancestor buffer.") | 840 "Face for highlighting the selected difference in the ancestor buffer.") |
841 | |
842 (defvar ediff-fine-diff-pixmap "gray3" | |
843 "Pixmap to use for highlighting fine differences.") | |
844 (defvar ediff-odd-diff-pixmap "gray1" | |
845 "Pixmap to use for highlighting odd differences.") | |
846 (defvar ediff-even-diff-pixmap "Stipple" | |
847 "Pixmap to use for highlighting even differences.") | |
933 | 848 |
934 (defvar ediff-fine-diff-face-A | 849 (defvar ediff-fine-diff-face-A |
935 (if (ediff-has-face-support-p) | 850 (if (ediff-has-face-support-p) |
936 (progn | 851 (progn |
937 (make-face 'ediff-fine-diff-face-A) | 852 (make-face 'ediff-fine-diff-face-A) |
940 (cond ((ediff-color-display-p) | 855 (cond ((ediff-color-display-p) |
941 (ediff-set-face 'foreground 'ediff-fine-diff-face-A | 856 (ediff-set-face 'foreground 'ediff-fine-diff-face-A |
942 "Navy") | 857 "Navy") |
943 (ediff-set-face 'background 'ediff-fine-diff-face-A | 858 (ediff-set-face 'background 'ediff-fine-diff-face-A |
944 "sky blue")) | 859 "sky blue")) |
945 (t (set-face-underline-p 'ediff-fine-diff-face-A t)))) | 860 (t |
861 (set-face-underline-p 'ediff-fine-diff-face-A t) | |
862 (ediff-set-face-pixmap 'ediff-fine-diff-face-A | |
863 ediff-fine-diff-pixmap) | |
864 ))) | |
946 'ediff-fine-diff-face-A)) | 865 'ediff-fine-diff-face-A)) |
947 "Face for highlighting the refinement of the selected diff in buffer A.") | 866 "Face for highlighting the refinement of the selected diff in buffer A.") |
948 | 867 |
949 (defvar ediff-fine-diff-face-B | 868 (defvar ediff-fine-diff-face-B |
950 (if (ediff-has-face-support-p) | 869 (if (ediff-has-face-support-p) |
953 (ediff-hide-face 'ediff-fine-diff-face-B) | 872 (ediff-hide-face 'ediff-fine-diff-face-B) |
954 (or (face-differs-from-default-p 'ediff-fine-diff-face-B) | 873 (or (face-differs-from-default-p 'ediff-fine-diff-face-B) |
955 (cond ((ediff-color-display-p) | 874 (cond ((ediff-color-display-p) |
956 (ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black") | 875 (ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black") |
957 (ediff-set-face 'background 'ediff-fine-diff-face-B "cyan")) | 876 (ediff-set-face 'background 'ediff-fine-diff-face-B "cyan")) |
958 (t (set-face-underline-p 'ediff-fine-diff-face-B t)))) | 877 (t |
878 (set-face-underline-p 'ediff-fine-diff-face-B t) | |
879 (ediff-set-face-pixmap 'ediff-fine-diff-face-B | |
880 ediff-fine-diff-pixmap) | |
881 ))) | |
959 'ediff-fine-diff-face-B)) | 882 'ediff-fine-diff-face-B)) |
960 "Face for highlighting the refinement of the selected diff in buffer B.") | 883 "Face for highlighting the refinement of the selected diff in buffer B.") |
961 | 884 |
962 (defvar ediff-fine-diff-face-C | 885 (defvar ediff-fine-diff-face-C |
963 (if (ediff-has-face-support-p) | 886 (if (ediff-has-face-support-p) |
967 (or (face-differs-from-default-p 'ediff-fine-diff-face-C) | 890 (or (face-differs-from-default-p 'ediff-fine-diff-face-C) |
968 (cond ((ediff-color-display-p) | 891 (cond ((ediff-color-display-p) |
969 (ediff-set-face 'foreground 'ediff-fine-diff-face-C "black") | 892 (ediff-set-face 'foreground 'ediff-fine-diff-face-C "black") |
970 (ediff-set-face | 893 (ediff-set-face |
971 'background 'ediff-fine-diff-face-C "Turquoise")) | 894 'background 'ediff-fine-diff-face-C "Turquoise")) |
972 (t (set-face-underline-p 'ediff-fine-diff-face-C t)))) | 895 (t |
896 (set-face-underline-p 'ediff-fine-diff-face-C t) | |
897 (ediff-set-face-pixmap 'ediff-fine-diff-face-C | |
898 ediff-fine-diff-pixmap) | |
899 ))) | |
973 'ediff-fine-diff-face-C)) | 900 'ediff-fine-diff-face-C)) |
974 "Face for highlighting the refinement of the selected diff in buffer C.") | 901 "Face for highlighting the refinement of the selected diff in buffer C.") |
975 | 902 |
976 (defvar ediff-fine-diff-face-Ancestor | 903 (defvar ediff-fine-diff-face-Ancestor |
977 (if (ediff-has-face-support-p) | 904 (if (ediff-has-face-support-p) |
978 (progn | 905 (progn |
979 (make-face 'ediff-fine-diff-face-Ancestor) | 906 (make-face 'ediff-fine-diff-face-Ancestor) |
980 (ediff-hide-face 'ediff-fine-diff-face-Ancestor) | 907 (ediff-hide-face 'ediff-fine-diff-face-Ancestor) |
981 (or (face-differs-from-default-p 'ediff-fine-diff-face-Ancestor) | 908 (or (face-differs-from-default-p 'ediff-fine-diff-face-Ancestor) |
982 (copy-face | 909 (progn |
983 'ediff-fine-diff-face-C 'ediff-fine-diff-face-Ancestor)))) | 910 (copy-face |
911 'ediff-fine-diff-face-C 'ediff-fine-diff-face-Ancestor) | |
912 (ediff-set-face-pixmap 'ediff-fine-diff-face-Ancestor | |
913 ediff-fine-diff-pixmap)) | |
914 ))) | |
984 "Face highlighting refinements of the selected diff in ancestor buffer. | 915 "Face highlighting refinements of the selected diff in ancestor buffer. |
985 Presently, this is not used, as difference regions are not refined in the | 916 Presently, this is not used, as difference regions are not refined in the |
986 ancestor buffer.") | 917 ancestor buffer.") |
987 | 918 |
988 (defvar ediff-even-diff-face-A | 919 (defvar ediff-even-diff-face-A |
995 (ediff-set-face | 926 (ediff-set-face |
996 'foreground 'ediff-even-diff-face-A "black") | 927 'foreground 'ediff-even-diff-face-A "black") |
997 (ediff-set-face | 928 (ediff-set-face |
998 'background 'ediff-even-diff-face-A "light grey")) | 929 'background 'ediff-even-diff-face-A "light grey")) |
999 (t | 930 (t |
1000 (copy-face 'italic 'ediff-even-diff-face-A)))) | 931 (copy-face 'italic 'ediff-even-diff-face-A) |
932 (ediff-set-face-pixmap 'ediff-even-diff-face-A | |
933 ediff-even-diff-pixmap) | |
934 ))) | |
1001 'ediff-even-diff-face-A)) | 935 'ediff-even-diff-face-A)) |
1002 "Face used to highlight even-numbered differences in buffer A.") | 936 "Face used to highlight even-numbered differences in buffer A.") |
1003 | 937 |
1004 (defvar ediff-even-diff-face-B | 938 (defvar ediff-even-diff-face-B |
1005 (if (ediff-has-face-support-p) | 939 (if (ediff-has-face-support-p) |
1011 (ediff-set-face | 945 (ediff-set-face |
1012 'foreground 'ediff-even-diff-face-B "White") | 946 'foreground 'ediff-even-diff-face-B "White") |
1013 (ediff-set-face | 947 (ediff-set-face |
1014 'background 'ediff-even-diff-face-B "Gray")) | 948 'background 'ediff-even-diff-face-B "Gray")) |
1015 (t | 949 (t |
1016 (copy-face 'italic 'ediff-even-diff-face-B)))) | 950 (copy-face 'italic 'ediff-even-diff-face-B) |
951 (ediff-set-face-pixmap 'ediff-even-diff-face-B | |
952 ediff-even-diff-pixmap) | |
953 ))) | |
1017 'ediff-even-diff-face-B)) | 954 'ediff-even-diff-face-B)) |
1018 "Face used to highlight even-numbered differences in buffer B.") | 955 "Face used to highlight even-numbered differences in buffer B.") |
1019 | 956 |
1020 (defvar ediff-even-diff-face-C | 957 (defvar ediff-even-diff-face-C |
1021 (if (ediff-has-face-support-p) | 958 (if (ediff-has-face-support-p) |
1022 (progn | 959 (progn |
1023 (make-face 'ediff-even-diff-face-C) | 960 (make-face 'ediff-even-diff-face-C) |
1024 (ediff-hide-face 'ediff-even-diff-face-C) | 961 (ediff-hide-face 'ediff-even-diff-face-C) |
1025 (or (face-differs-from-default-p 'ediff-even-diff-face-C) | 962 (or (face-differs-from-default-p 'ediff-even-diff-face-C) |
1026 (copy-face 'ediff-even-diff-face-A 'ediff-even-diff-face-C)) | 963 (progn |
964 (copy-face 'ediff-even-diff-face-A 'ediff-even-diff-face-C) | |
965 (ediff-set-face-pixmap 'ediff-even-diff-face-C | |
966 ediff-even-diff-pixmap))) | |
1027 'ediff-even-diff-face-C)) | 967 'ediff-even-diff-face-C)) |
1028 "Face used to highlight even-numbered differences in buffer C.") | 968 "Face used to highlight even-numbered differences in buffer C.") |
1029 | 969 |
1030 (defvar ediff-even-diff-face-Ancestor | 970 (defvar ediff-even-diff-face-Ancestor |
1031 (if (ediff-has-face-support-p) | 971 (if (ediff-has-face-support-p) |
1032 (progn | 972 (progn |
1033 (make-face 'ediff-even-diff-face-Ancestor) | 973 (make-face 'ediff-even-diff-face-Ancestor) |
1034 (ediff-hide-face 'ediff-even-diff-face-Ancestor) | 974 (ediff-hide-face 'ediff-even-diff-face-Ancestor) |
1035 (or (face-differs-from-default-p 'ediff-even-diff-face-Ancestor) | 975 (or (face-differs-from-default-p 'ediff-even-diff-face-Ancestor) |
1036 (copy-face 'ediff-even-diff-face-C 'ediff-even-diff-face-Ancestor)) | 976 (progn |
977 (copy-face | |
978 'ediff-even-diff-face-C 'ediff-even-diff-face-Ancestor) | |
979 (ediff-set-face-pixmap 'ediff-even-diff-face-Ancestor | |
980 ediff-even-diff-pixmap))) | |
1037 'ediff-even-diff-face-Ancestor)) | 981 'ediff-even-diff-face-Ancestor)) |
1038 "Face highlighting even-numbered differences in the ancestor buffer.") | 982 "Face highlighting even-numbered differences in the ancestor buffer.") |
1039 | 983 |
1040 (defvar ediff-odd-diff-face-A | 984 (defvar ediff-odd-diff-face-A |
1041 (if (ediff-has-face-support-p) | 985 (if (ediff-has-face-support-p) |
1047 (ediff-set-face | 991 (ediff-set-face |
1048 'foreground 'ediff-odd-diff-face-A "White") | 992 'foreground 'ediff-odd-diff-face-A "White") |
1049 (ediff-set-face | 993 (ediff-set-face |
1050 'background 'ediff-odd-diff-face-A "Gray")) | 994 'background 'ediff-odd-diff-face-A "Gray")) |
1051 (t | 995 (t |
1052 (copy-face 'italic 'ediff-odd-diff-face-A)))) | 996 (copy-face 'italic 'ediff-odd-diff-face-A) |
997 (ediff-set-face-pixmap 'ediff-odd-diff-face-A | |
998 ediff-odd-diff-pixmap) | |
999 ))) | |
1053 'ediff-odd-diff-face-A)) | 1000 'ediff-odd-diff-face-A)) |
1054 "Face used to highlight odd-numbered differences in buffer A.") | 1001 "Face used to highlight odd-numbered differences in buffer A.") |
1055 | 1002 |
1056 (defvar ediff-odd-diff-face-B | 1003 (defvar ediff-odd-diff-face-B |
1057 (if (ediff-has-face-support-p) | 1004 (if (ediff-has-face-support-p) |
1063 (ediff-set-face | 1010 (ediff-set-face |
1064 'foreground 'ediff-odd-diff-face-B "Black") | 1011 'foreground 'ediff-odd-diff-face-B "Black") |
1065 (ediff-set-face | 1012 (ediff-set-face |
1066 'background 'ediff-odd-diff-face-B "light grey")) | 1013 'background 'ediff-odd-diff-face-B "light grey")) |
1067 (t | 1014 (t |
1068 (copy-face 'italic 'ediff-odd-diff-face-B)))) | 1015 (copy-face 'italic 'ediff-odd-diff-face-B) |
1016 (ediff-set-face-pixmap 'ediff-odd-diff-face-B | |
1017 ediff-odd-diff-pixmap) | |
1018 ))) | |
1069 'ediff-odd-diff-face-B)) | 1019 'ediff-odd-diff-face-B)) |
1070 "Face used to highlight odd-numbered differences in buffer B.") | 1020 "Face used to highlight odd-numbered differences in buffer B.") |
1071 | 1021 |
1072 (defvar ediff-odd-diff-face-C | 1022 (defvar ediff-odd-diff-face-C |
1073 (if (ediff-has-face-support-p) | 1023 (if (ediff-has-face-support-p) |
1074 (progn | 1024 (progn |
1075 (make-face 'ediff-odd-diff-face-C) | 1025 (make-face 'ediff-odd-diff-face-C) |
1076 (ediff-hide-face 'ediff-odd-diff-face-C) | 1026 (ediff-hide-face 'ediff-odd-diff-face-C) |
1077 (or (face-differs-from-default-p 'ediff-odd-diff-face-C) | 1027 (or (face-differs-from-default-p 'ediff-odd-diff-face-C) |
1078 (copy-face 'ediff-odd-diff-face-A 'ediff-odd-diff-face-C)) | 1028 (progn |
1029 (copy-face 'ediff-odd-diff-face-A 'ediff-odd-diff-face-C) | |
1030 (ediff-set-face-pixmap 'ediff-odd-diff-face-C | |
1031 ediff-odd-diff-pixmap))) | |
1079 'ediff-odd-diff-face-C)) | 1032 'ediff-odd-diff-face-C)) |
1080 "Face used to highlight odd-numbered differences in buffer C.") | 1033 "Face used to highlight odd-numbered differences in buffer C.") |
1081 | 1034 |
1082 (defvar ediff-odd-diff-face-Ancestor | 1035 (defvar ediff-odd-diff-face-Ancestor |
1083 (if (ediff-has-face-support-p) | 1036 (if (ediff-has-face-support-p) |
1084 (progn | 1037 (progn |
1085 (make-face 'ediff-odd-diff-face-Ancestor) | 1038 (make-face 'ediff-odd-diff-face-Ancestor) |
1086 (ediff-hide-face 'ediff-odd-diff-face-Ancestor) | 1039 (ediff-hide-face 'ediff-odd-diff-face-Ancestor) |
1087 (or (face-differs-from-default-p 'ediff-odd-diff-face-Ancestor) | 1040 (or (face-differs-from-default-p 'ediff-odd-diff-face-Ancestor) |
1088 (copy-face 'ediff-odd-diff-face-C 'ediff-odd-diff-face-Ancestor)) | 1041 (progn |
1042 (copy-face 'ediff-odd-diff-face-C 'ediff-odd-diff-face-Ancestor) | |
1043 (ediff-set-face-pixmap 'ediff-odd-diff-face-Ancestor | |
1044 ediff-odd-diff-pixmap))) | |
1089 'ediff-odd-diff-face-Ancestor)) | 1045 'ediff-odd-diff-face-Ancestor)) |
1090 "Face used to highlight even-numbered differences in the ancestor buffer.") | 1046 "Face used to highlight even-numbered differences in the ancestor buffer.") |
1091 | 1047 |
1092 ;; Help echo | 1048 ;; Help echo |
1093 (put 'ediff-fine-diff-face-A 'ediff-help-echo | 1049 (put 'ediff-fine-diff-face-A 'ediff-help-echo |
1141 | 1097 |
1142 ;;; Misc | 1098 ;;; Misc |
1143 | 1099 |
1144 ;; if nil, this silences some messages | 1100 ;; if nil, this silences some messages |
1145 (defconst ediff-verbose-p t) | 1101 (defconst ediff-verbose-p t) |
1102 | |
1103 (ediff-defvar-local ediff-autostore-merges 'group-jobs-only | |
1104 "*Save the results of merge jobs automatically. | |
1105 Nil means don't save automatically. t means always save. Anything but nil or t | |
1106 means save automatically only if the merge job is part of a group of jobs, such | |
1107 as `ediff-merge-directory' or `ediff-merge-directory-revisions'.") | |
1108 | |
1109 ;; file where the result of the merge is to be saved. used internally | |
1110 (ediff-defvar-local ediff-merge-store-file nil "") | |
1146 | 1111 |
1147 (defvar ediff-no-emacs-help-in-control-buffer nil | 1112 (defvar ediff-no-emacs-help-in-control-buffer nil |
1148 "*Non-nil means C-h should not invoke Emacs help in control buffer. | 1113 "*Non-nil means C-h should not invoke Emacs help in control buffer. |
1149 Instead, C-h jumps to previous difference.") | 1114 Instead, C-h jumps to previous difference.") |
1150 | 1115 |
1186 "Temporary file used for refining difference regions in buffer C.") | 1151 "Temporary file used for refining difference regions in buffer C.") |
1187 | 1152 |
1188 ;;; In-line functions | 1153 ;;; In-line functions |
1189 | 1154 |
1190 (defsubst ediff-file-remote-p (file-name) | 1155 (defsubst ediff-file-remote-p (file-name) |
1191 (if (fboundp ediff-ange-ftp-ftp-name) | 1156 (require 'ange-ftp) |
1192 (funcall ediff-ange-ftp-ftp-name file-name))) | 1157 (car (if ediff-xemacs-p |
1193 | 1158 (ange-ftp-ftp-path file-name) |
1159 (ange-ftp-ftp-name file-name)))) | |
1194 | 1160 |
1195 (defsubst ediff-frame-unsplittable-p (frame) | 1161 (defsubst ediff-frame-unsplittable-p (frame) |
1196 (cdr (assq 'unsplittable (frame-parameters frame)))) | 1162 (cdr (assq 'unsplittable (frame-parameters frame)))) |
1197 | 1163 |
1198 (defsubst ediff-get-next-window (wind prev-wind) | 1164 (defsubst ediff-get-next-window (wind prev-wind) |
1204 | 1170 |
1205 (defsubst ediff-kill-buffer-carefully (buf) | 1171 (defsubst ediff-kill-buffer-carefully (buf) |
1206 "Kill buffer BUF if it exists." | 1172 "Kill buffer BUF if it exists." |
1207 (if (ediff-buffer-live-p buf) | 1173 (if (ediff-buffer-live-p buf) |
1208 (kill-buffer (get-buffer buf)))) | 1174 (kill-buffer (get-buffer buf)))) |
1209 | 1175 |
1176 | |
1177 ;; activate faces on diff regions in buffer | |
1178 (defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight) | |
1179 (let ((diff-vector | |
1180 (eval (intern (format "ediff-difference-vector-%S" buf-type)))) | |
1181 overl diff-num) | |
1182 (mapcar (function | |
1183 (lambda (rec) | |
1184 (setq overl (ediff-get-diff-overlay-from-diff-record rec) | |
1185 diff-num (ediff-overlay-get overl 'ediff-diff-num)) | |
1186 (ediff-set-overlay-face | |
1187 overl | |
1188 (if (not unhighlight) | |
1189 (ediff-background-face buf-type diff-num)) | |
1190 ))) | |
1191 diff-vector))) | |
1192 | |
1193 | |
1194 ;; activate faces on diff regions in all buffers | |
1195 (defun ediff-paint-background-regions (&optional unhighlight) | |
1196 (ediff-paint-background-regions-in-one-buffer | |
1197 'A unhighlight) | |
1198 (ediff-paint-background-regions-in-one-buffer | |
1199 'B unhighlight) | |
1200 (ediff-paint-background-regions-in-one-buffer | |
1201 'C unhighlight) | |
1202 (ediff-paint-background-regions-in-one-buffer | |
1203 'Ancestor unhighlight)) | |
1204 | |
1205 (defun ediff-highlight-diff-in-one-buffer (n buf-type) | |
1206 (if (ediff-buffer-live-p (ediff-get-buffer buf-type)) | |
1207 (let* ((buff (ediff-get-buffer buf-type)) | |
1208 (last (ediff-eval-in-buffer buff (point-max))) | |
1209 (begin (ediff-get-diff-posn buf-type 'beg n)) | |
1210 (end (ediff-get-diff-posn buf-type 'end n)) | |
1211 (xtra (if (equal begin end) 1 0)) | |
1212 (end-hilit (min last (+ end xtra))) | |
1213 (current-diff-overlay | |
1214 (symbol-value | |
1215 (intern (format "ediff-current-diff-overlay-%S" buf-type))))) | |
1216 | |
1217 (if ediff-xemacs-p | |
1218 (ediff-move-overlay current-diff-overlay begin end-hilit) | |
1219 (ediff-move-overlay current-diff-overlay begin end-hilit buff)) | |
1220 (ediff-overlay-put current-diff-overlay 'priority | |
1221 (ediff-highest-priority begin end-hilit buff)) | |
1222 (ediff-overlay-put current-diff-overlay 'ediff-diff-num n) | |
1223 | |
1224 ;; unhighlight the background overlay for diff n so it won't | |
1225 ;; interfere with the current diff overlay | |
1226 (ediff-set-overlay-face (ediff-get-diff-overlay n buf-type) nil) | |
1227 ))) | |
1228 | |
1229 | |
1230 (defun ediff-unhighlight-diff-in-one-buffer (buf-type) | |
1231 (if (ediff-buffer-live-p (ediff-get-buffer buf-type)) | |
1232 (let ((current-diff-overlay | |
1233 (symbol-value | |
1234 (intern (format "ediff-current-diff-overlay-%S" buf-type)))) | |
1235 (overlay | |
1236 (ediff-get-diff-overlay ediff-current-difference buf-type)) | |
1237 ) | |
1238 | |
1239 (ediff-move-overlay current-diff-overlay 1 1) | |
1240 | |
1241 ;; rehighlight the overlay in the background of the | |
1242 ;; current difference region | |
1243 (ediff-set-overlay-face | |
1244 overlay | |
1245 (if (and (ediff-has-face-support-p) | |
1246 ediff-use-faces ediff-highlight-all-diffs) | |
1247 (ediff-background-face buf-type ediff-current-difference))) | |
1248 ))) | |
1249 | |
1250 (defun ediff-unhighlight-diffs-totally-in-one-buffer (buf-type) | |
1251 (ediff-unselect-and-select-difference -1) | |
1252 (if (and (ediff-has-face-support-p) ediff-use-faces) | |
1253 (let* ((inhibit-quit t) | |
1254 (current-diff-overlay-var | |
1255 (intern (format "ediff-current-diff-overlay-%S" buf-type))) | |
1256 (current-diff-overlay (symbol-value current-diff-overlay-var))) | |
1257 (ediff-paint-background-regions 'unhighlight) | |
1258 (if (ediff-overlayp current-diff-overlay) | |
1259 (ediff-delete-overlay current-diff-overlay)) | |
1260 (set current-diff-overlay-var nil) | |
1261 ))) | |
1210 | 1262 |
1211 (defsubst ediff-highlight-diff (n) | 1263 (defsubst ediff-highlight-diff (n) |
1212 "Put face on diff N. Invoked for X displays only." | 1264 "Put face on diff N. Invoked for X displays only." |
1213 (ediff-highlight-diff-in-one-buffer n 'A) | 1265 (ediff-highlight-diff-in-one-buffer n 'A) |
1214 (ediff-highlight-diff-in-one-buffer n 'B) | 1266 (ediff-highlight-diff-in-one-buffer n 'B) |
1361 (defsubst ediff-frame-char-height (frame) | 1413 (defsubst ediff-frame-char-height (frame) |
1362 (if ediff-xemacs-p | 1414 (if ediff-xemacs-p |
1363 (glyph-height ediff-H-glyph (selected-window frame)) | 1415 (glyph-height ediff-H-glyph (selected-window frame)) |
1364 (frame-char-height frame))) | 1416 (frame-char-height frame))) |
1365 | 1417 |
1418 ;; Some overlay functions | |
1366 | 1419 |
1367 (defsubst ediff-empty-overlay-p (overl) | 1420 (defsubst ediff-empty-overlay-p (overl) |
1368 (= (ediff-overlay-start overl) (ediff-overlay-end overl))) | 1421 (= (ediff-overlay-start overl) (ediff-overlay-end overl))) |
1369 | 1422 |
1370 ;; like overlay-buffer in Emacs. In XEmacs, returns nil if the extent is | 1423 ;; like overlay-buffer in Emacs. In XEmacs, returns nil if the extent is |
1378 ;; dead. Otherwise, like extent-property | 1431 ;; dead. Otherwise, like extent-property |
1379 (defun ediff-overlay-get (overl property) | 1432 (defun ediff-overlay-get (overl property) |
1380 (if ediff-emacs-p | 1433 (if ediff-emacs-p |
1381 (overlay-get overl property) | 1434 (overlay-get overl property) |
1382 (and (extent-live-p overl) (extent-property overl property)))) | 1435 (and (extent-live-p overl) (extent-property overl property)))) |
1436 | |
1437 | |
1438 ;; These two functions are here because XEmacs refuses to | |
1439 ;; handle overlays whose buffers were deleted. | |
1440 (defun ediff-move-overlay (overlay beg end &optional buffer) | |
1441 "Calls `move-overlay' in Emacs and `set-extent-endpoints' in Lemacs. | |
1442 Checks if overlay's buffer exists before actually doing the move." | |
1443 (let ((buf (and overlay (ediff-overlay-buffer overlay)))) | |
1444 (if (ediff-buffer-live-p buf) | |
1445 (if ediff-xemacs-p | |
1446 (set-extent-endpoints overlay beg end) | |
1447 (move-overlay overlay beg end buffer)) | |
1448 ;; buffer's dead | |
1449 (if overlay | |
1450 (ediff-delete-overlay overlay))))) | |
1451 | |
1452 (defun ediff-overlay-put (overlay prop value) | |
1453 "Calls `overlay-put' or `set-extent-property' depending on Emacs version. | |
1454 Checks if overlay's buffer exists." | |
1455 (if (ediff-buffer-live-p (ediff-overlay-buffer overlay)) | |
1456 (if ediff-xemacs-p | |
1457 (set-extent-property overlay prop value) | |
1458 (overlay-put overlay prop value)) | |
1459 (ediff-delete-overlay overlay))) | |
1460 | |
1461 ;; Some diff region tests | |
1383 | 1462 |
1384 ;; t if diff region is empty. | 1463 ;; t if diff region is empty. |
1385 ;; In case of buffer C, t also if it is not a 3way | 1464 ;; In case of buffer C, t also if it is not a 3way |
1386 ;; comparison job (merging jobs return t as well). | 1465 ;; comparison job (merging jobs return t as well). |
1387 (defun ediff-empty-diff-region-p (n buf-type) | 1466 (defun ediff-empty-diff-region-p (n buf-type) |
1510 (ediff-file-attributes filename 7)) | 1589 (ediff-file-attributes filename 7)) |
1511 (defsubst ediff-file-modtime (filename) | 1590 (defsubst ediff-file-modtime (filename) |
1512 (ediff-file-attributes filename 5)) | 1591 (ediff-file-attributes filename 5)) |
1513 | 1592 |
1514 | 1593 |
1515 | 1594 (defun ediff-convert-standard-filename (fname) |
1516 | 1595 (if ediff-emacs-p |
1517 | 1596 (convert-standard-filename fname) |
1597 ;; hopefully, XEmacs adds this functionality | |
1598 fname)) | |
1599 | |
1600 ;;; Local Variables: | |
1601 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
1602 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1) | |
1603 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) | |
1604 ;;; End: | |
1605 | |
1518 (provide 'ediff-init) | 1606 (provide 'ediff-init) |
1519 | 1607 |
1520 | 1608 |
1521 ;;; ediff-init.el ends here | 1609 ;;; ediff-init.el ends here |