From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r112045: * doc-view.el Fix bug#13887. Date: Mon, 18 Mar 2013 08:42:50 +0100 Message-ID: <874ng9cfwl.fsf@thinkpad.tsdh.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1363592580 32150 80.91.229.3 (18 Mar 2013 07:43:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Mar 2013 07:43:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 18 08:43:24 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UHUj4-0001MU-Gj for ged-emacs-devel@m.gmane.org; Mon, 18 Mar 2013 08:43:22 +0100 Original-Received: from localhost ([::1]:54272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHUih-00018J-FP for ged-emacs-devel@m.gmane.org; Mon, 18 Mar 2013 03:42:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHUid-00017C-0Y for emacs-devel@gnu.org; Mon, 18 Mar 2013 03:42:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHUib-0005Nw-Dz for emacs-devel@gnu.org; Mon, 18 Mar 2013 03:42:54 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:53393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHUib-0005Nl-3z for emacs-devel@gnu.org; Mon, 18 Mar 2013 03:42:53 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 8F1C41A860A; Mon, 18 Mar 2013 08:42:52 +0100 (CET) X-Virus-Scanned: amavisd-new at uni-koblenz.de Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MWGgdBsWdqDx; Mon, 18 Mar 2013 08:42:52 +0100 (CET) X-CHKRCPT: Envelopesender noch tsdh@gnu.org Original-Received: from thinkpad.tsdh.de (tsdh.uni-koblenz.de [141.26.67.142]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 12EE31A8604; Mon, 18 Mar 2013 08:42:52 +0100 (CET) Mail-Followup-To: Stefan Monnier , emacs-devel@gnu.org In-Reply-To: (Stefan Monnier's message of "Sat, 16 Mar 2013 22:57:03 -0400") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157922 Archived-At: Stefan Monnier 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