From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#24393: 25.1.50; image-mode ignore the image :scale Date: Fri, 9 Sep 2016 22:51:04 +0900 (JST) Message-ID: References: <83pooe8g90.fsf@gnu.org> <83a8fh8pl0.fsf@gnu.org> <837fal8b8x.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1473429147 7726 195.159.176.226 (9 Sep 2016 13:52:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 9 Sep 2016 13:52:27 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 24393@debbugs.gnu.org, Tino Calancha To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 09 15:52:19 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1biME5-0000wY-4I for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Sep 2016 15:52:17 +0200 Original-Received: from localhost ([::1]:58092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biME3-0007LA-7a for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Sep 2016 09:52:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biMDw-0007HD-OZ for bug-gnu-emacs@gnu.org; Fri, 09 Sep 2016 09:52:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biMDq-0006cR-Oy for bug-gnu-emacs@gnu.org; Fri, 09 Sep 2016 09:52:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biMDq-0006cL-Kt for bug-gnu-emacs@gnu.org; Fri, 09 Sep 2016 09:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1biMDq-0002KW-DV for bug-gnu-emacs@gnu.org; Fri, 09 Sep 2016 09:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Sep 2016 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24393 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24393-submit@debbugs.gnu.org id=B24393.14734290758894 (code B ref 24393); Fri, 09 Sep 2016 13:52:02 +0000 Original-Received: (at 24393) by debbugs.gnu.org; 9 Sep 2016 13:51:15 +0000 Original-Received: from localhost ([127.0.0.1]:54276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1biMD5-0002JO-6w for submit@debbugs.gnu.org; Fri, 09 Sep 2016 09:51:15 -0400 Original-Received: from mail-pa0-f48.google.com ([209.85.220.48]:36132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1biMD3-0002JC-Ht for 24393@debbugs.gnu.org; Fri, 09 Sep 2016 09:51:13 -0400 Original-Received: by mail-pa0-f48.google.com with SMTP id id6so28664482pad.3 for <24393@debbugs.gnu.org>; Fri, 09 Sep 2016 06:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=uctNYzz8uF+HOQdk9CkLqYwhkMHjZEVy5YaNZOw+9aM=; b=uWBsnc3GFGhpOI9LqgyLz1gwkUtiNzcwid9rRBQ04v589hailvZ3GJm9QCmo7PTGZv ZOUNkZcrHT1uNRYMpWK/Y7RHkH8EQ0mihrBTcchP7RmIXDJ+hI03le5ftUISMTX4Te2H 8OWJvoDTVxL8969scYmk533Y9mDMULnzN1ODNax+KhPCeSEuzRUsgVxtuG1Rsh/HIHvV BsGGmxwJ7OM3UUsUa8h1ypgK0Vt1P+fgImiCJGoEuqApCrNMe4NRoBKFKFdEUKWj/VJe /mmsPeHbd++Pqx3okzMJDN5NoesGvKImkKLwMK0GpdFyeyKMwhsx4VslRU237iwu4JvV dqDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=uctNYzz8uF+HOQdk9CkLqYwhkMHjZEVy5YaNZOw+9aM=; b=aCjU+K35jsDUWzrqzY6HfkaR5SnxmILjayjmmSt2zQ7NxhqtZL9gcxVjarySsXasqG 8GrWW7z8i7ijUvxSI8w0wGpedpX2FZt4/4lho/At4HguW0u+gLtrzDZxdNYcfPdaG41f kz6zED2ubPelOy5neJZswfWLAhAgGyA7JOeNrkIxNAPWrqxYiANT+0wd+c+DcgAZNL1B beGNWOyA55Y9wVyVq0T/OxKkZVSFFdQ4oZWh5sDFjc9sngIGIezItbDCRpB+09AtF0oG GsB34WMab8zrCQx+mBmHxfFgNCwakQ8aa8q9t1VU8h/Bs4VcO0U9L7yHAjXylUkCsoOr A5Ng== X-Gm-Message-State: AE9vXwNgKbz/p96zOCUzMTDp3mCSFdd3iiWca4JpKA4y1ACE4F48jjghSI2xi47lLw2Ecg== X-Received: by 10.66.190.200 with SMTP id gs8mr6915501pac.42.1473429067629; Fri, 09 Sep 2016 06:51:07 -0700 (PDT) Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id d6sm5689951pfe.37.2016.09.09.06.51.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Sep 2016 06:51:07 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <837fal8b8x.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:123109 Archived-At: On Fri, 9 Sep 2016, Eli Zaretskii wrote: >> From: Tino Calancha >> Date: Fri, 9 Sep 2016 19:23:02 +0900 (JST) >> cc: Tino Calancha , 24393@debbugs.gnu.org >> >>> ;; If we have a `fit-width' or a `fit-height', don't limit >>> ;; the size of the image to the window size. >>> (edges (and (null image-transform-resize) >>> (window-inside-pixel-edges >>> (get-buffer-window (current-buffer))))) >>> >>> I think 'edges' should be non-nil if image-transform-resize is >>> non-nil, no? >> I think is OK. Maybe i would adjust the comment a bit, because >> `image-transform-resize' can also be a number (set by >> `image-transform-set-scale'): i would say: >> ;; If `image-transform-resize' is non-nil, don't limit >> ;; the size of the image to the window size. >> >> I think the logic is as follows: >> The proportion width/height is an invariant of this transformation. >> If you call `image-transform-fit-to-width', your image width will occupy >> all the window width. Then, the height is increased in the same >> proportion as the width, so the final image height may be longer than >> the window height. That's OK. > > When image-transform-fit-to-width sets image-transform-resize to the > symbol 'fit-width', image-toggle-display-image will not pass any > dimensions to create-image. So how will the image be resized at all > in this case? What am I missing? It is done inside `image-toggle-display-image'. Maybe the word 'toggle' inside this function is misleading: indeed it looks more than a toggle. This 'toggle' calls `image-transform-properties' which calculate the resize for 'fit-width/'fit-height cases. > And how do you explain the assertion violation in this case, anyway? > What are the window dimensions in pixels? The same 'toggle' calls `image-transform-check-size' to check the sizes (do the cl-asserts). I guess, the origin of the problem is that these functions, `image-transform-properties' and `image-transform-check-size', don't use the image scale. After the commit mentioned in my original report, the scale of an image matters. We need somehow to teach `image-mode' to use :scale to fix this bug. We could fix this file amending those functions. I tried before and i didn't like this approach. I also suggested in https://lists.gnu.org/archive/html/emacs-devel/2016-09/msg00159.html that if image-mode.el uses more the API in image.el (maybe extending the API a bit ), then this bug could get fix easily; currently both files define resizes and rotations; for me it has much sense that, if the API already provide those functionalities, then image-mode.el just use them: one source of truth, easier to maintain.