From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oKe3AFODL2KwZwAAgWs5BA (envelope-from ) for ; Mon, 14 Mar 2022 19:02:59 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id mFK4NFKDL2KQSgEAG6o9tA (envelope-from ) for ; Mon, 14 Mar 2022 19:02:58 +0100 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 7B4B52E156 for ; Mon, 14 Mar 2022 19:02:58 +0100 (CET) Received: from localhost ([::1]:51678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTp21-0004N7-9P for larch@yhetil.org; Mon, 14 Mar 2022 14:02:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nToip-0007cw-6q for emacs-orgmode@gnu.org; Mon, 14 Mar 2022 13:43:07 -0400 Received: from [2607:f8b0:4864:20::b2a] (port=39625 helo=mail-yb1-xb2a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nToin-0000YW-BW for emacs-orgmode@gnu.org; Mon, 14 Mar 2022 13:43:06 -0400 Received: by mail-yb1-xb2a.google.com with SMTP id t11so554442ybi.6 for ; Mon, 14 Mar 2022 10:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=/WyS3xGytl7a29BFbrBpJiWYo2fZOpOHgDBz4x7PNO0=; b=TrozIY2IK7Fpf8Lw0pZCFApQL2b84WX9ZoVk1jvrisMB07pyjs+KN5Q06Hxud6Fw/c SJ1ZTl1DZ3xw9AxMeQkzbz/ba4bae0Y+PAASYW/5LxbIkcmPZYe3R2R1/MPicwzcLZt/ Y93hL8dNOaVXt1kOvR+K8RoQqGmg4wnNJeEAGbNqb3AuCW3DSi2TqFpftsF99j+NN7px 6Z1pTdiDkpzdnxEgab9anY2bHvJqnDoXjtmz++mD9BR2lM4oEgxx42YUmfqTf2fqCZDM PE/qc9xfSx1zR51UfkTXQ8Tpn5sxA75ljtntxvePuVvyEkE2qC9OObzCm57bs1otO+d4 UDJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=/WyS3xGytl7a29BFbrBpJiWYo2fZOpOHgDBz4x7PNO0=; b=IGuAXUxjiIMW46yIRIt2MCXPoeYTQqj2P895agF9ivlrzAvYJSyQ3gS6VX4bkXEp85 QoSebM/0fIXNHldqwhncFV0Tz7kM5PYG3OMtYY1UY2RS1PG7zwfBokXnDInh0vyduXXu WbHml3UfAVZwpd/PdZ3i+LX54h5azAleDgsM5v2UQWlcdF8do4jYGsmX0wLiGynUg6Tc ZguAkr+Zdo0AapCMZWa5hIN8+p5Fwu4I8UG/li+P6SzwmDfkx9XuhHHrk4Yx7CRTeBMn xvZj2eRbXLJcS1PR7sICJzSsMMbDKK/v2RQhH/PAo/9Ca6ktfMYdXwoHC9+kTMulapGu xAFg== X-Gm-Message-State: AOAM533IcbkObh8mV67vuhNvPIC4tn+waYMjHAXDgjGnaWnSxQoLDvp3 ki5T747KqjJwl9L5uzHIfG9OwJLeABuHktugJHC40uVpufU= X-Google-Smtp-Source: ABdhPJypG1McUnQaVl/f/9cCF8fDGqN53R+llJvL/k+Szhkwj9wH9OJKPxPssKympmJ12SLaGt5ADtddyvrb0YHBMmw= X-Received: by 2002:a05:6902:20e:b0:627:f1cb:a9ee with SMTP id j14-20020a056902020e00b00627f1cba9eemr18540944ybs.129.1647279783822; Mon, 14 Mar 2022 10:43:03 -0700 (PDT) MIME-Version: 1.0 From: Kaushal Modi Date: Mon, 14 Mar 2022 13:42:27 -0400 Message-ID: Subject: Possible bug in `org-subtree--get-subtree-options`? To: emacs-org list , Nicolas Goaziou Content-Type: multipart/alternative; boundary="0000000000005c48c305da3136e9" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::b2a (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::b2a; envelope-from=kaushal.modi@gmail.com; helo=mail-yb1-xb2a.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , 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=1647280978; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/WyS3xGytl7a29BFbrBpJiWYo2fZOpOHgDBz4x7PNO0=; b=V4GggyAkkoWPNQx75ktkWD8uJUwq4Pc1Rz81+lK41dvgzzUNt4iG6zMBnyDN0BnFUH18vw hrfM72KeeplLsozxX8dTWPLR2V/XKt9v8wxhOPUI+fM6319hFGk2zcHRfTMgUpHwkE9GDD YNg2HDoAcNiximDJt0IITzHkneBLRrEDon0g+QwDaH5cYAYemgfQjiIxmHZFkvegOjCVtq DplTmR0BQQygiqBH/fijWezrHsbaNPECiurGFO98tfHV2RNtXZKCXrL1KwfN5rL0BFdwa6 y5TZTP/fp3SKnOvtPwkzKHjkh/w4ueBpAO3PdnEvCZOnAv3f/oemR9hSZhLdJQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647280978; a=rsa-sha256; cv=none; b=qB3OHB5vta61GgQ6ukOFDU/R4sQccBe8Uvlj83o4rHH8Lw9wYqZ8Pw0H7DlwaU1S6owk64 h1gbk/dyk4oHZ4n9OJ5CSfUMgjdB5UQF5w2xJnX+gY/f63L+GXgJ1UYov60hBASkrQnrTv F11Mt2PEuulJdxq9fKpX94l4IMpYdoXzLemwpcobuciSHDB+MbaO937siGyxSoX4KErzlk sWCJ+dLivabZsbZhWxe++SZ8HUQFc0e0UQSVdyJFbIFUys32PVabzioTXknam+DDK/2b0y +xpspfZH/1mEuMCODUj6/4GqErAdVqlEmRIwOd7i7urAtlvVXd/APA9FpW9tYg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=TrozIY2I; 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: -4.67 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=TrozIY2I; 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: 7B4B52E156 X-Spam-Score: -4.67 X-Migadu-Scanner: scn0.migadu.com X-TUID: h0/sbtNk7Gxr --0000000000005c48c305da3136e9 Content-Type: text/plain; charset="UTF-8" Hello Nicolas, Today I was debugging something where a subtree export wasn't recognizing the EXPORT_OPTIONS property set in that subtree. MWE: ===== * Top level ** Allow broken links, but mark them :PROPERTIES: :EXPORT_FILE_NAME: allow-broken-links-but-mark-them :EXPORT_OPTIONS: broken-links:mark :END: ===== 1. Move cursor to BOL of "** Allow broken links, but mark them" line. 2. M-: (org-export--get-subtree-options) Output: (:title (#("Top level" 0 9 (:parent #1)))) Issue: Point is already on a heading, but it is jumping to the parent heading and returning that heading's properties. Debugging through how the export options got parsed in subtree exports, I reached the `org-export--get-subtree-options' function and this line in there: ;; https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ox.el#n1425 (if (org-at-heading-p) (org-up-heading-safe) (org-back-to-heading t)) It looks like the if condition actions are swapped here. Should it be: (if (org-at-heading-p) (org-back-to-heading t) (org-up-heading-safe)) ;; If point is in a heading, just go to the BOL (org-back-to-heading t) ;; Otherwise, jump up to a parent-heading if available. If I evaluate that function after updating that if condition as above and redo the steps I mentioned above, the output is now what I expect: (:with-broken-links mark :title (#("Allow broken links, but mark them" 0 33 (:parent #1)))) I am only surprised that this line has been there at least since 2015. Thanks! -- Kaushal Modi --0000000000005c48c305da3136e9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Nicolas,

Today I was d= ebugging something where a subtree export wasn't recognizing the EXPORT= _OPTIONS property set in that subtree.

MWE:
<= div>
=3D=3D=3D=3D=3D
* Top level
** Allow broken= links, but mark them
:PROPERTIES:
:EXPORT_FILE_NAME: allow-broken-li= nks-but-mark-them
:EXPORT_OPTIONS: broken-links:mark
:END:
= =3D=3D=3D=3D=3D

1. Move cursor to BOL of "** = Allow broken links, but mark them" line.
2. M-: (org-export-= -get-subtree-options)

Output:

=
(:title (#("Top level" 0 9 (:parent #1))))

Issue: Point is already on a heading, but it is jumping to the pare= nt heading and returning that heading's properties.

<= /div>
Debugging through how the export options got parsed in subtree ex= ports, I reached the `org-export--get-subtree-options' function and thi= s line in there:

(if (org-at-heading-p) (org-up-heading-safe)=20 (org-back-to-heading t))

It looks like the if condition actions are swapped here.

Should it be:

(if (org-at-heading-p) (org-back-to-heading t) (org-up-heading-safe))<= /div>;; If point is in a heading, just go to the BOL=C2=A0 (org-back-to-heading t)
;; Otherwise, jump up to a parent-he= ading if available.

If I evaluate that function af= ter updating that if condition as above and redo the steps I mentioned abov= e, the output is now what I expect:

(:with-broken-= links mark :title (#("Allow broken links, but mark them" 0 33 (:p= arent #1))))

I am only surprised that this line ha= s been there at least since 2015.

Thanks!

--
Kaushal Modi=
--0000000000005c48c305da3136e9--