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: Tassilo Horn
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r112045: * doc-view.el Fix bug#13887.
Date: Mon, 18 Mar 2013 08:42:50 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> === 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.

I think in this case it's ok, because this case happens only once when
opening a new document, so there's only one overlay.  But anyway, I've
changed it to use check the 'display property of `ol', now.

I also changed the single remaining `get-char-property' call in
`doc-view-document->bitmap' to check the current doc-view overlay's
'display property.

>> +              ;; 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.

This is the case where the document is initially shown in a window.  My
change to `doc-view-insert-image' prevents insertion of image data if
the window isn't shown, and here the `doc-view-goto-page' call will do
just that.

>> +            ;; 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.

I'm doing the latter now.

> 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)?

By virtue of causing a redisplay.  (At least I've removed
`image-mode-reapply-winprops' from the local value of
`window-configuration-change-hook' for testing, and that made no
difference with respect to showing the image).

I've adjusted the comment accordingly.

Bye,
Tassilo



reply via email to

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