From xemacs-m  Sat Sep 13 02:16:51 1997
Received: from bittersweet.inetarena.com (karlheg@bittersweet.inetarena.com [206.129.216.38])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id CAA22103
	for <xemacs-beta@xemacs.org>; Sat, 13 Sep 1997 02:16:49 -0500 (CDT)
Received: (from karlheg@localhost)
	by bittersweet.inetarena.com (8.8.7/8.8.7/Debian/GNU) id AAA04501;
	Sat, 13 Sep 1997 00:16:10 -0700
To: XEmacs BETA <xemacs-beta@xemacs.org>
Subject: Re: `lazyshot.el': bugfix and comments/questions.
References: <199709120745.AAA17290@bittersweet.inetarena.com> <bywwkm4wx3.fsf@midget.math.ethz.ch>
X-Face: /Q}=yl}1_v7nP)xXo5XjG8+tl@=uVu7o5u6)f]zN?+<hB!K.m9:[|*p34jVN`O;:XZXVSy>/\R>qDt(t8w!-i{(y0"`jFw^uk8inzO9wXabd'CdjUWfC\GHi:6nO*YC89#-qD>Q4r%9!V"<RYJ=7D#$";q=zML5'!=wvXk^$`6FT=5CMofQX)WUKt0p:OKl.mFOXx/D
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: text/plain; charset=US-ASCII
From: karlheg@inetarena.com (Karl M. Hegbloom)
Date: 13 Sep 1997 00:16:09 -0700
In-Reply-To: Jan Vroonhof's message of "12 Sep 1997 13:02:48 +0200"
Message-ID: <87d8md7kg6.fsf@bittersweet.inetarena.com>
Lines: 135
X-Mailer: Gnus v5.4.64/XEmacs 20.3(beta19) - "Kyiv"

>>>>> "Jan" == Jan Vroonhof <vroonhof@math.ethz.ch> writes:

    Jan> Thanks for checking this out. Do you notice any flashing?

 Not really... when the buffer first displays, it's black and white,
and then it colorizes right away, just a snick slower than an
eyeblink.  It's not really a flash, just the colors happening, I
think.  It's not the same as the flicker I see when I back scroll in
Netscape, (which needs dbe badly) or like when I drag a shaped Xlogo
across an Xterm window.

    >> +;;(defcustom +(defvar +lazy-lock-step-size (* 1 1024)
    >> 
    Jan> I am not sure whether it is good to let users fiddle with
    Jan> this.  Anyway Lazy-shot.el is an extract of my hacks in
    Jan> lazy-lock 2 and there the autoloads and stuff are
    Jan> there. However may be it is better to have a clean start with
    Jan> a rtue new lazy-shot.el file anyway.

 It's your baby.  I've increased the size by 1024 characters, after
lighting up several typical screenfuls and doing {M-| wc}.  I have
around 1500 to 2000 characters per screenful, according to `wc', since
in X Windows, my screens are 100x42, and on the Linux console, with
SVGATextMode, they are 120x50 or so.  I imagine most people use large
frames.

 I think it's great that lazy locking works so well now with such a
minimal set of lisp functions.

    >> +;; These changes HAVE to be made so it doesn't skip lines.
    >> Try +;; loading src/Makefile.in.in and page downing a few
    >> times.

    Jan> Yeah, I noticed that lazy-lock does this too. However isn't
    Jan> this really a bug in font-lock-fontify-region? (At least it
    Jan> could be documented). May we should just add the code you
    Jan> added there.

 Agreed.

> +   (let ((start (save-excursion
> +                  (progn
> +                    (goto-char (extent-start-position extent))
> +                    (beginning-of-line)
> +                    (point))))
> +         (end   (save-excursion
> +                  (progn
> +                    (goto-char (extent-end-position extent))
> +                    (beginning-of-line)
 
    Jan> (forward-line) ?

 I don't know where point is when I get to where start and end need to
be calculated.  I can't see how forward-line would do what we want
here.

> +                    (point))))
>  	 (buffer (extent-buffer extent))
>  	 font-lock-f)
> -     (delete-extent extent)     
> +     (delete-extent extent)
>       (message "Lazy-shot fontifying from %s to %s in %s" start end buffer)
>       (save-excursion

    Jan> Isn't it better to rewrite this so that we only do one
    Jan> save-excursion?

 Ok, like: (tested.)

(defun lazy-lock-shot-function (extent)
  "Lazy lock the extent when it has become visisble"
  (save-excursion
    (let ((start (progn
                   (goto-char (extent-start-position extent))
                   (beginning-of-line)
                   (point)))
          (end (progn
                 (goto-char (extent-end-position extent))
                 (beginning-of-line)
                 (point)))
          (buffer (extent-buffer extent))
          font-lock-f)
      (delete-extent extent)
      (message "Lazy-shot fontifying from %s to %s in %s" start end buffer)
      (save-match-data
        (font-lock-fontify-region start end)))))

 I don't think it will matter a whole lot, since it's not running a
bunch of times in a loop.  But I like it better to put the sav-ex
outside the let like this.

        [code ommitted]
    Jan> The former should work too. However we need an internal
    Jan> set-extent-one-shot-function anyway because we need to mark
    Jan> the extent for redisplay so I just exported it to the lisp
    Jan> level too. It is just a stylistic question. May be a few lisp
    Jan> experts can comment on this.

 I'll read it too. :-)

    >> +;;; Help!  I don't know how to do this... <punt>

    Jan> I didn't now either. Your version looks OK. I was thinking of
    Jan> may be putting the one-shot extents in a buffer local list.
    Jan> The reason this may be needed is that the real lazy-lock also
    Jan> does idle time locking therefore it needs to find currently
    Jan> "unlocked" extents. I am not sure how fast walking through
    Jan> all the extents the way you do below is.

        [code ommitted]
    Jan> This is already done in (lazy-lock-mode 0)

 I get an error all the time now, like when I `ctypes-define-type',
saying that `lazy-lock-unstall' isn't defined...  I defined it as:

(defun lazy-lock-unstall ()
  t)

 ... for now, just to hold it up until it's finished properly.  When I
byte compile, I get:

Compiling file /usr/local/src/xemacs-20/lisp/packages/lazyshot.el at Sat Sep 13 00:10:45 1997
  ** extent-buffer is an obsolete function; use extent-object instead.
  ** variable font-lock-f bound but not referenced
While compiling toplevel forms:
  ** reference to free variable lazyshot-modeline-string

 ... so I guess fix the `extent-buffer'.  What was `font-lock-f' going
to be for?

-- 
mailto:karlheg@inetarena.com (Karl M. Hegbloom)
http://www.inetarena.com/~karlheg
Portland, OR  USA
Debian GNU 1.3.1+hamm  Linux pre-2.0.31-9+select+QNX  AMD K5 PR-133

