Subject: bug#6343: Log-edit font lock changes lead to loop

From: Lennart Borgman <[email-masked]>
Date: Fri, 4 Jun 2010 12:34:15 +0200

On Fri, Jun 4, 2010 at 12:15 PM, Juanma Barranquero <[email-masked]> wrote:
> On Fri, Jun 4, 2010 at 04:12, Lennart Borgman <[email-masked]> wrote:
>
>> A little bit off-topic: you mean you can't even stop with C-g?
>
> C-g acts weird. It stops, sort of, but then moving around makes Emacs
> loop again.

I did not notice that it stops first. Strange.

>> How do you normally handle that? (I put some limit on all font lock
>> loops in my code ... ;-) )
>
> You'll have to be a bit more specific.

I just do something like this in case I make a stupid error somewhere:

(defsubst visual-indent-while (limit counter where)
  (let ((count (symbol-value counter)))
    (if (= count limit)
        (progn
          (message "Reached (while limit=%s, where=%s)" limit where)
          nil)
      (set counter (1+ count)))))

        (while (and (visual-indent-while 200 'n-while
"visual-indent-jit-lock-fun")
                    (< (point) bound)) ;; Max bound = (point-max)