anchor.diff:  
   (in-package :clim-internals)
   
  +;;; Delayed repainting mechanism
  +;;;
  +;;; A region of code the execution of which will result in multiple
  +;;; redundant repaints of one or more sheets can be surrounded in
  +;;; [CALL-]WITH-DELAYED-DISPATCH-REPAINT. In that case, repaints
  +;;; dispatched in the body code are not processed immediately but are
  +;;; recorded for later. When exiting from the
  +;;; [CALL-]WITH-DELAYED-DISPATCH-REPAINT call, all recorded repaints
  +;;; are merged (i.e. for each involved sheet, the effective repaint
  +;;; region is the union of all recorded repaint regions) and executed.
  +
  +(defvar *delayed-repaints* nil)
  +
  +(defmethod dispatch-repaint :around ((sheet basic-sheet) region)
  +  ;; If *DELAYED-REPAINTS* is non-NIL, push REGION onto the repaint
  +  ;; queue for SHEET instead of dispatching the repaint. Otherwise,
  +  ;; just call the next method.
  +  (if-let ((delayed-repaints *delayed-repaints*))
  +    (push region (gethash sheet delayed-repaints '()))
  +    (call-next-method)))
  +
  +(defun invoke-with-inhibited-dispatch-repaint (continuation)
  +  ;; If *DELAYED-REPAINTS* is non-NIL, there must be a surrounding
  +  ;; call of this function, so we don't have to do anything.
  +  (if *delayed-repaints*
  +      (funcall continuation)
  +      (progn
  +        (let ((delayed-repaints (make-hash-table :test #'eq)))
  +          ;; DISPATCH-REPAINT calls in continuation populate
  +          ;; DELAYED-REPAINTS.
  +          (let ((*delayed-repaints* delayed-repaints))
  +            (funcall continuation))
  +          ;; Merge and execute recorded repaint requests.
  +          (maphash (lambda (sheet regions)
  +                     (dispatch-repaint sheet (reduce #'region-union regions)))
  +                   delayed-repaints)))))
  +
  +(defmacro with-inhibited-dispatch-repaint (() &body body)
  +  (gen-invoke-trampoline
  +   'invoke-with-inhibited-dispatch-repaint '() '() body))
  +
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;;;
   ;;; Repaint protocol functions.
   
   (defmethod dispatch-repaint ((sheet graft) region)
     (declare (ignore sheet region)))
  -
  -;;; Internal flag used in sheets module. We could make it a macro which
  -;;; accumulates regions to repaint with region-union and at the end repaints
  -;;; whole bunch at one go. Could be useful for presentation highlighting when we
  -;;; have many small areas to redraw. That could improve the performance.
  -(defvar *inhibit-dispatch-repaint* nil
  -  "Used when we plan to repaint whole sheet and we suspect that children may
  -want to do the same.")
  -
  -(defmethod dispatch-repaint :around ((sheet basic-sheet) region)
  -  (unless *inhibit-dispatch-repaint* (call-next-method)))
   
   (defmethod queue-repaint ((sheet basic-sheet) (event window-repaint-event))
     (queue-event sheet event))
  
positive.code: (defmethod (setf sheet-region) :around (region (sheet basic-sheet))
    (let ((old-region (sheet-region sheet)))
      (unless (region-equal region old-region)
        (let ((*inhibit-dispatch-repaint* nil)) ; broken, don't use
          (call-next-method))
        (when (sheet-viewable-p sheet)
          (dispatch-repaint (sheet-parent sheet)
  
negative.code: (defmethod (setf sheet-transformation) :around (transformation (sheet basic-sheet))
    (let ((old-transformation (sheet-transformation sheet)))
      (unless (transformation-equal transformation old-transformation)
        (with-inhibited-dispatch-repaint ()
          (call-next-method))
        (when (sheet-viewable-p sheet)
          (let* ((region (sheet-region sheet))
  