/[emacs]/emacs/lisp/ediff-init.el
ViewVC logotype

Diff of /emacs/lisp/ediff-init.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53 by kifer, Mon Dec 24 05:50:31 2001 UTC revision 1.54 by kifer, Tue Jan 8 04:36:01 2002 UTC
# Line 1  Line 1 
1  ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff  ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
2    
3  ;; Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.  ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc.
4    
5  ;; Author: Michael Kifer <kifer@cs.sunysb.edu>  ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
6    
7  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
8    
# Line 35  Line 35 
35  (defvar ediff-whitespace)  (defvar ediff-whitespace)
36  (defvar ediff-multiframe)  (defvar ediff-multiframe)
37  (defvar ediff-use-toolbar-p)  (defvar ediff-use-toolbar-p)
38    (defvar mswindowsx-bitmap-file-path)
39    
40  (and noninteractive  (and noninteractive
41       (eval-when-compile       (eval-when-compile
# Line 46  Line 47 
47  ;; Is it Emacs?  ;; Is it Emacs?
48  (defconst ediff-emacs-p (not ediff-xemacs-p))  (defconst ediff-emacs-p (not ediff-xemacs-p))
49    
50    ;; This is used to avoid compilation warnings. When emacs/xemacs forms can
51    ;; generate compile time warnings, we use this macro.
52    ;; In this case, the macro will expand into the form that is appropriate to the
53    ;; compiler at hand.
54    ;; Suggested by rms.
55    (defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form)
56      (if (string-match "XEmacs" emacs-version)
57          xemacs-form emacs-form))
58    
59  (defvar ediff-force-faces nil  (defvar ediff-force-faces nil
60    "If t, Ediff will think that it is running on a display that supports faces.    "If t, Ediff will think that it is running on a display that supports faces.
61  This is provided as a temporary relief for users of face-capable displays  This is provided as a temporary relief for users of face-capable displays
# Line 53  that Ediff doesn't know about.") Line 63  that Ediff doesn't know about.")
63    
64  ;; Are we running as a window application or on a TTY?  ;; Are we running as a window application or on a TTY?
65  (defsubst ediff-device-type ()  (defsubst ediff-device-type ()
66    (if ediff-emacs-p    (ediff-cond-compile-for-xemacs-or-emacs
67        window-system     (device-type (selected-device)) ; xemacs form
68      (device-type (selected-device))))     window-system  ; emacs form
69       ))
70    
71  ;; in XEmacs: device-type is tty on tty and stream in batch.  ;; in XEmacs: device-type is tty on tty and stream in batch.
72  (defun ediff-window-display-p ()  (defun ediff-window-display-p ()
# Line 69  that Ediff doesn't know about.") Line 80  that Ediff doesn't know about.")
80          (ediff-emacs-p (memq (ediff-device-type) '(pc)))          (ediff-emacs-p (memq (ediff-device-type) '(pc)))
81          (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))))          (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))))
82    
83    ;; toolbar support for emacs hasn't been implemented in ediff
84  (defun ediff-has-toolbar-support-p ()  (defun ediff-has-toolbar-support-p ()
85    (and ediff-xemacs-p    (ediff-cond-compile-for-xemacs-or-emacs
86         (featurep 'toolbar)     (and (featurep 'toolbar) (console-on-window-system-p)) ; xemacs form
87         (console-on-window-system-p)))     nil ; emacs form
88       ))
89    
90  (defun ediff-use-toolbar-p ()  (defun ediff-use-toolbar-p ()
91    (and (ediff-has-toolbar-support-p)    ;Can it do it ?    (and (ediff-has-toolbar-support-p)    ;Can it do it ?
# Line 108  that Ediff doesn't know about.") Line 121  that Ediff doesn't know about.")
121  ;; The Ediff control buffer  ;; The Ediff control buffer
122  (ediff-defvar-local ediff-control-buffer nil "")  (ediff-defvar-local ediff-control-buffer nil "")
123    
124    (ediff-defvar-local ediff-temp-indirect-buffer nil
125      "If t, the buffer is a temporary indirect buffer.
126    It needs to be killed when we quit the session.")
127    
128    
129  ;; Association between buff-type and ediff-buffer-*  ;; Association between buff-type and ediff-buffer-*
130  (defconst ediff-buffer-alist  (defconst ediff-buffer-alist
# Line 731  to temp files when Ediff needs to find f Line 748  to temp files when Ediff needs to find f
748    :group 'ediff)    :group 'ediff)
749    
750    
751  (if ediff-xemacs-p  (ediff-cond-compile-for-xemacs-or-emacs
752      (progn   (progn ; xemacs
753        (fset 'ediff-read-event (symbol-function 'next-command-event))     (fset 'ediff-read-event (symbol-function 'next-command-event))
754        (fset 'ediff-overlayp (symbol-function 'extentp))     (fset 'ediff-overlayp (symbol-function 'extentp))
755        (fset 'ediff-make-overlay (symbol-function 'make-extent))     (fset 'ediff-make-overlay (symbol-function 'make-extent))
756        (fset 'ediff-delete-overlay (symbol-function 'delete-extent)))     (fset 'ediff-delete-overlay (symbol-function 'delete-extent)))
757    (fset 'ediff-read-event (symbol-function 'read-event))   (progn ; emacs
758    (fset 'ediff-overlayp (symbol-function 'overlayp))     (fset 'ediff-read-event (symbol-function 'read-event))
759    (fset 'ediff-make-overlay (symbol-function 'make-overlay))     (fset 'ediff-overlayp (symbol-function 'overlayp))
760    (fset 'ediff-delete-overlay (symbol-function 'delete-overlay)))     (fset 'ediff-make-overlay (symbol-function 'make-overlay))
761       (fset 'ediff-delete-overlay (symbol-function 'delete-overlay)))
762     )
763    
764  ;; Check the current version against the major and minor version numbers  ;; Check the current version against the major and minor version numbers
765  ;; using op: cur-vers op major.minor If emacs-major-version or  ;; using op: cur-vers op major.minor If emacs-major-version or
# Line 772  to temp files when Ediff needs to find f Line 791  to temp files when Ediff needs to find f
791    
792  (defun ediff-color-display-p ()  (defun ediff-color-display-p ()
793    (condition-case nil    (condition-case nil
794        (if ediff-emacs-p        (ediff-cond-compile-for-xemacs-or-emacs
795            (if (fboundp 'display-color-p)         (eq (device-class (selected-device)) 'color) ; xemacs form
796                (display-color-p)         (if (fboundp 'display-color-p) ; emacs form
797              (x-display-color-p))             (display-color-p)
798          (eq (device-class (selected-device)) 'color))           (x-display-color-p))
799      (error          )
800       nil)))      (error nil)))
801    
802    
803  (if (ediff-has-face-support-p)  (if (ediff-has-face-support-p)
804      (if ediff-xemacs-p      (ediff-cond-compile-for-xemacs-or-emacs
805          (progn       (progn ; xemacs
806            (fset 'ediff-valid-color-p (symbol-function 'valid-color-name-p))         (defalias 'ediff-valid-color-p 'valid-color-name-p)
807            (fset 'ediff-get-face (symbol-function 'get-face)))         (defalias 'ediff-get-face 'get-face))
808        (fset 'ediff-valid-color-p (symbol-function       (progn ; emacs
809                                    (if (fboundp 'color-defined-p)         (defalias 'ediff-valid-color-p (if (fboundp 'color-defined-p)
810                                        'color-defined-p                                            'color-defined-p
811                                      'x-color-defined-p)))                                          'x-color-defined-p))
812        (fset 'ediff-get-face (symbol-function 'internal-get-face))))         (defalias 'ediff-get-face 'internal-get-face))
813         ))
814    
815  (if (ediff-window-display-p)  (if (ediff-window-display-p)
816      (if ediff-xemacs-p      (ediff-cond-compile-for-xemacs-or-emacs
817          (progn       (progn   ; xemacs
818            (fset 'ediff-display-pixel-width         (fset 'ediff-display-pixel-width (symbol-function 'device-pixel-width))
819                  (symbol-function 'device-pixel-width))         (fset 'ediff-display-pixel-height
820            (fset 'ediff-display-pixel-height               (symbol-function 'device-pixel-height)))
821                  (symbol-function 'device-pixel-height)))       (progn   ; emacs
822        (fset 'ediff-display-pixel-width (symbol-function         (fset 'ediff-display-pixel-width
823                                          (if (fboundp 'display-pixel-width)               (if (fboundp 'display-pixel-width)
824                                              'display-pixel-width                   (symbol-function 'display-pixel-width)
825                                            'x-display-pixel-width)))                 (symbol-function 'x-display-pixel-width)))
826        (fset 'ediff-display-pixel-height (symbol-function         (fset 'ediff-display-pixel-height
827                                           (if (fboundp 'display-pixel-height)               (if (fboundp 'display-pixel-height)
828                                               'display-pixel-height                   (symbol-function 'display-pixel-height)
829                                             'x-display-pixel-height)))))                 (symbol-function 'x-display-pixel-height))))
830         ))
831    
832  ;; A-list of current-diff-overlay symbols associated with buf types  ;; A-list of current-diff-overlay symbols associated with buf types
833  (defconst ediff-current-diff-overlay-alist  (defconst ediff-current-diff-overlay-alist
# Line 823  to temp files when Ediff needs to find f Line 844  to temp files when Ediff needs to find f
844      (Ancestor . ediff-current-diff-face-Ancestor)))      (Ancestor . ediff-current-diff-face-Ancestor)))
845    
846    
 (defun ediff-make-current-diff-overlay (type)  
   (if (ediff-has-face-support-p)  
       (let ((overlay (ediff-get-symbol-from-alist  
                       type ediff-current-diff-overlay-alist))  
             (buffer (ediff-get-buffer type))  
             (face (face-name  
                    (symbol-value  
                     (ediff-get-symbol-from-alist  
                      type ediff-current-diff-face-alist)))))  
         (set overlay  
              (ediff-make-bullet-proof-overlay (point-max) (point-max) buffer))  
         (ediff-set-overlay-face (symbol-value overlay) face)  
         (ediff-overlay-put (symbol-value overlay) 'ediff ediff-control-buffer))  
     ))  
   
847  (defun ediff-set-overlay-face (extent face)  (defun ediff-set-overlay-face (extent face)
848    (ediff-overlay-put extent 'face face)    (ediff-overlay-put extent 'face face)
849    (ediff-overlay-put extent 'help-echo 'ediff-region-help-echo))    (ediff-overlay-put extent 'help-echo 'ediff-region-help-echo))
# Line 1194  this variable represents.") Line 1200  this variable represents.")
1200  (defun ediff-highest-priority (start end buffer)  (defun ediff-highest-priority (start end buffer)
1201    (let ((pos (max 1 (1- start)))    (let ((pos (max 1 (1- start)))
1202          ovr-list)          ovr-list)
1203      (if ediff-xemacs-p      (ediff-cond-compile-for-xemacs-or-emacs
1204          (1+ ediff-shadow-overlay-priority)       (1+ ediff-shadow-overlay-priority)  ; xemacs form
1205        (ediff-with-current-buffer buffer       ;; emacs form
1206          (while (< pos (min (point-max) (1+ end)))       (ediff-with-current-buffer buffer
1207            (setq ovr-list (append (overlays-at pos) ovr-list))         (while (< pos (min (point-max) (1+ end)))
1208            (setq pos (next-overlay-change pos)))           (setq ovr-list (append (overlays-at pos) ovr-list))
1209          (+ 1 ediff-shadow-overlay-priority           (setq pos (next-overlay-change pos)))
1210             (apply 'max         (+ 1 ediff-shadow-overlay-priority
1211                    (cons            (apply 'max
1212                     1                   (cons
1213                     (mapcar                    1
1214                      (lambda (ovr)                    (mapcar
1215                        (if (and ovr                     (lambda (ovr)
1216                                 ;; exclude ediff overlays from priority                       (if (and ovr
1217                                 ;; calculation, or else priority will keep                                ;; exclude ediff overlays from priority
1218                                 ;; increasing                                ;; calculation, or else priority will keep
1219                                 (null (ediff-overlay-get ovr 'ediff))                                ;; increasing
1220                                 (null (ediff-overlay-get ovr 'ediff-diff-num)))                                (null (ediff-overlay-get ovr 'ediff))
1221                            ;; use the overlay priority or 0                                (null (ediff-overlay-get ovr 'ediff-diff-num)))
1222                            (or (ediff-overlay-get ovr 'priority) 0)                           ;; use the overlay priority or 0
1223                          0))                           (or (ediff-overlay-get ovr 'priority) 0)
1224                      ovr-list)                         0))
1225                     )                     ovr-list)
1226                    ))                    )
1227          ))))                   )))
1228         ) ; ediff-cond-compile-for-xemacs-or-emacs
1229        ))
1230    
1231    
1232  (defvar ediff-toggle-read-only-function nil  (defvar ediff-toggle-read-only-function nil
# Line 1306  This default should work without changes Line 1314  This default should work without changes
1314  (ediff-defvar-local ediff-temp-file-C nil "")  (ediff-defvar-local ediff-temp-file-C nil "")
1315    
1316    
 ;;; In-line functions  
   
1317  ;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check  ;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check
1318  ;; if find-file-name-handler is defined for 'file-local-copy  ;; if find-file-name-handler is defined for 'file-local-copy
1319  (defun ediff-file-remote-p (file-name)  (defun ediff-file-remote-p (file-name)
# Line 1375  This default should work without changes Line 1381  This default should work without changes
1381    (ediff-paint-background-regions-in-one-buffer    (ediff-paint-background-regions-in-one-buffer
1382     'Ancestor unhighlight))     'Ancestor unhighlight))
1383    
 (defun ediff-highlight-diff-in-one-buffer (n buf-type)  
   (if (ediff-buffer-live-p (ediff-get-buffer buf-type))  
       (let* ((buff (ediff-get-buffer buf-type))  
              (last (ediff-with-current-buffer buff (point-max)))  
              (begin (ediff-get-diff-posn buf-type 'beg n))  
              (end (ediff-get-diff-posn buf-type 'end n))  
              (xtra (if (equal begin end) 1 0))  
              (end-hilit (min last (+ end xtra)))  
              (current-diff-overlay  
               (symbol-value  
                (ediff-get-symbol-from-alist  
                 buf-type ediff-current-diff-overlay-alist))))  
   
         (if ediff-xemacs-p  
             (ediff-move-overlay current-diff-overlay begin end-hilit)  
           (ediff-move-overlay current-diff-overlay begin end-hilit buff))  
         (ediff-overlay-put current-diff-overlay 'priority  
                            (ediff-highest-priority begin end-hilit buff))  
         (ediff-overlay-put current-diff-overlay 'ediff-diff-num n)  
   
         ;; unhighlight the background overlay for diff n so it won't  
         ;; interfere with the current diff overlay  
         (ediff-set-overlay-face (ediff-get-diff-overlay n buf-type) nil)  
         )))  
   
   
 (defun ediff-unhighlight-diff-in-one-buffer (buf-type)  
   (if (ediff-buffer-live-p (ediff-get-buffer buf-type))  
       (let ((current-diff-overlay  
              (symbol-value  
               (ediff-get-symbol-from-alist  
                buf-type ediff-current-diff-overlay-alist)))  
             (overlay  
              (ediff-get-diff-overlay ediff-current-difference buf-type))  
             )  
   
         (ediff-move-overlay current-diff-overlay 1 1)  
   
         ;; rehighlight the overlay in the background of the  
         ;; current difference region  
         (ediff-set-overlay-face  
          overlay  
          (if (and (ediff-has-face-support-p)  
                   ediff-use-faces ediff-highlight-all-diffs)  
              (ediff-background-face buf-type ediff-current-difference)))  
         )))  
   
 (defun ediff-unhighlight-diffs-totally-in-one-buffer (buf-type)  
   (ediff-unselect-and-select-difference -1)  
   (if (and (ediff-has-face-support-p) ediff-use-faces)  
       (let* ((inhibit-quit t)  
              (current-diff-overlay-var  
               (ediff-get-symbol-from-alist  
                buf-type ediff-current-diff-overlay-alist))  
              (current-diff-overlay (symbol-value current-diff-overlay-var)))  
         (ediff-paint-background-regions 'unhighlight)  
         (if (ediff-overlayp current-diff-overlay)  
             (ediff-delete-overlay current-diff-overlay))  
         (set current-diff-overlay-var nil)  
         )))  
   
   
 (defsubst ediff-highlight-diff (n)  
   "Put face on diff N.  Invoked for X displays only."  
   (ediff-highlight-diff-in-one-buffer n 'A)  
   (ediff-highlight-diff-in-one-buffer n 'B)  
   (ediff-highlight-diff-in-one-buffer n 'C)  
   (ediff-highlight-diff-in-one-buffer n 'Ancestor)  
   )  
   
   
 (defsubst ediff-unhighlight-diff ()  
   "Remove overlays from buffers A, B, and C."  
   (ediff-unhighlight-diff-in-one-buffer 'A)  
   (ediff-unhighlight-diff-in-one-buffer 'B)  
   (ediff-unhighlight-diff-in-one-buffer 'C)  
   (ediff-unhighlight-diff-in-one-buffer 'Ancestor)  
   )  
   
 ;; delete highlighting overlays, restore faces to their original form  
 (defsubst ediff-unhighlight-diffs-totally ()  
   (ediff-unhighlight-diffs-totally-in-one-buffer 'A)  
   (ediff-unhighlight-diffs-totally-in-one-buffer 'B)  
   (ediff-unhighlight-diffs-totally-in-one-buffer 'C)  
   (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor)  
   )  
   
1384    
1385  ;; arg is a record for a given diff in a difference vector  ;; arg is a record for a given diff in a difference vector
1386  ;; this record is itself a vector  ;; this record is itself a vector
# Line 1481  This default should work without changes Line 1400  This default should work without changes
1400        (ediff-clear-fine-differences-in-one-buffer n 'C)))        (ediff-clear-fine-differences-in-one-buffer n 'C)))
1401    
1402    
 (defsubst ediff-convert-fine-diffs-to-overlays (diff-list region-num)  
   (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num)  
   (ediff-set-fine-overlays-in-one-buffer 'B diff-list region-num)  
   (if ediff-3way-job  
       (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num)  
     ))  
   
1403  (defsubst ediff-mouse-event-p (event)  (defsubst ediff-mouse-event-p (event)
1404    (if ediff-xemacs-p    (ediff-cond-compile-for-xemacs-or-emacs
1405        (button-event-p event)     (button-event-p event) ; xemacs form
1406      (string-match "mouse" (format "%S" (event-basic-type event)))     (string-match "mouse" (format "%S" (event-basic-type event))) ; emacs form
1407      ))     ))
1408    
1409    
1410  (defsubst ediff-key-press-event-p (event)  (defsubst ediff-key-press-event-p (event)
1411    (if ediff-xemacs-p    (ediff-cond-compile-for-xemacs-or-emacs
1412        (key-press-event-p event)     (key-press-event-p event) ; xemacs form
1413      (or (char-or-string-p event) (symbolp event))))     (or (char-or-string-p event) (symbolp event)) ; emacs form
1414       ))
1415    
1416  (defun ediff-event-point (event)  (defun ediff-event-point (event)
1417    (cond ((ediff-mouse-event-p event)    (cond ((ediff-mouse-event-p event)
1418           (if ediff-xemacs-p           (ediff-cond-compile-for-xemacs-or-emacs
1419               (event-point event)            (event-point event)               ; xemacs form
1420             (posn-point (event-start event))))            (posn-point (event-start event))  ; emacs form
1421              )
1422             )
1423          ((ediff-key-press-event-p event)          ((ediff-key-press-event-p event)
1424           (point))           (point))
1425          (t (error))))          (t (error nil))))
1426    
1427  (defun ediff-event-buffer (event)  (defun ediff-event-buffer (event)
1428    (cond ((ediff-mouse-event-p event)    (cond ((ediff-mouse-event-p event)
1429           (if ediff-xemacs-p           (ediff-cond-compile-for-xemacs-or-emacs
1430               (event-buffer event)            (event-buffer event)                              ; xemacs form
1431             (window-buffer (posn-window (event-start event)))))            (window-buffer (posn-window (event-start event))) ; emacs form
1432              )
1433             )
1434          ((ediff-key-press-event-p event)          ((ediff-key-press-event-p event)
1435           (current-buffer))           (current-buffer))
1436          (t (error))))          (t (error nil))))
1437    
1438    (defun ediff-event-key (event-or-key)
1439      (ediff-cond-compile-for-xemacs-or-emacs
1440       (if (eventp event-or-key) (event-key event-or-key) event-or-key) ; xemacs
1441       event-or-key   ; emacs form
1442       ))
1443    
1444    
1445  (defsubst ediff-frame-iconified-p (frame)  (defsubst ediff-frame-iconified-p (frame)
1446    (if (and (ediff-window-display-p) (frame-live-p frame))    (if (and (ediff-window-display-p) (frame-live-p frame))
1447        (if ediff-xemacs-p        (ediff-cond-compile-for-xemacs-or-emacs
1448            (frame-iconified-p frame)         (frame-iconified-p frame)          ; xemacs form
1449          (eq (frame-visible-p frame) 'icon))))         (eq (frame-visible-p frame) 'icon) ; emacs form
1450           )
1451        ))
1452    
1453  (defsubst ediff-window-visible-p (wind)  (defsubst ediff-window-visible-p (wind)
1454    ;; under TTY, window-live-p also means window is visible    ;; under TTY, window-live-p also means window is visible
# Line 1533  This default should work without changes Line 1458  This default should work without changes
1458    
1459    
1460  (defsubst ediff-frame-char-width (frame)  (defsubst ediff-frame-char-width (frame)
1461    (if ediff-xemacs-p    (ediff-cond-compile-for-xemacs-or-emacs
1462        (/ (frame-pixel-width frame) (frame-width frame))     (/ (frame-pixel-width frame) (frame-width frame)) ; xemacs
1463      (frame-char-width frame)))     (frame-char-width frame) ; emacs
1464       ))
1465    
1466  (defun ediff-reset-mouse (&optional frame do-not-grab-mouse)  (defun ediff-reset-mouse (&optional frame do-not-grab-mouse)
1467    (or frame (setq frame (selected-frame)))    (or frame (setq frame (selected-frame)))
# Line 1580  This default should work without changes Line 1506  This default should work without changes
1506              (t nil))))              (t nil))))
1507    
1508  (defsubst ediff-frame-char-height (frame)  (defsubst ediff-frame-char-height (frame)
1509    (if ediff-xemacs-p    (ediff-cond-compile-for-xemacs-or-emacs
1510        (glyph-height ediff-H-glyph (selected-window frame))     (glyph-height ediff-H-glyph (selected-window frame)) ; xemacs cse
1511      (frame-char-height frame)))     (frame-char-height frame) ; emacs case
1512       )
1513      )
1514    
1515  ;; Some overlay functions  ;; Some overlay functions
1516    
1517  (defsubst ediff-overlay-start (overl)  (defsubst ediff-overlay-start (overl)
1518    (if (ediff-overlayp overl)    (if (ediff-overlayp overl)
1519        (if ediff-emacs-p        (ediff-cond-compile-for-xemacs-or-emacs
1520            (overlay-start overl)         (extent-start-position overl) ; xemacs form
1521          (extent-start-position overl))))         (overlay-start overl)         ; emacs form
1522           )
1523        ))
1524    
1525  (defsubst ediff-overlay-end  (overl)  (defsubst ediff-overlay-end  (overl)
1526    (if (ediff-overlayp overl)    (if (ediff-overlayp overl)
1527        (if ediff-emacs-p        (ediff-cond-compile-for-xemacs-or-emacs
1528            (overlay-end overl)         (extent-end-position overl) ; xemacs form
1529          (extent-end-position overl))))         (overlay-end overl) ; emacs form
1530           )
1531        ))
1532    
1533  (defsubst ediff-empty-overlay-p (overl)  (defsubst ediff-empty-overlay-p (overl)
1534    (= (ediff-overlay-start overl) (ediff-overlay-end overl)))    (= (ediff-overlay-start overl) (ediff-overlay-end overl)))
# Line 1604  This default should work without changes Line 1536  This default should work without changes
1536  ;; like overlay-buffer in Emacs.  In XEmacs, returns nil if the extent is  ;; like overlay-buffer in Emacs.  In XEmacs, returns nil if the extent is
1537  ;; dead.  Otherwise, works like extent-buffer  ;; dead.  Otherwise, works like extent-buffer
1538  (defun ediff-overlay-buffer (overl)  (defun ediff-overlay-buffer (overl)
1539    (if ediff-emacs-p    (ediff-cond-compile-for-xemacs-or-emacs
1540        (overlay-buffer overl)     (and (extent-live-p overl) (extent-object overl)) ; xemacs form
1541      (and (extent-live-p overl) (extent-object overl))))     (overlay-buffer overl) ; emacs form
1542       ))
1543    
1544  ;; like overlay-get in Emacs.  In XEmacs, returns nil if the extent is  ;; like overlay-get in Emacs.  In XEmacs, returns nil if the extent is
1545  ;; dead.  Otherwise, like extent-property  ;; dead.  Otherwise, like extent-property
1546  (defun ediff-overlay-get (overl property)  (defun ediff-overlay-get (overl property)
1547    (if ediff-emacs-p    (ediff-cond-compile-for-xemacs-or-emacs
1548        (overlay-get overl property)     (and (extent-live-p overl) (extent-property overl property)) ; xemacs form
1549      (and (extent-live-p overl) (extent-property overl property))))     (overlay-get overl property) ; emacs form
1550       ))
1551    
1552    
1553  ;; These two functions are here because XEmacs refuses to  ;; These two functions are here because XEmacs refuses to
# Line 1623  This default should work without changes Line 1557  This default should work without changes
1557  Checks if overlay's buffer exists before actually doing the move."  Checks if overlay's buffer exists before actually doing the move."
1558    (let ((buf (and overlay (ediff-overlay-buffer overlay))))    (let ((buf (and overlay (ediff-overlay-buffer overlay))))
1559      (if (ediff-buffer-live-p buf)      (if (ediff-buffer-live-p buf)
1560          (if ediff-xemacs-p          (ediff-cond-compile-for-xemacs-or-emacs
1561              (set-extent-endpoints overlay beg end)           (set-extent-endpoints overlay beg end) ; xemacs form
1562            (move-overlay overlay beg end buffer))           (move-overlay overlay beg end buffer)  ; emacs form
1563             )
1564        ;; buffer's dead        ;; buffer's dead
1565        (if overlay        (if overlay
1566            (ediff-delete-overlay overlay)))))            (ediff-delete-overlay overlay)))))
# Line 1634  Checks if overlay's buffer exists before Line 1569  Checks if overlay's buffer exists before
1569    "Calls `overlay-put' or `set-extent-property' depending on Emacs version.    "Calls `overlay-put' or `set-extent-property' depending on Emacs version.
1570  Checks if overlay's buffer exists."  Checks if overlay's buffer exists."
1571    (if (ediff-buffer-live-p (ediff-overlay-buffer overlay))    (if (ediff-buffer-live-p (ediff-overlay-buffer overlay))
1572        (if ediff-xemacs-p        (ediff-cond-compile-for-xemacs-or-emacs
1573            (set-extent-property overlay prop value)         (set-extent-property overlay prop value) ; xemacs form
1574          (overlay-put overlay prop value))         (overlay-put overlay prop value) ; emacs form
1575           )
1576      (ediff-delete-overlay overlay)))      (ediff-delete-overlay overlay)))
1577    
 ;; Some diff region tests  
   
 ;; t if diff region is empty.  
 ;; In case of buffer C, t also if it is not a 3way  
 ;; comparison job (merging jobs return t as well).  
 (defun ediff-empty-diff-region-p (n buf-type)  
   (if (eq buf-type 'C)  
       (or (not ediff-3way-comparison-job)  
           (= (ediff-get-diff-posn 'C 'beg n)  
              (ediff-get-diff-posn 'C 'end n)))  
     (= (ediff-get-diff-posn buf-type 'beg n)  
        (ediff-get-diff-posn buf-type 'end n))))  
   
 ;; Test if diff region is white space only.  
 ;; If 2-way job and buf-type = C, then returns t.  
 (defun ediff-whitespace-diff-region-p (n buf-type)  
   (or (and (eq buf-type 'C) (not ediff-3way-job))  
       (ediff-empty-diff-region-p n buf-type)  
       (let ((beg (ediff-get-diff-posn buf-type 'beg n))  
             (end (ediff-get-diff-posn buf-type 'end n)))  
         (ediff-with-current-buffer (ediff-get-buffer buf-type)  
           (save-excursion  
             (goto-char beg)  
             (skip-chars-forward ediff-whitespace)  
             (>= (point) end))))))  
   
1578  ;; temporarily uses DIR to abbreviate file name  ;; temporarily uses DIR to abbreviate file name
1579  ;; if DIR is nil, use default-directory  ;; if DIR is nil, use default-directory
1580  (defun ediff-abbreviate-file-name (file &optional dir)  (defun ediff-abbreviate-file-name (file &optional dir)
1581    (cond ((stringp dir)    (cond ((stringp dir)
1582           (let ((directory-abbrev-alist (list (cons dir ""))))           (let ((directory-abbrev-alist (list (cons dir ""))))
1583             (abbreviate-file-name file)))             (abbreviate-file-name file)))
1584          (ediff-emacs-p (abbreviate-file-name file))          (t
1585          (t ; XEmacs requires addl argument           (ediff-cond-compile-for-xemacs-or-emacs
1586           (abbreviate-file-name file t))))            ;; XEmacs requires addl argument
1587              (abbreviate-file-name file t) ; xemacs form
1588              (abbreviate-file-name file))  ; emacs form
1589             )
1590            ))
1591    
1592  ;; Takes a directory and returns the parent directory.  ;; Takes a directory and returns the parent directory.
1593  ;; does nothing to `/'.  If the ARG is a regular file,  ;; does nothing to `/'.  If the ARG is a regular file,
# Line 1740  Unless optional argument INPLACE is non- Line 1654  Unless optional argument INPLACE is non-
1654          ))          ))
1655    
1656    
 (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end)  
   (ediff-with-current-buffer  
       (ediff-with-current-buffer ctrl-buf (ediff-get-buffer buf-type))  
     (buffer-substring  
      (or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf))  
      (or end (ediff-get-diff-posn buf-type 'end n ctrl-buf)))))  
   
1657  ;; If ediff modified mode line, strip the modification  ;; If ediff modified mode line, strip the modification
1658  (defsubst ediff-strip-mode-line-format ()  (defsubst ediff-strip-mode-line-format ()
1659    (if (member (car mode-line-format) '(" A: " " B: " " C: " " Ancestor: "))    (if (member (car mode-line-format) '(" A: " " B: " " C: " " Ancestor: "))

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26