Subject: Re: bug#13164: [PATCH] View DjVu documents through doc-view-mode

From: Stefan Monnier <[email-masked]>
Date: Wed, 23 Jan 2013 08:18:37 -0500

>>> Could someone bisect to find the commit that introduced this problem?
>> Yes, I can do that.  I'll report back when I'm done.
> Ok, I'm done.

Thank you very much.

> --8<---------------cut here---------------start------------->8---
> 046fb9fbdc0ee0c26e0063ce5ee94bead46ee98d is the first bad commit
> commit 046fb9fbdc0ee0c26e0063ce5ee94bead46ee98d
> Author: Dmitry Antipov <[email-masked]>
> Date:   Tue Dec 11 13:51:12 2012 +0400

>     * buffer.c (Fset_buffer_multibyte): Do not force redisplay
>     if changed buffer is not shown in a window.
>     * insdel.c (prepare_to_modify_buffer): Likewise.
>     * window.c (replace_buffer_in_windows_safely): Do nothing
>     if buffer is not shown in a window.
>     (Fforce_window_update): Likewise if string or buffer argument
>     is passed.

Dmitry, could you take a look at this?  It looks like the new code's
more aggressive avoidance of redisplay ends up leaving some mode-lines
out-of-date after running timers.

I don't see any immediate connection between the above commit message
and doc-view's timer behavior, so maybe the problem is a problem in
your commit.

OTOH maybe doc-view was simply lucky that the redisplay was not
optimized enough and we should really use something like the patch below,

> Are there any instructions on doing bisection on emacs bzr?

My impression that "bzr bisect" is in the same boat as "bzr switch" and
"bzr rebase": kinda works sometimes, but not nearly robust enough.

        Stefan

=== modified file 'lisp/doc-view.el'
--- lisp/doc-view.el	2013-01-10 15:50:04 +0000
+++ lisp/doc-view.el	2013-01-23 13:14:23 +0000
@@ -1265,6 +1265,8 @@
                                            "[0-9]+")
                                    t)
                   'doc-view-sort))
+      (unless (eq (length prev-pages) (length doc-view-current-files))
+        (force-mode-line-update))
       (dolist (win (or (get-buffer-window-list buffer nil t)
 		       (list t)))
 	(let* ((page (doc-view-current-page win))