From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mPZVOfewN2NZXgEAbAwnHQ (envelope-from ) for ; Sat, 01 Oct 2022 05:16:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 0P5gOfewN2PLeAAA9RJhRA (envelope-from ) for ; Sat, 01 Oct 2022 05:16:07 +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 6F5963DE92 for ; Sat, 1 Oct 2022 05:16:07 +0200 (CEST) Received: from localhost ([::1]:47760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeSyz-0003Gp-Pl for larch@yhetil.org; Fri, 30 Sep 2022 23:16:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeSyN-0003G2-Vz for emacs-orgmode@gnu.org; Fri, 30 Sep 2022 23:15:28 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:40516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeSyC-0005Bo-Nr for emacs-orgmode@gnu.org; Fri, 30 Sep 2022 23:15:27 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 2so55053pgl.7 for ; Fri, 30 Sep 2022 20:15:16 -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=Fa4by4fkQWTF6+s4HBKammJnWiMDIyeroP8nYecJI4k=; b=RmUIiV4YjQBTubQaU28rAha/Oj9Dk3gulnK45qPZqSGZ74N4MXt7wOjYIpMl4iyI8Z gqXECz5tsRdEIlFN3O6EAfyQp7Ik+TVcAZaB8C61pg9IDFJdE2QYWc4vWEzZnMmQjRAl o8F33CDsnRfdJaOaStQze4qXimvdWIi595/Ln2V+LZqqaoMYUy28l5RdyyH8hh9xgEty rxU3w9n2I2cI/tgoW2kD0cYcTzq5UlJb8jUtGYaYWgCjeLRXG6fdauiE1xnOKsk8m8OZ XrhJyEPf9FGIxTkIn8KAkUaJoYvhxo4YF7erZHkwxOLhrRWTt/xmaZhtU6tqhVpI+D4t NOTA== 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=Fa4by4fkQWTF6+s4HBKammJnWiMDIyeroP8nYecJI4k=; b=5oL8EyG3OCskROWy2k75CMzel0wB8AmNIMP8WMYBH078VtBhBrQkDs3VOqfQdFZhJl fdQvv9XGNOoWc/UJ53oncxLzASAemAqWlMYUkTpzTjrxXCQ2YKx4Hnm+QzoBG6CcAA3X X3hpCPLapxTMj+G57hBc8R1mCmRRGQAYZfv+zbj1LxxxQUln5e7H/RWYTfCxdwAQMdNM eKBX8EpEVfx3Z+KAJ0s9G1GQdTp50+YKB/Rl0YPlAIMNmq8KtYnu/B4eHlY23zU2iP3v F2TSGjzspEADOekf5AnKbwL5BGFmi9qEX1nhzHLG036SWg9Cum2yXRdrZsre2+W29zBd VGCQ== X-Gm-Message-State: ACrzQf3jXmDeiYuh0tS50dclJHFuJpd3G2kQS6VDAuXcoTyCpDAZq3IY JZNw8yEwL6DbasG51TPqKq8= X-Google-Smtp-Source: AMsMyM4yWmgjobSDJHQ5VvWCSqe6uLH1yaobTkClzULQPkdn+7UvbvKMDY+P69pN0Z7e2j5m6cl5Tw== X-Received: by 2002:a05:6a00:9a7:b0:54c:27c4:3ad6 with SMTP id u39-20020a056a0009a700b0054c27c43ad6mr12320528pfg.9.1664594115043; Fri, 30 Sep 2022 20:15:15 -0700 (PDT) Received: from localhost ([2409:8970:a80:3a4:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id jx15-20020a17090b46cf00b002033b3875eesm2385376pjb.20.2022.09.30.20.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 20:15:14 -0700 (PDT) From: Ihor Radchenko To: "Christopher M. Miles" Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH 2-v2] New: auto display inline images under subtree when `org-cycle'. In-Reply-To: <6336a955.050a0220.4e72e.2b23SMTPIN_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> <87bkrhwc42.fsf@localhost> <6322b0a8.050a0220.59bb8.6923SMTPIN_ADDED_BROKEN@mx.google.com> <87y1uluir1.fsf@localhost> <6322f5ad.c80a0220.5e936.823eSMTPIN_ADDED_BROKEN@mx.google.com> <878rmesf64.fsf@localhost> <6329c8b0.050a0220.412d.0a6cSMTPIN_ADDED_BROKEN@mx.google.com> <87tu51xivh.fsf@localhost> <633454e3.050a0220.7278b.1fa5SMTPIN_ADDED_BROKEN@mx.google.com> <87y1u298yn.fsf@localhost> <63353c69.370a0220.67788.e8a1SMTPIN_ADDED_BROKEN@mx.google.com> <87o7ux4khz.fsf@localhost> <6336a955.050a0220.4e72e.2b23SMTPIN_ADDED_BROKEN@mx.google.com> Date: Sat, 01 Oct 2022 11:16:07 +0800 Message-ID: <87bkqw2pzc.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=yantar92@gmail.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664594167; 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=Fa4by4fkQWTF6+s4HBKammJnWiMDIyeroP8nYecJI4k=; b=OJb6l6UpnJpIOKoINMjubXe2vAiZFXsh4653i8RagyyNVLmieHB7eUiZk2nnDLmGkjf5y8 e3e9jLgU+tZZsV52+12sXYUBroOkAj+a72ZsPyZQm4YT0oojsWoE348oUc+BiNVMN2DOIb BSdnvSowpJfLiEeTKWdrPdH+IpwTKo8ph5036Pl80HNfFtiltnzuVA60DDGZrrNDDllllK O9zkP+3SjjENy7fiBRSOf7KHWCFa4oZp92FEZjgdTdQVz1Ztr8Ji1vNzaxqFIAXilW/NRr HKk6/qIXQK8fiB3et6DCWXjtKL7Q9xk0a4A44WCDDspb5lFbgdMKq9Ipsg3zXw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664594167; a=rsa-sha256; cv=none; b=o+uqAFGv575PQ3xTtj+S281I6pGZu8B5diR2OfIUYIY34YLFmjN3iq8m/fHpKZinsCIGYC wuUZ7OYqSB9rshhZzymEMK1Mz9wfyqi2P6lxtIMb8SNjGKODqeYUAgJ0xUWYefIdzfGdAL 5jsYnn6EaVFezYIecSdDnwg2D711uXRtWebyquubNQgh88uWDrXklOlG0ACFLFpCwPHJ9x zOAaHhPkWMXyPkM5ZAWCevvM6pPWlUlRtUnCRq1X5Vfu+vsTn0w3PotV5DCsepjfsQfmXC 2Com2g45qWnUYD0wei2FRmBhqKVYnQ7sBoX0yjLDGbXro/qa59yet5zVsmqjmg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RmUIiV4Y; 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.34 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RmUIiV4Y; 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: 6F5963DE92 X-Spam-Score: -3.34 X-Migadu-Scanner: scn1.migadu.com X-TUID: 8imKjOsEdA9U "Christopher M. Miles" writes: > I attached new version patch. Thanks! > +(defcustom org-cycle-inline-images-display nil > + "Non-nil means auto display inline images under subtree when cycling." > + :group 'org-startup > + :group 'org-cycle > + :type 'boolean) Please add :package-version tag as well. > + ('folded > + (save-excursion > + (save-restriction > + (org-narrow-to-subtree) > + ;; FIXME: sometimes `point-max' is EOF. Do you still need this FIXME? Also, you can use `org-with-wide-buffer' instead of save-excursion/restriction. > +;;; TODO: reference `test-org-fold/org-fold-reveal-broken-structure' > +(ert-deftest test-org-fold/org-fold-display-inline-images () > + "Test inline images displaying when cycling." > + (let ((org-fold-core-style 'text-properties) Why do you need to set `org-fold-core-style' explicitly here? > + (org-cycle-inline-images-display t)) > + ;; `org-cycle' -(state)-> `'children' display child inline images. > + (org-test-with-temp-text > + "* Heading 1 > +[[file:image.png]]" This will not work in real tests. image.png will not exist. You will need to provide a reference image in testing/examples > + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. > + (org-test-with-temp-text > + "* Heading 1 > +[[file:image.png]] > +** Subheading 1 > +[[file:image2.png]] > +** Subheading 2 > +[[file:image3.png]]" > + (org-overview) > + (org-cycle) > + (org-cycle) > + (org-cycle) > + ;; TODO: how to detect inline image overlays are deleted after folded? > + (should (overlays-at (point))) > + (org-toggle-inline-images) > + (should-not (overlays-at (point)))))) This latest test will not work. The point is at BOB. -- 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