From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id eCrcJrubImNtIAEAbAwnHQ (envelope-from ) for ; Thu, 15 Sep 2022 05:27:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 0BgiJ7ubImM74wAA9RJhRA (envelope-from ) for ; Thu, 15 Sep 2022 05:27:55 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 36CCE1AE0F for ; Thu, 15 Sep 2022 05:27:51 +0200 (CEST) Received: from localhost ([::1]:42392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYfXZ-0008W7-NZ for larch@yhetil.org; Wed, 14 Sep 2022 23:27:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYfWc-0008Vw-Ab for emacs-orgmode@gnu.org; Wed, 14 Sep 2022 23:26:51 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:34365) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oYfWa-0002F3-Hx for emacs-orgmode@gnu.org; Wed, 14 Sep 2022 23:26:50 -0400 Received: by mail-pg1-x531.google.com with SMTP id i19so12842031pgi.1 for ; Wed, 14 Sep 2022 20:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date; bh=He/62hoNhuPjJNO5jS7SCqUURaDcUYptVkhe6sNkufE=; b=L1UDvfAHJIKIlCz6izx+g7nEcuWGDNusjYnY1f0q1HZTgQAsR6Knq7lfyhHFmMxxV4 cQeVHs6GVmA8G5USgQOJn66fhYGo8PdOoTFcnX1kDbJpkY9HM8hYKUdFxNrGz/AG1E2c UH4VETeG5RfgO59h3JGpozLiJg9tU+z7AUPrHHjsIVtmEdvI3UAPeAfHoBc9LA1gPghO Cq3CQ+WpjfP2sMm/HFrjE4Af///EBKommMLBHMQUHCeu0f68933xcbmDVI1VKZEZGUP2 BcWq/Z0P88Z27jhxE+9yG+p63enk52if6jj6urZYw3PTb2w2AnzVdo6p6wup5DRlbirv MdeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=He/62hoNhuPjJNO5jS7SCqUURaDcUYptVkhe6sNkufE=; b=DMAuk+Zqzcn++OOzOON5aphKWz1qCa6kYPPlwV67l3gneE2kChzyDJVHzTsHywwedb pe+JQsnisowHxKPaLBCQqhZLbwrFXkfuLR0TyCZbFI1uxt5EDoe/fLVRfAX3MeeRHUp4 mhLdELkiqf8vo+VoVO/xC0ZiwBbjiT8qqhlJPTgCnBjTJXoo53+B0LgVAr+9Bqcpildi JhU+z5VTyNaFWQuGNBF5MRWrBgoGT4u/5iMW4b/7MQAjEEFYDaZS0uJGVo4xoGx17/SM foqrYEpnVr4QdF03h0o+D4dGFvcn+Lt/s9PL8JdDKLUDBHqXgCAylMW8SFZkNRPbK3Ak YrTg== X-Gm-Message-State: ACgBeo2NFVhkDPrgFdc8a3neTedCcE8gOGBbdRV63RH7v89ducXYToQh CWH5tqbmGEeO2/KzI61i5aQ= X-Google-Smtp-Source: AA6agR5XgqIs3DSYrPKQBM4zCSpTnqEUSn9pGrIrJ52bXQhJ+BKMXF/bIe/i5M64rGwhK8zdhppj3A== X-Received: by 2002:a63:4e63:0:b0:438:d84c:2db with SMTP id o35-20020a634e63000000b00438d84c02dbmr17847215pgl.180.1663212407173; Wed, 14 Sep 2022 20:26:47 -0700 (PDT) Received: from localhost ([2409:8970:a81:48f7:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id f16-20020a170902ce9000b00176b8f587efsm4753308plg.148.2022.09.14.20.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 20:26:46 -0700 (PDT) From: Ihor Radchenko To: "Christopher M. Miles" Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH 3] New: auto display inline images under subtree when `org-cycle'. In-Reply-To: <631fe1c9.050a0220.3ab2b.3f52SMTPIN_ADDED_BROKEN@mx.google.com> References: <631d472b.c80a0220.2b4b2.bf86SMTPIN_ADDED_BROKEN@mx.google.com> <87h71ew0m0.fsf@localhost> <631e92ee.050a0220.f9c18.92f5SMTPIN_ADDED_BROKEN@mx.google.com> <87y1uovp9w.fsf@localhost> <631fe1c9.050a0220.3ab2b.3f52SMTPIN_ADDED_BROKEN@mx.google.com> Date: Thu, 15 Sep 2022 11:27:41 +0800 Message-ID: <87bkrhwc42.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=yantar92@gmail.com; helo=mail-pg1-x531.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663212471; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=He/62hoNhuPjJNO5jS7SCqUURaDcUYptVkhe6sNkufE=; b=aOoEZfftzyzDHE5B4kUbMpuepR1eFjLBLmQ6wdY0r4pJQbdCO0LButu7kX3ga+Gf54gi/S PWlGESll3ijZqLuJNa5L5PBVAwCabJeNobamFy6a8FFHCLj3yY5je4g4drJu2STc0o7/eE Uo5LGX7TC9MWb6jTbI0j0AbpUpVFkIV4rMtPaszmnE5xQL8S4H6oNHjr6vjlJi3ucM2MxO tNeut8YvNinskLK6vmS9AJdR+phUCY7izLx6y63jY8bFb0zMOn6yzy88AXRMVA640KMFao FTuP0FYnFu5CTx0NVOWJhUjdEhiXdlPsiNHk96+uY+0NfERYhjjxbBKP6x9rHQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663212471; a=rsa-sha256; cv=none; b=koDvcxGrpGE6Fn7hxd9Sx/6ILZZOI87DpaCMuSrU93YQKvsEkD4BUWUnxX5O2YvfijO6D1 AgUEjJZL0/ZSTO8nGHNMXfJsPahLXiP57+sf6zLsKPZzx0kLeJOhOQIV6mYfiLUDymGadd /ApzpteX6JEHAOcgS5yWDKN9Q/emmss3sje/gwVKgS8EeM767u7ri4jrxuQuMIiYZH0X0O g7a7qS87HFMSaAwYBppF6kwu0hQDC5tEJIn5F/G+VBNe/s9PBp3d73NwgiDpV7l8GM7C47 Xfuxvy5NOznZcDYoyYAmYpXpO3eg7HMkt4K8VFc6LsfdIwS/mXmeotyqZPo77Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=L1UDvfAH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.32 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=L1UDvfAH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 36CCE1AE0F X-Spam-Score: -3.32 X-Migadu-Scanner: scn1.migadu.com X-TUID: JfWnw06wJlpw "Christopher M. Miles" writes: > Ihor, My new patch still have some issue in the 'fold state which I > added "FIXME" marker. Hope can get some solution from you. I will comment only on the first patch for now. > "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" > "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" > "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" > - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") > + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" > + "ORG-IMAGE-ACTUAL-WIDTH") This change should also be mentioned in the commit message. > @@ -16164,14 +16165,19 @@ buffer boundaries with possible narrowing." > (org-element-property :begin par) > (re-search-forward attr-re par-end t))) > (match-string 1))) > + ;; support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified width. > + (subtree-property-width > + (ignore-errors (org-property-or-variable-value 'ORG-IMAGE-ACTUAL-WIDTH))) You are checking the property too late. I suggest to let-bind org-image-actual-width around the whole `cond' instead. That way, subtree-local value of ORG-IMAGE-ACTUAL-WIDTH will have an effect of setting `org-image-actual-width' value. Also, is there any particular reason why you wrap `org-property-or-variable-value' into `ignore-errors'? Finally, you can simply do (org-property-or-variable-value 'org-image-actual-width) It will return the property value _or_ org-image-actual-width value. > - (car org-image-actual-width)) > + ;; Try to use subtree-level width before fallback. > + (or subtree-property-width > + ;; Fallback to `org-image-actual-width' if no interprable width is given. > + (car org-image-actual-width))) With my last suggestion, this code will not be needed. Also, this change should be documented in etc/NEWS and also in "12.7 Images" section of the manual. -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92