h...@heagren.com writes:

>> I have no specific objections to adding a defcustom, but I am wondering
>> why not using #+INCLUDE directive and adding all the export settings
>> that way?
>
> I'm not sure what you mean by this? I tried a few workflows with
>   #+INCLUDE before settling on what I have now and none was quite
> satisfactory (for me).

I meant adding common #+INCLUDE directive to every Org file you
create. It will ingest some project-wide setup file.

I am asking because the patch you propose could as well be proposed for
any other export option that does not have associated variable.
So, some kind of common solution would be nice to have.

> (latex): Default to `org-latex-default-class-options'.
> * etc/ORG-NEWS (New option ~org-latex-default-class-options~):
> Document above.

*the above
I think

> +*** New option ~org-latex-default-class-options~

I am wondering why not `org-latex-class-options'. Your name does not
match #+LATEX_CLASS_OPTIONS, which is a bit awkward.

> +to ~#+LATEX_CLASS~.

=#+LATEX_CLASS= - it is not code.

> +(defcustom org-latex-default-class-options ""

I think that the default should be nil.

> +  "The default options passed to the document class."

This docstring is not very clear.
Now, when I am looking into exact effect of setting this new variable,
it appears to me that there is an important pitfall that at least makes
is necessary to expand the docstring and at most makes this new option
unnecessary.

The way, :latex-class-options is applied in the code is

(if (not class-options) header
  (replace-regexp-in-string
    "^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
    class-options header t nil 1))

And header is taken from `org-latex-classes'. For example, it can be
"\\documentclass[11pt]{article}"

... and [11pt] will be overridden by :latex-class-options.

The above observation implies that `org-latex-classes' already gives you
a way to set default class options. So, maybe your patch is not
necessary for your workflow after all?

In any case, "default" in the option name will be misleading as it is
not clear which default should be used - from org-latex-classes or from
org-latex-default-class-options.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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