Mercurial > emacs
comparison lisp/ediff.el @ 8348:bf950cbd542c
Made menu bar's autoloaded stuff conditional on
purify-flag, to avoid error message when loading ediff in a frame
that has no menu bar.
(ediff-setup): Improved mode-line-buffer-identification.
Now accommodates buffer identifications generated by
mode-line.el and uniquify.el.
(ediff-current-diff-face-A/B,
ediff-fine-diff-face-A/B,ediff-odd/even-diff-face-A/B):
Variables changed to contain face names
instead of face internal representation.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 26 Jul 1994 20:16:05 +0000 |
parents | 33ef3e3234dd |
children | cb9d52c38ed7 |
comparison
equal
deleted
inserted
replaced
8347:0fff2106fa43 | 8348:bf950cbd542c |
---|---|
1 ;;; ediff.el --- a visual interface to diff & patch | 1 ;;; ediff.el --- a visual interface to diff & patch |
2 ;;; Copyright (C) 1994 Free Software Foundation, Inc. | 2 ;;; Copyright (C) 1994 Free Software Foundation, Inc. |
3 | 3 |
4 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 4 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> |
5 ;; Created: February 2, 1994 | 5 ;; Created: February 2, 1994 |
6 ;; Version: 1.64 | 6 ;; Version: 1.64.2 |
7 ;; Keywords: comparing, merging, patching, version control. | 7 ;; Keywords: comparing, merging, patching, version control. |
8 | 8 |
9 ;; This file is part of GNU Emacs. | 9 ;; This file is part of GNU Emacs. |
10 | |
11 ;; LCD Archive Entry: | |
12 ;; ediff|Michael Kifer|kifer@cs.sunysb.edu| | |
13 ;; Visual interface to diff and patch.| | |
14 ;; 28-June-94|1.64|~/packages/ediff.el.Z| | |
15 | 10 |
16 ;; GNU Emacs is free software; you can redistribute it and/or modify | 11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
17 ;; it under the terms of the GNU General Public License as published by | 12 ;; it under the terms of the GNU General Public License as published by |
18 ;; the Free Software Foundation; either version 2, or (at your option) | 13 ;; the Free Software Foundation; either version 2, or (at your option) |
19 ;; any later version. | 14 ;; any later version. |
338 ;; regions in buffer A and B. | 333 ;; regions in buffer A and B. |
339 ;; Other (non-current) difference regions are displayed in alternating | 334 ;; Other (non-current) difference regions are displayed in alternating |
340 ;; faces: ediff-even/odd-diff-face-A/B. The odd and the even | 335 ;; faces: ediff-even/odd-diff-face-A/B. The odd and the even |
341 ;; faces are actually identical on monochrome displays, because it is | 336 ;; faces are actually identical on monochrome displays, because it is |
342 ;; rather poor in what you can do on such a display. So, I chose to use | 337 ;; rather poor in what you can do on such a display. So, I chose to use |
343 ;; italics to highlight other differences. Any ideas would be welcome. (In | 338 ;; italics to highlight other differences. Any ideas would be welcome. |
344 ;; Lucid Emacs, the faces are different because it supports pixmaps.) | |
345 ;; There are two ways to change the default setting for highlighting faces: | 339 ;; There are two ways to change the default setting for highlighting faces: |
346 ;; either change the variables, as in | 340 ;; either change the variables, as in |
347 ;; | 341 ;; |
348 ;; (setq ediff-current-diff-face-A (internal-get-face 'bold-italic)) | 342 ;; (setq ediff-current-diff-face-A 'bold-italic) |
349 ;; | 343 ;; |
350 ;; (`internal-get-face' should be `get-face' if you are using Lucid Emacs) | 344 ;; or |
345 ;; | |
346 ;; (setq ediff-current-diff-face-A | |
347 ;; (copy-face 'bold-italic 'ediff-current-diff-face-A)) | |
348 ;; | |
351 ;; or by selectively modifying the defaults: | 349 ;; or by selectively modifying the defaults: |
352 ;; | 350 ;; |
353 ;; (add-hook 'ediff-load-hooks | 351 ;; (add-hook 'ediff-load-hooks |
354 ;; (function (lambda () | 352 ;; (function (lambda () |
355 ;; (set-face-foreground ediff-current-diff-face-B "blue") | 353 ;; (set-face-foreground ediff-current-diff-face-B "blue") |
356 ;; (set-face-background ediff-current-diff-face-B "red") | 354 ;; (set-face-background ediff-current-diff-face-B "red") |
357 ;; (make-face-italic ediff-current-diff-face-B)))) | 355 ;; (make-face-italic ediff-current-diff-face-B)))) |
358 ;; | 356 ;; |
359 ;; You may also want to take a look at how the above faces are defined in | 357 ;; You may also want to take a look at how the above faces are defined in |
360 ;; Ediff. | 358 ;; Ediff. |
359 ;; | |
360 ;; Note: it is not recommended to use `internal-get-face' (or `get-face' in | |
361 ;; Lucid) when defining faces for Ediff, since this may cause | |
362 ;; problems when there are several frames with different font sizes. | |
363 ;; Instead, use copy-face or set/make-face-* as shown above. | |
361 ;; | 364 ;; |
362 ;; The last group of variables in this group, | 365 ;; The last group of variables in this group, |
363 ;; | 366 ;; |
364 ;; ediff-want-faces | 367 ;; ediff-want-faces |
365 ;; ediff-highlight-all-diffs | 368 ;; ediff-highlight-all-diffs |
390 ;; effect only on a window system. On a dumb terminal or in an xterm | 393 ;; effect only on a window system. On a dumb terminal or in an xterm |
391 ;; window, the only available option is highlighting with ASCII flags. | 394 ;; window, the only available option is highlighting with ASCII flags. |
392 ;; | 395 ;; |
393 ;; Refining difference regions | 396 ;; Refining difference regions |
394 ;; --------------------------- | 397 ;; --------------------------- |
395 ;; There are also variables that control the way fine differences are | 398 ;; Ediff has variables that control the way fine differences are |
396 ;; highlighted. This feature lets the user highlight the exact words that | 399 ;; highlighted. This feature lets the user highlight the exact words that |
397 ;; make the difference regions in buffer A and B different. This process | 400 ;; make the difference regions in buffer A and B different. This process |
398 ;; ignores spaces, tabs, and newlines. | 401 ;; ignores spaces, tabs, and newlines. |
399 ;; | 402 ;; |
400 ;; ediff-auto-refine | 403 ;; ediff-auto-refine |
401 ;; ediff-auto-refine-limit | 404 ;; ediff-auto-refine-limit |
454 ;; makes sense only if you also intend to use Ediff to browse through the | 457 ;; makes sense only if you also intend to use Ediff to browse through the |
455 ;; diff'ed files before sending the patch. This is because diff.el is much | 458 ;; diff'ed files before sending the patch. This is because diff.el is much |
456 ;; faster in yielding the output of diff (Ediff is a big gun, if used | 459 ;; faster in yielding the output of diff (Ediff is a big gun, if used |
457 ;; for this simple purpose). | 460 ;; for this simple purpose). |
458 ;; | 461 ;; |
462 ;; Mode line | |
463 ;; --------- | |
464 ;; | |
465 ;; When Ediff is running, the mode line of Ediff Control Panel buffer | |
466 ;; displays the current difference being displayed and the total number of | |
467 ;; difference regions in the two files. | |
468 ;; | |
469 ;; The mode line of the buffers being compared displays the type of the | |
470 ;; buffer (`A:' or `B:') and (usually) the file name. Ediff is trying to be | |
471 ;; intelligent in choosing mode line buffer identification. In particular, | |
472 ;; it works well with uniquify.el and mode-line.el packages (which improve | |
473 ;; on the default way in which Emacs displays buffer identification). | |
474 ;; If you don't like the way Ediff identifies its buffers, there is always | |
475 ;; ediff-prepare-buffer-hooks, which can be used to modify the mode line. | |
476 ;; | |
459 ;; Miscellaneous | 477 ;; Miscellaneous |
460 ;; ------------- | 478 ;; ------------- |
461 ;; The last set of variables that can be modified is | 479 ;; The last set of variables that can be modified is |
462 ;; | 480 ;; |
463 ;; ediff-split-window-function | 481 ;; ediff-split-window-function |
787 ;; Changed `ediff-setup-windows' to minimize the need to delete and | 805 ;; Changed `ediff-setup-windows' to minimize the need to delete and |
788 ;; create windows. Now jumps faster from diff to diff. | 806 ;; create windows. Now jumps faster from diff to diff. |
789 | 807 |
790 ;; Sat April 16, 1994 | 808 ;; Sat April 16, 1994 |
791 | 809 |
792 ;; Added Ediff to the File menu on the menu bar (version). | 810 ;; Added Ediff to the File menu on the menu bar (FSF's version). |
793 | 811 |
794 ;; Mon April 18, 1994 | 812 ;; Mon April 18, 1994 |
795 | 813 |
796 ;; Fixed to work with OS/2's PM-Emacs. | 814 ;; Fixed to work with OS/2's PM-Emacs. |
797 | 815 |
864 ;; files. (Suggested by Sandy Rutherford <sandy@ibm550.sissa.it>.) | 882 ;; files. (Suggested by Sandy Rutherford <sandy@ibm550.sissa.it>.) |
865 | 883 |
866 ;; Fri Jun 28, 1994 | 884 ;; Fri Jun 28, 1994 |
867 | 885 |
868 ;; Fixed ediff-patch-files to work with remote and compressed files. | 886 ;; Fixed ediff-patch-files to work with remote and compressed files. |
887 | |
888 ;; Wed July 20, 1994 | |
889 | |
890 ;; Changed menu bar items per RMS's suggestion. Changed odd/even faces | |
891 ;; in Lemacs to italic. Changed ediff-*-face-* variables so that they | |
892 ;; will contain names of faces instead of the face internal | |
893 ;; representation. (Copy-face works better with face names than with | |
894 ;; face internal representation. With face internal representation, if | |
895 ;; a face vector mentions a font explicitly, copy-face may attempt to | |
896 ;; copy this font, which would cause an error if the font has a wrong | |
897 ;; size for one of the existing frames.) Improved the way | |
898 ;; mode-line-buffer-identification is set in ediff-setup so that Ediff | |
899 ;; will accommodate the way buffers are identified in mode-line.el and | |
900 ;; uniquify.el. | |
869 | 901 |
870 | 902 |
871 ;;; Acknowledgements: | 903 ;;; Acknowledgements: |
872 | 904 |
873 ;; Special thanks to Alastair Burt <burt@dfki.uni-kl.de>, Kevin Esler | 905 ;; Special thanks to Alastair Burt <burt@dfki.uni-kl.de>, Kevin Esler |
882 ;; <norbert@i3.informatik.rwth-aachen.de>, Heinz Knutzen | 914 ;; <norbert@i3.informatik.rwth-aachen.de>, Heinz Knutzen |
883 ;; <hk@informatik.uni-kiel.d400.de>, Martin Maechler | 915 ;; <hk@informatik.uni-kiel.d400.de>, Martin Maechler |
884 ;; <maechler@stat.math.ethz.ch>, Richard Mlynarik <mly@adoc.xerox.com>, | 916 ;; <maechler@stat.math.ethz.ch>, Richard Mlynarik <mly@adoc.xerox.com>, |
885 ;; Ray Nickson <nickson@cs.uq.oz.au>, Sandy Rutherford | 917 ;; Ray Nickson <nickson@cs.uq.oz.au>, Sandy Rutherford |
886 ;; <sandy@ibm550.sissa.it>, Andy Scott <ascott@pcocd2.intel.com>, | 918 ;; <sandy@ibm550.sissa.it>, Andy Scott <ascott@pcocd2.intel.com>, |
887 ;; Richard Stanton <stanton@haas.berkeley.edu>, Peter Stout | 919 ;; Richard Stallman <rms@gnu.ai.mit.edu>, Richard Stanton |
888 ;; <Peter_Stout@cs.cmu.edu> for contributing ideas, patches and bug reports. | 920 ;; <stanton@haas.berkeley.edu>, Peter Stout <Peter_Stout@cs.cmu.edu> |
921 ;; for contributing ideas, patches, and bug reports. | |
889 ;; | 922 ;; |
890 ;; Thanks also to many others who felt obliged to drop a thanks note. | 923 ;; Thanks also to many others who felt obliged to drop a thanks note. |
891 | 924 |
892 | 925 |
893 | 926 |
1289 "List of ediff control panels associated with each buffer A/B.") | 1322 "List of ediff control panels associated with each buffer A/B.") |
1290 | 1323 |
1291 (defvar ediff-disturbed-overlays nil | 1324 (defvar ediff-disturbed-overlays nil |
1292 "List of difference overlays disturbed by working with the current diff.") | 1325 "List of difference overlays disturbed by working with the current diff.") |
1293 | 1326 |
1294 (defvar ediff-shaded-overlay-priority | 1327 (defvar ediff-shaded-overlay-priority 100 |
1295 (if (ediff-if-lucid) | |
1296 (1+ mouse-highlight-priority) | |
1297 100) ;; 100 is a kludge. There is a bug in insert-in-front-hooks | |
1298 ;; in Emacs < 19.23. When this is fixed, I will get rid of | |
1299 ;; this kludge. | |
1300 "Priority of non-selected overlays.") | 1328 "Priority of non-selected overlays.") |
1301 | 1329 |
1302 | 1330 |
1303 (if (ediff-if-lucid) | 1331 (if (ediff-if-lucid) |
1304 (progn | 1332 (progn |
1348 | 1376 |
1349 | 1377 |
1350 (if (not window-system) | 1378 (if (not window-system) |
1351 () | 1379 () |
1352 (defun ediff-set-face (ground face color) | 1380 (defun ediff-set-face (ground face color) |
1353 "Sets face foreground/background. If color unavailable, guides the user." | 1381 "Sets face foreground/background." |
1354 (if (ediff-valid-color-p color) | 1382 (if (ediff-valid-color-p color) |
1355 (if (eq ground 'foreground) | 1383 (if (eq ground 'foreground) |
1356 (set-face-foreground face color) | 1384 (set-face-foreground face color) |
1357 (set-face-background face color)) | 1385 (set-face-background face color)) |
1358 (cond ((memq face | 1386 (cond ((memq face |
1379 (t | 1407 (t |
1380 (if (ediff-if-lucid) | 1408 (if (ediff-if-lucid) |
1381 (copy-face 'modeline 'ediff-current-diff-face-A) | 1409 (copy-face 'modeline 'ediff-current-diff-face-A) |
1382 (copy-face 'highlight 'ediff-current-diff-face-A)) | 1410 (copy-face 'highlight 'ediff-current-diff-face-A)) |
1383 ))) | 1411 ))) |
1384 (ediff-get-face 'ediff-current-diff-face-A)) | 1412 'ediff-current-diff-face-A) |
1413 ;;(ediff-get-face 'ediff-current-diff-face-A)) | |
1385 "Face for highlighting the selected difference in buffer A.") | 1414 "Face for highlighting the selected difference in buffer A.") |
1386 | 1415 |
1387 (defvar ediff-current-diff-face-B | 1416 (defvar ediff-current-diff-face-B |
1388 (progn | 1417 (progn |
1389 (make-face 'ediff-current-diff-face-B) | 1418 (make-face 'ediff-current-diff-face-B) |
1396 (t | 1425 (t |
1397 (if (ediff-if-lucid) | 1426 (if (ediff-if-lucid) |
1398 (copy-face 'modeline 'ediff-current-diff-face-B) | 1427 (copy-face 'modeline 'ediff-current-diff-face-B) |
1399 (copy-face 'highlight 'ediff-current-diff-face-B)) | 1428 (copy-face 'highlight 'ediff-current-diff-face-B)) |
1400 ))) | 1429 ))) |
1401 (ediff-get-face 'ediff-current-diff-face-B)) | 1430 'ediff-current-diff-face-B) |
1431 ;;(ediff-get-face 'ediff-current-diff-face-B)) | |
1402 "Face for highlighting the selected difference in buffer B.") | 1432 "Face for highlighting the selected difference in buffer B.") |
1403 | 1433 |
1404 (defvar ediff-fine-diff-face-A | 1434 (defvar ediff-fine-diff-face-A |
1405 (progn | 1435 (progn |
1406 (make-face 'ediff-fine-diff-face-A) | 1436 (make-face 'ediff-fine-diff-face-A) |
1409 (ediff-set-face 'foreground 'ediff-fine-diff-face-A | 1439 (ediff-set-face 'foreground 'ediff-fine-diff-face-A |
1410 "Navy") | 1440 "Navy") |
1411 (ediff-set-face 'background 'ediff-fine-diff-face-A | 1441 (ediff-set-face 'background 'ediff-fine-diff-face-A |
1412 "sky blue")) | 1442 "sky blue")) |
1413 (t (set-face-underline-p 'ediff-fine-diff-face-A t)))) | 1443 (t (set-face-underline-p 'ediff-fine-diff-face-A t)))) |
1414 (ediff-get-face 'ediff-fine-diff-face-A)) | 1444 'ediff-fine-diff-face-A) |
1445 ;;(ediff-get-face 'ediff-fine-diff-face-A)) | |
1415 "Face for highlighting the refinement of the selected diff in buffer A.") | 1446 "Face for highlighting the refinement of the selected diff in buffer A.") |
1416 | 1447 |
1417 (defvar ediff-fine-diff-face-B | 1448 (defvar ediff-fine-diff-face-B |
1418 (progn | 1449 (progn |
1419 (make-face 'ediff-fine-diff-face-B) | 1450 (make-face 'ediff-fine-diff-face-B) |
1420 (or (face-differs-from-default-p 'ediff-fine-diff-face-B) | 1451 (or (face-differs-from-default-p 'ediff-fine-diff-face-B) |
1421 (cond ((ediff-display-color-p) | 1452 (cond ((ediff-display-color-p) |
1422 (ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black") | 1453 (ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black") |
1423 (ediff-set-face 'background 'ediff-fine-diff-face-B "cyan")) | 1454 (ediff-set-face 'background 'ediff-fine-diff-face-B "cyan")) |
1424 (t (set-face-underline-p 'ediff-fine-diff-face-B t)))) | 1455 (t (set-face-underline-p 'ediff-fine-diff-face-B t)))) |
1425 (ediff-get-face 'ediff-fine-diff-face-B)) | 1456 'ediff-fine-diff-face-B) |
1457 ;;(ediff-get-face 'ediff-fine-diff-face-B)) | |
1426 "Face for highlighting the refinement of the selected diff in buffer B.") | 1458 "Face for highlighting the refinement of the selected diff in buffer B.") |
1427 | 1459 |
1428 | 1460 |
1429 (defvar ediff-even-diff-face-A | 1461 (defvar ediff-even-diff-face-A |
1430 (progn | 1462 (progn |
1434 (ediff-set-face | 1466 (ediff-set-face |
1435 'foreground 'ediff-even-diff-face-A "black") | 1467 'foreground 'ediff-even-diff-face-A "black") |
1436 (ediff-set-face | 1468 (ediff-set-face |
1437 'background 'ediff-even-diff-face-A "light grey")) | 1469 'background 'ediff-even-diff-face-A "light grey")) |
1438 (t | 1470 (t |
1439 (if (ediff-if-lucid) | 1471 (copy-face 'italic 'ediff-even-diff-face-A)))) |
1440 (progn | 1472 'ediff-even-diff-face-A) |
1441 (copy-face 'highlight 'ediff-even-diff-face-A) | 1473 ;;(ediff-get-face 'ediff-even-diff-face-A)) |
1442 (invert-face 'ediff-even-diff-face-A)) | |
1443 (copy-face 'italic 'ediff-even-diff-face-A))))) | |
1444 (ediff-get-face 'ediff-even-diff-face-A)) | |
1445 "Face used to highlight even-numbered differences in buffer A.") | 1474 "Face used to highlight even-numbered differences in buffer A.") |
1446 | 1475 |
1447 (defvar ediff-even-diff-face-B | 1476 (defvar ediff-even-diff-face-B |
1448 (progn | 1477 (progn |
1449 (make-face 'ediff-even-diff-face-B) | 1478 (make-face 'ediff-even-diff-face-B) |
1452 (ediff-set-face | 1481 (ediff-set-face |
1453 'foreground 'ediff-even-diff-face-B "White") | 1482 'foreground 'ediff-even-diff-face-B "White") |
1454 (ediff-set-face | 1483 (ediff-set-face |
1455 'background 'ediff-even-diff-face-B "Gray")) | 1484 'background 'ediff-even-diff-face-B "Gray")) |
1456 (t | 1485 (t |
1457 (if (ediff-if-lucid) | 1486 (copy-face 'italic 'ediff-even-diff-face-B)))) |
1458 (copy-face 'highlight 'ediff-even-diff-face-B) | 1487 'ediff-even-diff-face-B) |
1459 (copy-face 'italic 'ediff-even-diff-face-B))))) | 1488 ;;(ediff-get-face 'ediff-even-diff-face-B)) |
1460 (ediff-get-face 'ediff-even-diff-face-B)) | |
1461 "Face used to highlight even-numbered differences in buffer B.") | 1489 "Face used to highlight even-numbered differences in buffer B.") |
1462 | 1490 |
1463 (defvar ediff-odd-diff-face-A | 1491 (defvar ediff-odd-diff-face-A |
1464 (progn | 1492 (progn |
1465 (make-face 'ediff-odd-diff-face-A) | 1493 (make-face 'ediff-odd-diff-face-A) |
1468 (ediff-set-face | 1496 (ediff-set-face |
1469 'foreground 'ediff-odd-diff-face-A "White") | 1497 'foreground 'ediff-odd-diff-face-A "White") |
1470 (ediff-set-face | 1498 (ediff-set-face |
1471 'background 'ediff-odd-diff-face-A "Gray")) | 1499 'background 'ediff-odd-diff-face-A "Gray")) |
1472 (t | 1500 (t |
1473 (if (ediff-if-lucid) | 1501 (copy-face 'italic 'ediff-odd-diff-face-A)))) |
1474 (copy-face 'highlight 'ediff-odd-diff-face-A) | 1502 'ediff-odd-diff-face-A) |
1475 (copy-face 'italic 'ediff-odd-diff-face-A))))) | 1503 ;;(ediff-get-face 'ediff-odd-diff-face-A)) |
1476 (ediff-get-face 'ediff-odd-diff-face-A)) | |
1477 "Face used to highlight odd-numbered differences in buffer A.") | 1504 "Face used to highlight odd-numbered differences in buffer A.") |
1478 | 1505 |
1479 (defvar ediff-odd-diff-face-B | 1506 (defvar ediff-odd-diff-face-B |
1480 (progn | 1507 (progn |
1481 (make-face 'ediff-odd-diff-face-B) | 1508 (make-face 'ediff-odd-diff-face-B) |
1484 (ediff-set-face | 1511 (ediff-set-face |
1485 'foreground 'ediff-odd-diff-face-B "Black") | 1512 'foreground 'ediff-odd-diff-face-B "Black") |
1486 (ediff-set-face | 1513 (ediff-set-face |
1487 'background 'ediff-odd-diff-face-B "light grey")) | 1514 'background 'ediff-odd-diff-face-B "light grey")) |
1488 (t | 1515 (t |
1489 (if (ediff-if-lucid) | 1516 (copy-face 'italic 'ediff-odd-diff-face-B)))) |
1490 (progn | 1517 'ediff-odd-diff-face-B) |
1491 (copy-face 'highlight 'ediff-odd-diff-face-B) | 1518 ;;(ediff-get-face 'ediff-odd-diff-face-B)) |
1492 (invert-face 'ediff-odd-diff-face-B)) | |
1493 (copy-face 'italic 'ediff-odd-diff-face-B))))) | |
1494 (ediff-get-face 'ediff-odd-diff-face-B)) | |
1495 "Face used to highlight odd-numbered differences in buffer B.") | 1519 "Face used to highlight odd-numbered differences in buffer B.") |
1496 | 1520 |
1497 ;; Create *-var faces. These are the actual faces used to highlight | 1521 ;; Create *-var faces. These are the actual faces used to highlight |
1498 ;; odd-numbered difference regions. | 1522 ;; odd-numbered difference regions. |
1499 ;; They are used as follows: when highlighting is turned on, | 1523 ;; They are used as follows: when highlighting is turned on, |
1541 (set overlay (ediff-make-overlay (point-max) (point-max) buffer)) | 1565 (set overlay (ediff-make-overlay (point-max) (point-max) buffer)) |
1542 (ediff-overlay-put (eval overlay) 'face face) | 1566 (ediff-overlay-put (eval overlay) 'face face) |
1543 (ediff-overlay-put (eval overlay) 'ediff ediff-control-buffer) | 1567 (ediff-overlay-put (eval overlay) 'ediff ediff-control-buffer) |
1544 )) | 1568 )) |
1545 | 1569 |
1546 ;; Computes priority of ediff overlay. | 1570 ;; Compute priority of ediff overlay. |
1547 (defun ediff-highest-priority (start end buffer) | 1571 (defun ediff-highest-priority (start end buffer) |
1548 (let ((pos (max 1 (1- start))) | 1572 (let ((pos (max 1 (1- start))) |
1549 ovr-list) | 1573 ovr-list) |
1550 (if (ediff-if-lucid) | 1574 (if (ediff-if-lucid) |
1551 (+ 2 mouse-highlight-priority) | 1575 (1+ ediff-shaded-overlay-priority) |
1552 (ediff-eval-in-buffer | 1576 (ediff-eval-in-buffer |
1553 buffer | 1577 buffer |
1554 (while (< pos (min (point-max) (1+ end))) | 1578 (while (< pos (min (point-max) (1+ end))) |
1555 (setq ovr-list (append (overlays-at pos) ovr-list)) | 1579 (setq ovr-list (append (overlays-at pos) ovr-list)) |
1556 (setq pos (next-overlay-change pos))) | 1580 (setq pos (next-overlay-change pos))) |
1642 ;;; So I moved these to top level. But the conditionals on | 1666 ;;; So I moved these to top level. But the conditionals on |
1643 ;;; purify-flag make these no-ops when you load ediff. | 1667 ;;; purify-flag make these no-ops when you load ediff. |
1644 ;;; They only do something in loaddefs.el. | 1668 ;;; They only do something in loaddefs.el. |
1645 ;;;###autoload | 1669 ;;;###autoload |
1646 (if purify-flag | 1670 (if purify-flag |
1647 (defvar menu-bar-epatch-menu | 1671 (progn |
1648 (make-sparse-keymap "Epatch")) | 1672 (defvar menu-bar-epatch-menu (make-sparse-keymap "Epatch")) |
1649 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu)) | 1673 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu)) |
1650 (defvar menu-bar-ediff-menu (make-sparse-keymap "Ediff")) | 1674 (defvar menu-bar-ediff-menu (make-sparse-keymap "Ediff")) |
1651 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))) | 1675 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu)))) |
1652 | 1676 |
1653 | 1677 |
1654 ;;;###autoload | 1678 ;;;###autoload |
1655 (if purify-flag | 1679 (if purify-flag |
1656 (define-key menu-bar-ediff-menu [rcs-ediff] | 1680 (progn |
1657 '("Compare with a version via RCS ..." . rcs-ediff)) | 1681 (define-key menu-bar-ediff-menu [rcs-ediff] |
1658 (define-key menu-bar-ediff-menu [vc-ediff] | 1682 '("Compare with a version via RCS ..." . rcs-ediff)) |
1659 '("Compare with a version via VC ..." . vc-ediff)) | 1683 (define-key menu-bar-ediff-menu [vc-ediff] |
1660 (define-key menu-bar-ediff-menu [ediff-buffers] | 1684 '("Compare with a version via VC ..." . vc-ediff)) |
1661 '("Compare buffers ..." . ediff-buffers)) | 1685 (define-key menu-bar-ediff-menu [ediff-buffers] |
1662 (define-key menu-bar-ediff-menu [ediff-files] | 1686 '("Compare buffers ..." . ediff-buffers)) |
1663 '("Compare files ..." . ediff-files))) | 1687 (define-key menu-bar-ediff-menu [ediff-files] |
1688 '("Compare files ..." . ediff-files)))) | |
1664 | 1689 |
1665 ;;;###autoload | 1690 ;;;###autoload |
1666 (if purify-flag | 1691 (if purify-flag |
1667 (define-key menu-bar-epatch-menu [ediff-patch-buffer] | 1692 (progn |
1668 '("To a Buffer ..." . ediff-patch-buffer)) | 1693 (define-key menu-bar-epatch-menu [ediff-patch-buffer] |
1669 (define-key menu-bar-epatch-menu [ediff-patch-file] | 1694 '("To a Buffer ..." . ediff-patch-buffer)) |
1670 '("To a File ..." . ediff-patch-file))) | 1695 (define-key menu-bar-epatch-menu [ediff-patch-file] |
1696 '("To a File ..." . ediff-patch-file)))) | |
1671 | 1697 |
1672 (if (and window-system ediff-want-default-menus (ediff-frame-has-menubar) | 1698 (if (and window-system ediff-want-default-menus (ediff-frame-has-menubar) |
1673 (ediff-if-lucid)) | 1699 (ediff-if-lucid)) |
1674 (progn ;; Lucid menu bars | 1700 (progn ;; Lucid menu bars |
1675 (defvar ediff-menu | 1701 (defvar ediff-menu |
1688 (add-menu '("File") "Apply Patch" | 1714 (add-menu '("File") "Apply Patch" |
1689 epatch-menu | 1715 epatch-menu |
1690 "New Screen") | 1716 "New Screen") |
1691 ;; Displays as a solid horizontal line | 1717 ;; Displays as a solid horizontal line |
1692 (add-menu-item '("File") "---" nil nil "New Screen"))) | 1718 (add-menu-item '("File") "---" nil nil "New Screen"))) |
1719 | |
1693 | 1720 |
1694 | 1721 |
1695 (defun ediff-setup-keymap () | 1722 (defun ediff-setup-keymap () |
1696 "Set up the keymap used in the control buffer of Ediff." | 1723 "Set up the keymap used in the control buffer of Ediff." |
1697 (setq ediff-mode-map (make-sparse-keymap)) | 1724 (setq ediff-mode-map (make-sparse-keymap)) |
1853 ;; all these must be inside ediff-eval-in-buffer control-buffer, | 1880 ;; all these must be inside ediff-eval-in-buffer control-buffer, |
1854 ;; since these vars are local to control-buffer | 1881 ;; since these vars are local to control-buffer |
1855 ;; These won't run if there are errors in diff | 1882 ;; These won't run if there are errors in diff |
1856 (ediff-eval-in-buffer | 1883 (ediff-eval-in-buffer |
1857 ediff-A-buffer | 1884 ediff-A-buffer |
1858 (run-hooks 'ediff-prepare-buffer-hooks) | |
1859 (add-hook 'local-write-file-hooks 'ediff-block-write-file) | 1885 (add-hook 'local-write-file-hooks 'ediff-block-write-file) |
1860 (setq before-change-function 'ediff-before-change-guard) | 1886 (setq before-change-function 'ediff-before-change-guard) |
1861 ;; add control-buffer to the list of sessions | 1887 ;; add control-buffer to the list of sessions |
1862 (or (memq control-buffer ediff-this-buffer-control-sessions) | 1888 (or (memq control-buffer ediff-this-buffer-control-sessions) |
1863 (setq ediff-this-buffer-control-sessions | 1889 (setq ediff-this-buffer-control-sessions |
1864 (cons control-buffer ediff-this-buffer-control-sessions))) | 1890 (cons control-buffer ediff-this-buffer-control-sessions))) |
1865 (setq mode-line-buffer-identification '("A: %b"))) | 1891 (setq mode-line-buffer-identification |
1892 (cons "A: " | |
1893 (if (string-match "\\(^ \\|^[^ \t]*: \\)" | |
1894 (car mode-line-buffer-identification)) | |
1895 (cons (substring (car mode-line-buffer-identification) | |
1896 (match-end 0)) | |
1897 (cdr mode-line-buffer-identification)) | |
1898 mode-line-buffer-identification))) | |
1899 (run-hooks 'ediff-prepare-buffer-hooks)) | |
1866 (ediff-eval-in-buffer | 1900 (ediff-eval-in-buffer |
1867 ediff-B-buffer | 1901 ediff-B-buffer |
1868 (run-hooks 'ediff-prepare-buffer-hooks) | |
1869 (add-hook 'local-write-file-hooks 'ediff-block-write-file) | 1902 (add-hook 'local-write-file-hooks 'ediff-block-write-file) |
1870 (setq before-change-function 'ediff-before-change-guard) | 1903 (setq before-change-function 'ediff-before-change-guard) |
1871 ;; add control-buffer to the list of sessions | 1904 ;; add control-buffer to the list of sessions |
1872 (or (memq control-buffer ediff-this-buffer-control-sessions) | 1905 (or (memq control-buffer ediff-this-buffer-control-sessions) |
1873 (setq ediff-this-buffer-control-sessions | 1906 (setq ediff-this-buffer-control-sessions |
1874 (cons control-buffer ediff-this-buffer-control-sessions))) | 1907 (cons control-buffer ediff-this-buffer-control-sessions))) |
1875 (setq mode-line-buffer-identification '("B: %b"))) | 1908 (setq mode-line-buffer-identification |
1909 (cons "B: " | |
1910 (if (string-match "\\(^ \\|^[^ \t]*: \\)" | |
1911 (car mode-line-buffer-identification)) | |
1912 (cons (substring (car mode-line-buffer-identification) | |
1913 (match-end 0)) | |
1914 (cdr mode-line-buffer-identification)) | |
1915 mode-line-buffer-identification))) | |
1916 (run-hooks 'ediff-prepare-buffer-hooks)) | |
1876 | 1917 |
1877 (ediff-eval-in-buffer control-buffer | 1918 (ediff-eval-in-buffer control-buffer |
1878 (run-hooks 'startup-hooks 'ediff-startup-hooks) | 1919 (run-hooks 'startup-hooks 'ediff-startup-hooks) |
1879 (setq buffer-read-only t))))) | 1920 (setq buffer-read-only t))))) |
1880 | 1921 |
3571 (t | 3612 (t |
3572 (list (format "%%b: diff %d of %d" | 3613 (list (format "%%b: diff %d of %d" |
3573 (1+ ediff-current-difference) | 3614 (1+ ediff-current-difference) |
3574 ediff-number-of-differences))))) | 3615 ediff-number-of-differences))))) |
3575 ;; Force mode-line redisplay | 3616 ;; Force mode-line redisplay |
3576 (set-buffer-modified-p (buffer-modified-p))) | 3617 (force-mode-line-update)) |
3577 | 3618 |
3578 | 3619 |
3579 | 3620 |
3580 ;; Verify that we have a difference selected. | 3621 ;; Verify that we have a difference selected. |
3581 (defun ediff-validate-difference () | 3622 (defun ediff-validate-difference () |
4290 | 4331 |
4291 | 4332 |
4292 (provide 'ediff) | 4333 (provide 'ediff) |
4293 | 4334 |
4294 ;;; ediff.el ends here | 4335 ;;; ediff.el ends here |
4295 | |
4296 | |
4297 | |
4298 | |
4299 |