0

I am interested in exporting disjoint sections of my Org document via setting marks, as I find them most convenient. I am aware of the :export and :noexport tags, but seeing as how I have to constantly shift around what parts of the document I want to export, this sounds unfeasible to me (or at the very least cumbersome, as I have to constantly juggle the tags of each section, instead of just marking them).

A more concrete example: I always want my first section exported no matter what, but then I only want sections 5, 8 and 11 to be exported, and nothing else. I found it really convenient to use marks and then just C-c C-e l p to export my document as a TeX file when I need only one section, but I am unsure of how to do this now.

Is what I want possible? If not, is there a hassle-less alternative to what I want?

Clarification: By marks, I refer to the region selection you use via C-SPC.

6
  • What kind of marks are you talking about? E.g C-<space> sets the mark at one end of a region (and point is the other end). But there is only one such at at any particular time, so how are you going to use that for multiple regions? Or perhaps you are talking about bookmarks?
    – NickD
    Commented Aug 23, 2023 at 18:16
  • @NickD: Perhaps OP means markers. There are any number of markers in a buffer, one of which is the one called "the mark". See Markers. OP: Please clarify the question; thx.
    – Drew
    Commented Aug 23, 2023 at 20:05
  • @NickD Yes, I was referring to those marks. Sorry for being ambiguous, I was unsure what to call them (regions?)
    – daedsidog
    Commented Aug 23, 2023 at 23:11
  • 1
    As I pointed out in the first comment, there is only one such mark, so you cannot select multiple regions for export.
    – NickD
    Commented Aug 23, 2023 at 23:58
  • @NickD I see. Any alternative solutions to easily exporting multiple sections on a whim? I have a very large, sensitive document, of which I want to limit the exposure of. I want to share only certain segments, but these change based on vs. who I am dealing with.
    – daedsidog
    Commented Aug 24, 2023 at 0:18

1 Answer 1

1

I don't know if the following will help, but here goes: you are not limited to export/noexport tags in order to trigger the selective exporting functionality.

E.g. suppose that you want to share some sections with everybody, some sections with Tom, some sections with Dick and some sections with Harry (and it might happen that some of these sections overlap). You tag each section with a tag corresponding to the person you want to share that section with; if a section is to be shared with multiple people, you tag it with all relevant tags; if a section is to be shared with everybody you tag it with e.g. the tag common[1]. Here's a concrete example:


* zero                                                               :common:

* one                                                                   :tom:

* two                                                                  :dick:

* three                                                               :harry:

* four                                                             :tom:dick:

* five                                                            :tom:harry:

* six                                                            :dick:harry:

So sections zero, one, four and five are to be shared with Tom, sections zero, two, four and six are to be shared with Dick and sections zero, three, five and six are to be shared with Harry.

You can use #+SELECT_TAGS (which by default contains only the export tag) to define which tags you want to select for export. E.g to select only the common sections that are tagged common and the sections tagged tom, add this line to the top of the file before exporting:

#+SELECT_TAGS: common tom

...

You only have to change that one line in order to change the export to select Dick's sections or Harry's sections. If you add another person to the list, all you have to do is add the tag for the new person to the tags of each section that the new person should see[2].

I don't know if this will cover all your needs, but it seems to cover the situation you describe in your comment above; it can also easily cover the selective export you describe in your question: tag each section with a different tag and then add to #+SELECT_TAGS only the tags for the sections you want to export.


There is also #+EXCLUDE_TAGS (which contains just noexport by default) that could potentially be used in more complicated situations, but you should keep things as simple as possible: using both might become confusing.


See Export Settings in the manual for more details (although I think the description leaves something to be desired).


Footnotes:

[1] You could tag it with all the person tags instead, but it's better to have a tag like common for this case.

[2] If you tagged the common sections with the tags for each person, you'd have to change each such section's tags and add the new person to all of them. That's why it's better to use a common tag.

1
  • 1
    This works quite well for my needs as it allows me to organize the document by levels of sensitivity. Thanks for the in-depth answer, as always.
    – daedsidog
    Commented Aug 24, 2023 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.