/[emacs]/emacs/lisp/compare-w.el
ViewVC logotype

Diff of /emacs/lisp/compare-w.el

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

revision 1.25 by eliz, Thu May 20 16:41:41 2004 UTC revision 1.26 by jurta, Sun Nov 28 07:56:01 2004 UTC
# Line 283  on third call it again advances points t Line 283  on third call it again advances points t
283  ;; to be used when this function is called on second window.  ;; to be used when this function is called on second window.
284  (defun compare-windows-sync-default-function ()  (defun compare-windows-sync-default-function ()
285    (if (not compare-windows-sync-point)    (if (not compare-windows-sync-point)
286        (let* ((w2 (next-window (selected-window)))        (let* ((w1 (selected-window))
287                 (w2 (next-window w1))
288               (b2 (window-buffer w2))               (b2 (window-buffer w2))
289               (point-max2 (with-current-buffer b2 (point-max)))               (point-max2 (with-current-buffer b2 (point-max)))
290               (op2 (window-point w2))               (op2 (window-point w2))
# Line 326  on third call it again advances points t Line 327  on third call it again advances points t
327            ;; use closest matching points (i.e. points with minimal sum)            ;; use closest matching points (i.e. points with minimal sum)
328            (setq p12 (cdr (assq (apply 'min (mapcar 'car p12s)) p12s)))            (setq p12 (cdr (assq (apply 'min (mapcar 'car p12s)) p12s)))
329            (goto-char (car p12))            (goto-char (car p12))
330            (compare-windows-highlight op1 (car p12) op2 (cadr p12) b2))            (compare-windows-highlight op1 (car p12) (current-buffer) w1
331                                         op2 (cadr p12) b2 w2))
332          (setq compare-windows-sync-point (or (cadr p12) t)))          (setq compare-windows-sync-point (or (cadr p12) t)))
333      ;; else set point in the second window to the pre-calculated value      ;; else set point in the second window to the pre-calculated value
334      (if (numberp compare-windows-sync-point)      (if (numberp compare-windows-sync-point)
# Line 334  on third call it again advances points t Line 336  on third call it again advances points t
336      (setq compare-windows-sync-point nil)))      (setq compare-windows-sync-point nil)))
337    
338  ;; Highlight differences  ;; Highlight differences
339  (defun compare-windows-highlight (beg1 end1 beg2 end2 buf2)  (defun compare-windows-highlight (beg1 end1 b1 w1 beg2 end2 b2 w2)
340    (when compare-windows-highlight    (when compare-windows-highlight
341      (if compare-windows-overlay1      (if compare-windows-overlay1
342          (move-overlay compare-windows-overlay1 beg1 end1 (current-buffer))          (move-overlay compare-windows-overlay1 beg1 end1 b1)
343        (setq compare-windows-overlay1 (make-overlay beg1 end1 (current-buffer)))        (setq compare-windows-overlay1 (make-overlay beg1 end1 b1))
344        (overlay-put compare-windows-overlay1 'face 'compare-windows-face)        (overlay-put compare-windows-overlay1 'face 'compare-windows-face)
345        (overlay-put compare-windows-overlay1 'priority 1))        (overlay-put compare-windows-overlay1 'priority 1))
346        (overlay-put compare-windows-overlay1 'window w1)
347      (if compare-windows-overlay2      (if compare-windows-overlay2
348          (move-overlay compare-windows-overlay2 beg2 end2 buf2)          (move-overlay compare-windows-overlay2 beg2 end2 b2)
349        (setq compare-windows-overlay2 (make-overlay beg2 end2 buf2))        (setq compare-windows-overlay2 (make-overlay beg2 end2 b2))
350        (overlay-put compare-windows-overlay2 'face 'compare-windows-face)        (overlay-put compare-windows-overlay2 'face 'compare-windows-face)
351        (overlay-put compare-windows-overlay2 'priority 1))        (overlay-put compare-windows-overlay2 'priority 1))
352        (overlay-put compare-windows-overlay2 'window w2)
353      ;; Remove highlighting before next command is executed      ;; Remove highlighting before next command is executed
354      (add-hook 'pre-command-hook 'compare-windows-dehighlight)))      (add-hook 'pre-command-hook 'compare-windows-dehighlight)))
355    

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

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