From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#51596: image-transform-resize has inconsistent semantics wrt scaling up/down Date: Wed, 3 Nov 2021 21:14:58 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38075"; mail-complaints-to="usenet@ciao.gmane.io" To: 51596@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 04 05:16:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1miUAd-0009ky-H7 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Nov 2021 05:16:11 +0100 Original-Received: from localhost ([::1]:60186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miUAb-0000AA-Sm for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Nov 2021 00:16:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miUAU-0000A2-SF for bug-gnu-emacs@gnu.org; Thu, 04 Nov 2021 00:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58396) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miUAU-0004TA-Gg for bug-gnu-emacs@gnu.org; Thu, 04 Nov 2021 00:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1miUAU-0000Af-5L for bug-gnu-emacs@gnu.org; Thu, 04 Nov 2021 00:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Nov 2021 04:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51596 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1635999309576 (code B ref -1); Thu, 04 Nov 2021 04:16:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Nov 2021 04:15:09 +0000 Original-Received: from localhost ([127.0.0.1]:41708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1miU9c-00009E-TU for submit@debbugs.gnu.org; Thu, 04 Nov 2021 00:15:09 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:33596) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1miU9b-000096-4W for submit@debbugs.gnu.org; Thu, 04 Nov 2021 00:15:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miU9Y-00007M-Tf for bug-gnu-emacs@gnu.org; Thu, 04 Nov 2021 00:15:06 -0400 Original-Received: from mail-pl1-f178.google.com ([209.85.214.178]:38423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1miU9W-0004F7-DY for bug-gnu-emacs@gnu.org; Thu, 04 Nov 2021 00:15:04 -0400 Original-Received: by mail-pl1-f178.google.com with SMTP id o14so5167752plg.5 for ; Wed, 03 Nov 2021 21:14:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:date:message-id:subject:to; bh=ZujVt4I8j+W/PyubJvI1X6Zvn/dXNPctTNtY8qmaLbA=; b=MhC459D7abedKZET796oHT1bolj/EzCkop2uEwDmP3jRv181g4rjXO1kkLILyw5SKw jq1vthSucoqwesZ6tOi6+NFsQNkDWo2pn4F1yhRPIRQMpppS67DG9F2SLBpfcONzb1XW CrdL3xkwhKPgsCuNgYYus6IswNs5uz2+8W0/ja3DfQxC3dfppsQGA/qs32j6o+N7SWuv B8mEG0KCJEq5/AiQCxS9Q2YVglT7sNVAsrJJFW+64ZnweEp6kn2t3bbpvF1ARVOfrRrO 4LIbG9y3+Wxn8dx/HpLNIU0S7EO0gBbGGoYuWfYlpHBsbRCLB8CIZHY4Ev9+i2MYeZHq mMhw== X-Gm-Message-State: AOAM530r7G6fdJkidGRUZFhndV2kfEvscGatxm/eNRJkdzjyji+uX/EA 1COEqR4EfvBwVUPAdOj1XscsEI8+w5Bm/cVNQMtwexvT X-Google-Smtp-Source: ABdhPJwywXRlDDSnuuU8YDclPP0Ux+uUbtQnm8Dj8rnDU7zxXLna5f/vi1cD42r4LW9O7aXhXKvVXFimXU5+CpDtWSg= X-Received: by 2002:a17:90a:be10:: with SMTP id a16mr18922239pjs.133.1635999298587; Wed, 03 Nov 2021 21:14:58 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 3 Nov 2021 21:14:58 -0700 Received-SPF: pass client-ip=209.85.214.178; envelope-from=stefankangas@gmail.com; helo=mail-pl1-f178.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:218904 Archived-At: I find the semantics of `image-transform-resize' inconsistent. That also goes for `image-auto-resize' and the corresponding functions. "Fit height" and "fit width" both scales an image up or down, but "fit height and width" only scales an image down. Is that intentional? I would have expected that they all scale in the same way, i.e. they should all either scale up or down, or scale down only, or scale up only. My preference is that they scale both up or down, no matter which kind of fitting you ask for. The below diff seems to achieve what I want. However, I'm not sure if the semantics should be changed in this way, as I don't know if the old semantics were intentional or not. diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 4a326cdc69..97efd8254d 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -880,7 +880,7 @@ image-toggle-display-image :format (and filename data-p)) (create-image file-or-data type data-p :scale 1 :max-width max-width - :max-height max-height + :height max-height ;; Type hint. :format (and filename data-p))))