From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: E Sabof Newsgroups: gmane.emacs.bugs Subject: bug#13887: 24.3; doc-view will render blurry images when image-magick is available Date: Thu, 14 Mar 2013 03:28:27 +0000 Message-ID: References: <8762153qc8.fsf@thinkpad.tsdh.de> <8762143co6.fsf@thinkpad.tsdh.de> <877glkgvqj.fsf@thinkpad.tsdh.de> <87txonw6ev.fsf@thinkpad.tsdh.de> <87sj46493q.fsf@thinkpad.tsdh.de> <877gle1etb.fsf@thinkpad.tsdh.de> <838v5tx4av.fsf@gnu.org> <87txohx0g0.fsf@thinkpad.tsdh.de> <831ubllqr0.fsf@gnu.org> <87zjy9vg0r.fsf@thinkpad.tsdh.de> <83y5dtk606.fsf@gnu.org> <83li9sk1bh.fsf@gnu.org> <83hakgjpbi.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bdc0934afe2b704d7da1d4e X-Trace: ger.gmane.org 1363231754 5201 80.91.229.3 (14 Mar 2013 03:29:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Mar 2013 03:29:14 +0000 (UTC) Cc: 13887@debbugs.gnu.org, Tassilo Horn To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 14 04:29:35 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1UFyrC-00059U-Sf for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Mar 2013 04:29:31 +0100 Original-Received: from localhost ([::1]:47556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFyqq-0008ID-Bt for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Mar 2013 23:29:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFyql-0008I4-Hy for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 23:29:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFyqe-00017Y-Ps for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 23:29:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFyqe-00017U-M5 for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 23:28:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UFyrk-0002fn-Ii for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2013 23:30:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: E Sabof Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Mar 2013 03:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13887 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13887-submit@debbugs.gnu.org id=B13887.136323178410222 (code B ref 13887); Thu, 14 Mar 2013 03:30:03 +0000 Original-Received: (at 13887) by debbugs.gnu.org; 14 Mar 2013 03:29:44 +0000 Original-Received: from localhost ([127.0.0.1]:52300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFyrQ-0002ep-3U for submit@debbugs.gnu.org; Wed, 13 Mar 2013 23:29:44 -0400 Original-Received: from mail-qe0-f45.google.com ([209.85.128.45]:44501) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UFyrO-0002ed-DO for 13887@debbugs.gnu.org; Wed, 13 Mar 2013 23:29:43 -0400 Original-Received: by mail-qe0-f45.google.com with SMTP id b4so1045339qen.32 for <13887@debbugs.gnu.org>; Wed, 13 Mar 2013 20:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=5m/1TXESdC1/CdQ3lBa21D+r9rJxqsq/DdY3T1t51OU=; b=FnvJDG5L+t56c5MQcsAHUQoDdsFi3YC8c3d220Lh9TyUFcZkmk3fZpBUzQruw33yPJ K/QLAvQHpwyhWnvuVx42WUB/XXuuhVe+hqS33FN7T1O/6+VHVyujlycIpChzqN86VrjC 4TtDhAXkijuc4W8rwa9I/PycnP5DGOTlHGwo5roQYgdvFx/SshWkPNQhzB537HuC/wTH 3NsqB8Sy5sPnyUou6VNYxYUpqB7pCemF3HPuk65GLs4X2k354BxENW+KF933KuNimrE+ qSarUSb4CwtSeZ2bt7X/W6QDB7jDkLTE0G+JqNYXEmGM32nA3UPt/uUhyIhw60uTkrXp 7I6g== X-Received: by 10.49.84.6 with SMTP id u6mr1136664qey.35.1363231707747; Wed, 13 Mar 2013 20:28:27 -0700 (PDT) Original-Received: by 10.49.70.233 with HTTP; Wed, 13 Mar 2013 20:28:27 -0700 (PDT) In-Reply-To: <83hakgjpbi.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72444 Archived-At: --047d7bdc0934afe2b704d7da1d4e Content-Type: text/plain; charset=ISO-8859-1 Here is what I found: The first time (doc-view-insert-image) is called, the doc-view buffer isn't selected, and (doc-view-current-overlay) returns the t overlay. The "fake" overlay gets "resurrected" when (doc-view-insert-image) calls (move-overlay) on it. Adding (defun doc-view-initiate-display () ;; Switch to image display if possible. (if (doc-view-mode-p doc-view-doc-type) (progn + (unless (eq (window-buffer) (current-buffer)) + (set-window-buffer (selected-window) (current-buffer))) prevents the t "window" from being set. The second problem was that after splitting, new windows wouldn't have overlays. What looked suspicious was that (image-mode-winprops) always ran with the initial window. Changing the definition of image-get-display-property from (defun image-get-display-property () (get-char-property (point-min) 'display ;; There might be different images for different displays. (if (eq (window-buffer) (current-buffer)) (selected-window)))) to (defun image-get-display-property () (or (get-char-property (point-min) 'display (selected-window)) (get-char-property (point-min) 'display))) has fixed it. I'm not sure it's the right (only?) place to fix, since by the time it gets called, (eq (window-buffer) (current-buffer)) should be true. Evgeni --047d7bdc0934afe2b704d7da1d4e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Here is what I found:

The first time (d= oc-view-insert-image) is called, the doc-view buffer isn't selected, an= d (doc-view-current-overlay) returns the t overlay.=A0

The "fake" overlay gets "resurrected" when (doc-vie= w-insert-image) calls (move-overlay) on it.=A0

Adding

(defun doc-view-initiate-display= ()
=A0 ;; Switch to image display if possible.
=A0 (if (doc-vie= w-mode-p doc-view-doc-type)
=A0 =A0 =A0 (progn
+ =A0 = =A0 =A0 =A0(unless (eq (window-buffer) (current-buffer))
+ =A0 = =A0 =A0 =A0 =A0(set-window-buffer (selected-window) (current-buffer)))

prevents the t "window" from bein= g set.

The second problem was that afte= r splitting, new windows wouldn't have overlays. What looked suspicious= was that (image-mode-winprops) always ran with the initial window. Changin= g the definition of image-get-display-property from

(defun image-get-display-property ()
=A0 (get-char-property (point-min) 'display
=A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0;; There might be different images for d= ifferent displays.
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(if (eq (window-buffer) (cu= rrent-buffer))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0(selected-window))))

to
<= br>
(defun image-get-display-property ()
=A0 (or (get-char-property (point-min) 'display (selected-window))=
=A0 =A0 =A0 (get-char-property (point-min) 'display)))
=

has fixed it. I'm not sure it's the= right (only?) place to fix, since by the time it gets called, (eq (window-= buffer) (current-buffer)) should be true.

Evgeni


--047d7bdc0934afe2b704d7da1d4e--