emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] /srv/bzr/emacs/trunk r112045: * doc-view.el Fix bug#13


From: Stefan Monnier
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r112045: * doc-view.el Fix bug#13887.
Date: Sat, 16 Mar 2013 22:57:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> === modified file 'lisp/doc-view.el'
> --- a/lisp/doc-view.el        2013-03-14 15:24:04 +0000
> +++ b/lisp/doc-view.el        2013-03-14 21:33:07 +0000
> @@ -324,7 +324,26 @@
>        ;; `window' property is only effective if its value is a window).
>        (cl-assert (eq t (car winprops)))
>        (delete-overlay ol))
> -    (image-mode-window-put 'overlay ol winprops)))
> +    (image-mode-window-put 'overlay ol winprops)
> +    (when (windowp (car winprops))
> +      (if (stringp (get-char-property (point-min) 'display))

This get-char-property looks fishy, since we may have several overlays,
each with its `display' property and we don't know which one we'll get.
It might be the case that `stringp' will return the same value
regardless, so maybe it's OK, but if so it deserves a comment explaining
why it's OK.

> +       ;; We're not already displaying an image, so this is the
> +       ;; initial window showing the document.
> +       (run-with-timer nil nil
> +                       (lambda ()
> +                         ;; In case a conversion is running, the
> +                         ;; refresh will happen as defined by
> +                         ;; `doc-view-conversion-refresh-interval'.
> +                         (unless doc-view-current-converter-processes
> +                           (with-selected-window (car winprops)
> +                             (doc-view-goto-page 1)))))

I don't understand the scenario in which this doc-view-goto-page would
be needed.

> +     ;; We've split the window showing the document.  All we need
> +     ;; to do is selecting the new window to make the image appear
> +     ;; there, too.
> +     (run-with-timer nil nil
> +                     (lambda ()
> +                       (save-window-excursion
> +                         (select-window (car winprops)))))))))

save-window-excursion won't undo the effects of select-window on the
buffer-list.  So you might like to use the `norecord' argument, or
(better) to use with-selected-window.

Also will this work just by virtue of causing a redisplay (in which case
the comment should say so), or will it work by triggering
window-configuration-change-hook (in which case, maybe this is
a workaround for a bug elsewhere)?


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]