all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r112045: * doc-view.el Fix bug#13887.
Date: Mon, 18 Mar 2013 08:42:50 +0100	[thread overview]
Message-ID: <874ng9cfwl.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: <jwv620qbv7d.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 16 Mar 2013 22:57:03 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> 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	other threads:[~2013-03-18  7:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1UGGSd-000258-Pl@vcs.savannah.gnu.org>
2013-03-17  2:57 ` [Emacs-diffs] /srv/bzr/emacs/trunk r112045: * doc-view.el Fix bug#13887 Stefan Monnier
2013-03-18  7:42   ` Tassilo Horn [this message]
2013-03-18 13:23     ` Stefan Monnier
2013-03-18 19:50       ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874ng9cfwl.fsf@thinkpad.tsdh.de \
    --to=tsdh@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.