emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Confused about what the COMMENT keyword means


From: Ihor Radchenko
Subject: Re: Confused about what the COMMENT keyword means
Date: Tue, 27 Sep 2022 15:40:57 +0800

Alain.Cochard@unistra.fr writes:

>  >        In-buffer settings may appear anywhere in the file, either directly
>  >     or indirectly through a file included using ‘#+SETUPFILE: filename or
>  >     URL’ syntax.
>  > 
>  > Because export settings are global, they have higher priority over the
>  > COMMENTed heading.
>
> OK, I can understand that but if, as I now see in 13.2, both TITLE and
> EXPORT_FILE_NAME are export settings, why does it behaves as I expect
> for TITLE (the title I get is indeed 'bart') but not for
> EXPORT_FILE_NAME?

This is a valid observation.
I checked the code more closely, and I have to admit that I was wrong.
Commented subtrees are, in fact, obeyed. Obeyed for all the keywords
_but_ the EXPORT_FILE_NAME!

Basically, including files, removing commented subtrees, and other
excluded elements is done in `org-export-as' function. It is done before
setting export options.

However, `org-export-as' is generally called inside `org-export-to-file'
and `org-export-to-file' needs to know which file to export to in
advance; before the buffer is stripped of commented trees. That's why
there is the observed inconsistency between EXPORT_FILE_NAME and TITLE
settings.

>  > > By contrast, with this file
>  > > 
>  > >    # * foo
>  > >    # #+EXPORT_FILE_NAME: foo.pdf
>  > >    # #+TITLE: foot
>  > >    # fofoo
>  > >    * bar
>  > >    #+EXPORT_FILE_NAME: bar.pdf
>  > >    #+TITLE: bart
>  > >    babar
>  > 
>  > This file contains no export settings.
>
> I don't understand that: what about the line '#+EXPORT_FILE_NAME:
> bar.pdf'??

Sorry, I was referring to the commented part only.

Let me clarify what I was referring to.

If you have a keyword like

#+KEYWORD: value

Org parses it like (keyword) syntax.

and if you comment the keyword as

# #+KEYWORD: value

Org will _not_ parse something like (comment (keyword))
It will stop by seeing a (comment) and will not look further.
Such keyword will be ignored all the times and no special arrangement is
required during the export process.

* COMMENT headings

are different.

If you have something like

* COMMENT heading
#+KEYWORD: value

Org does look inside:
(heading (:commentedp t) (keyword))

Then, such keyword can contribute to calculation of buffer settings.
It is only `org-export-as' that makes special arrangement and physically
removes COMMENTed subtrees before exporting the buffer.

Hope it is now more clear.

-- 
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]