From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2HnuD9ZGNWNQegAAbAwnHQ (envelope-from ) for ; Thu, 29 Sep 2022 09:18:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id gHBuD9ZGNWPSLgEAauVa8A (envelope-from ) for ; Thu, 29 Sep 2022 09:18:46 +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 1D294B2BF for ; Thu, 29 Sep 2022 09:18:45 +0200 (CEST) Received: from localhost ([::1]:44906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odnoi-0004hS-4N for larch@yhetil.org; Thu, 29 Sep 2022 03:18:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odnWK-0003f0-C0 for emacs-orgmode@gnu.org; Thu, 29 Sep 2022 02:59:50 -0400 Received: from [2409:8a28:6039:e940:52d2:f5ff:fe16:c591] (port=63126 helo=Mac-mini.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odnWH-0001aC-Oe for emacs-orgmode@gnu.org; Thu, 29 Sep 2022 02:59:44 -0400 Received: by Mac-mini.local (Postfix, from userid 501) id B106866423A9; Thu, 29 Sep 2022 14:59:33 +0800 (CST) 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> User-agent: mu4e 1.8.9; emacs 29.0.50 From: "Christopher M. Miles" To: Ihor Radchenko Cc: "Christopher M. Miles" , emacs-orgmode@gnu.org Subject: Re: [PATCH 2-v1 (test v1)] New: auto display inline images under subtree when `org-cycle'. Date: Thu, 29 Sep 2022 14:57:26 +0800 In-reply-to: <87y1u298yn.fsf@localhost> Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:8a28:6039:e940:52d2:f5ff:fe16:c591 (deferred) Received-SPF: softfail client-ip=2409:8a28:6039:e940:52d2:f5ff:fe16:c591; envelope-from=numbchild@gmail.com; helo=Mac-mini.local X-Spam_score_int: 25 X-Spam_score: 2.5 X-Spam_bar: ++ X-Spam_report: (2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, MSGID_MULTIPLE_AT=1, NML_ADSP_CUSTOM_MED=0.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, SPOOFED_FREEMAIL_NO_RDNS=0.001 autolearn=no 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: , Reply-To: numbchild@gmail.com 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=1664435925; h=from:from:sender:sender:reply-to: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; bh=tRPT1bo/zMV1mcw13u9hXU0t3vFuREsvA3Te/QMI0GE=; b=Et0gr8x/u2dp2PsREm0gabWEm6bPIvXG1unuDvkhJO4X9z0N2+iiHcbKQacOo42Pp7Eo3b NrkUDGwTj1ZhZbOpBHohN/62+oJ2yyI7edpNbj/E/3XSmI273/Jyzhm6EH7VwWG8MfXw0c HZb755YsLkBeA1QObDZq8yKq5nXtJtbF7KjmFLqSiQg3P8+7OdRZaIRUPALKJ7jDlNMiDz 3KIjXJ2t6bEt1AtgtlJ7GDwjDNG77oqdURwZxrG1Rp2EY7BNt+0xNlP+NEuLtWNXkMKewG r5dLKp0AHPUtMMiquLsy+sfWUCzwOYQ2jklKEVKpttMwsqYF4v8jw/tW+lEKJg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664435925; a=rsa-sha256; cv=none; b=WRq1njkMaTQ77cC33mruXz/7iGeV1v2/OmpmOAut+kVbdEMTv371AFRtk6ycFehDa58lCZ 85tRUnQhAG5dkXXSpIool94S7JQF/QO55jE1E7v4iLPnNinuFFkdJt5NbkiImhgnfm1gsO bhoReDGHnw2cx3Sy2S6wS7nJ39AWquuZaXUCl1AkrTzDMJdjWnPrJ1UVEsTPDuZv8jNOlM WXI6pzDu8m2O1u4f6uyt8HkSEBPujN/Xa6xAyQgCiBibGOSWW0PNVkX/V7KPKe5/yPWUKa rcqBKD8znzyHGY/BgWSp4mUjupR0lfFhNv5qkMWWrvzib5Xlp6Kap/Wcv+3mPg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: 2.76 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: 1D294B2BF X-Spam-Score: 2.76 X-Migadu-Scanner: scn0.migadu.com X-TUID: YV/ONUN2m1+0 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> Ok, I created the patch for subtree cycling display inline images. >> Tested by edebug when org cycling, it should works fine. I don't know >> how to write test for this. > > Thanks for the update! > > For tests, you will need to test the existence of image overlays. > You can refer to test-org-fold/org-fold-reveal-broken-structure but > need to test overlays-at instead of just org-invisible-p. I write a testing prototype, got a problem which I marked TODO in code. And can you check whether my tests correct? Thanks #+begin_src emacs-lisp ;;; 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) (org-cycle-inline-images-display t)) ;; `org-cycle' -(state)-> `'children' display child inline images. (org-test-with-temp-text "* Heading 1 [[file:image.png]]" (org-overview) (org-cycle) (org-next-link) (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))) ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. (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-next-link) (org-next-link) (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))) ;; `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)))))) #+end_src =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express without mi= sunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmM1QlUACgkQG13xyVro msNTowf/WQWGpcc6TtuNnyIigavWW5/o+xzE3U95+OFLFfdGi1dkYG1zo4pmRd70 1+6cHiau+lqvUjNgVruyhikzc4MgigT+GchZNUiNlCW09lukGpczEFAxGAT7MmD9 Z3qYFv1IWabGIGS5xbY1ss5TBHPr5aqr0XGDkgsVyf34tP58C2v64YnyjMSWfD8M 9Ty/WTFuZ0Hu5MuPDklnHscKWKUQu00FyTV+IQnyY56nVpPJtpDfRRwf2TnfoRb+ EwcM/jJOaRqlqoOB4do0RCh92e4pfaKE4jwl+bIFTsWASmwKHq7zR1owlHp8kkk7 Y0pqEmmXUvQDYs9rLLR0v8Jy+VZhpA== =ABHJ -----END PGP SIGNATURE----- --=-=-=--