From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Ond=C5=99ej_Grover?= Subject: Re: [PATCH]Extend export hook example for removing headlines with tag ignore_heading Date: Mon, 13 Apr 2015 20:13:38 +0200 Message-ID: References: <87twwkj9gt.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001a1133378ab70c9b05139f12cd Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yhirf-0008TP-TB for emacs-orgmode@gnu.org; Mon, 13 Apr 2015 14:13:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yhira-0001l6-Sv for emacs-orgmode@gnu.org; Mon, 13 Apr 2015 14:13:43 -0400 Received: from mail-ob0-x230.google.com ([2607:f8b0:4003:c01::230]:35801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yhira-0001ks-Ls for emacs-orgmode@gnu.org; Mon, 13 Apr 2015 14:13:38 -0400 Received: by obbfy7 with SMTP id fy7so42069445obb.2 for ; Mon, 13 Apr 2015 11:13:38 -0700 (PDT) In-Reply-To: <87twwkj9gt.fsf@gmx.us> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --001a1133378ab70c9b05139f12cd Content-Type: multipart/alternative; boundary=001a1133378ab70c9505139f12cb --001a1133378ab70c9505139f12cb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Rasmus, Thanks. Your snippet doesn't work on these two examples. > > Can't promote from level 1: > > * h1 > :noexport: > no export > * h2 > :ignore_heading: > export > I've added a simple (when (> (outline-level) 1) (org-promote)) safety check to make sure indentation does not fail on level 1 headlines. > "export" becomes part of the noexport heading. > > * h0 > ** h1 > :noexport: > no export > ** h2 > :ignore_heading: > export > I have no idea how to get around this. It stems from the basic problem in Org mode that there are no entry closures AFAIK: To export the "export" it would have to be under a heading that does not have the :noexport: tag. This is actually one of the reasons why ignoreheading is used in many cases, to separate entries without creating a real headline. > > If this is often needed feature, ox.el and potentially backends should be > patched to support it. I think it would be great if ox did support it. > Of course, Nicolas would have the final say in such a matter. > I'm ok with that too, but it should be easily accessible so that people don't end up using broken snippets from the Internet. Therefore, such exporting functionality (I think it's mostly backend agnostic) would have to be well documented in the manual. > But I'm not sure so difficult hacks should be promoted in the manual. > It would indeed be better if the user only enabled some option documented in the manual instead of using code snippets. > Improving the example is fine, though. > Many of your comments actually touch on the already present sentences and code, I mostly added just several words to those. > It's great with better documentation for how to use org-map-entries! But > the example is not very robust. I think another, less complicated exampl= e > would be better. > I think it's still reasonably simple and clear for an example. It shows many useful things. With the when check it's a bit more robust, but it might get uglier if we try to somehow deal with the noexport stuff. Kind regards, Ond=C5=99ej Grover --001a1133378ab70c9505139f12cb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Rasmus,

Thanks.=C2=A0 Your snippet doesn't work on these two examples.
Can't promote from level 1:

=C2=A0 =C2=A0 * h1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0:noexport:
=C2=A0 =C2=A0 =C2=A0 no export
=C2=A0 =C2=A0 * h2=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :ignore_heading= :
=C2=A0 =C2=A0 =C2=A0 export
I've added a simple (when (> (outline-level) 1) (o= rg-promote)) safety check to make sure indentation does not fail on level 1= headlines.=C2=A0
"export" becomes part of the noexport heading.

=C2=A0 =C2=A0 * h0
=C2=A0 =C2=A0 ** h1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 :noexport:
=C2=A0 =C2=A0 =C2=A0 =C2=A0no export
=C2=A0 =C2=A0 ** h2=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 :ignore_heading:
=C2=A0 =C2=A0 =C2=A0 =C2=A0export
I have no idea how t= o get around this. It stems from the basic problem in Org mode that there a= re no entry closures AFAIK: To export the "export" it would have = to be under a heading that does not have the :noexport: tag.
This is act= ually one of the reasons why ignoreheading is used in many cases, to separa= te entries without creating a real headline.

If this is often needed feature, ox.el and potentially backends shou= ld be
patched to support it.=C2=A0 I think it would be great if ox did support it= .
Of course, Nicolas would have the final say in such a matter.
I'm ok with that too, but it should be easily accessi= ble so that people don't end up using broken snippets from the Internet= .
Therefore, such exporting functionality (I think it's = mostly backend agnostic) would have to be well documented in the manual.
But I'm not sure so difficult hacks should be promoted in the manual.
It would indeed be better if the user only enabled some= option documented in the manual instead of using code snippets.
Improving the example is fine, though.
Many of your co= mments actually touch on the already present sentences and code, I mostly a= dded just several words to those.
It's great with better documentation for how to use org-map-entries!=C2= =A0 But
the example is not very robust.=C2=A0 I think another, less complicated exa= mple
would be better.
I think it's still reasonably sim= ple and clear for an example. It shows many useful things.
Wi= th the when check it's a bit more robust, but it might get uglier if we= try to somehow deal with the noexport stuff.

Kind regard= s,
Ond=C5=99ej Grover

--001a1133378ab70c9505139f12cb-- --001a1133378ab70c9b05139f12cd Content-Type: text/x-diff; charset=US-ASCII; name="0001-org.texi-Extend-export-hook-example-with-ignore_head.patch" Content-Disposition: attachment; filename="0001-org.texi-Extend-export-hook-example-with-ignore_head.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_i8g76w0d0 RnJvbSAzZGFiYWUxY2Y0ODJmMjAwOGIyODI0MTE0NjhlNGI4MTBlYzJlMTljIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBPbmRyZWogR3JvdmVyIDxvbmRyZWouZ3JvdmVyQGdtYWlsLmNv bT4KRGF0ZTogU3VuLCAxMiBBcHIgMjAxNSAxMzo0MzozMSArMDIwMApTdWJqZWN0OiBbUEFUQ0hd IG9yZy50ZXhpOiBFeHRlbmQgZXhwb3J0IGhvb2sgZXhhbXBsZSB3aXRoIGlnbm9yZV9oZWFkaW5n IHRhZwogc3VwcG9ydAoKKiBkb2Mvb3JnLnRleGkgKEFkdmFuY2VkIGNvbmZpZ3VyYXRpb24pOiBF eHRlbmQgdGhlIHByZS1wcm9jZXNzaW5nCmV4cG9ydCBob29rIGV4YW1wbGUgdG8gc3VwcG9ydCBz aW1pbGFyIChidXQgc2ltcGxlciBhbmQgbW9yZSBnZW5lcmFsKQpmdW5jdGlvbmFsaXR5IGxpa2Ug dGhhdCBwcm92aWRlZCBieSB0aGUgaWdub3JlaGVhZGluZyB0YWcgaW4gdGh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