Pedro Andres Aranda Gutierrez <[email protected]> writes:

>> That's a bad idea to call ox-beamer functions from inside ox-latex.
>> This will lead to unmaintainable code if we mix different libraries.
>
> I was just trying to keep beamer code in ox-beamer.el
> But there is nothing that would break if we moved the function from
> ox-beamer.el to ox-latex.el. info will have the properties anyhow and
> independently
> of where the code is placed, or is there?

Nothing will break, yes.
But having beamer-related code in other files is simply a bad coding
practice, especially if that's such a core functionality as defining
themes. This is not about correctness, but about code quality.

If you have library functionality split across multiple other libraries,
it makes it difficult to understand how the code works. It also makes it
potentially difficult to change ox-latex -- it will effectively gain an
extra dependency to account for. Unfortunately, we already have bad
examples of such code style - org-agenda-prepare-buffers does
agenda-specific things in org.el, making the already complicated
org-agenda.el code even harder to parse.  I do not want such code to
proliferate.

>> If you want to modify how ox-latex generates the preamble, what about
>> modifying
>>
>> (unless (assoc "beamer" org-latex-classes)
>>   (add-to-list 'org-latex-classes
>>                '("beamer"
>>                  "\\documentclass[presentation]{beamer}"
>>                  ("\\section{%s}" . "\\section*{%s}")
>>                  ("\\subsection{%s}" . "\\subsection*{%s}")
>>                  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
>>
>> ?
>>
>> Or, alternatively, you can dynamically splice the theme into
>> :latex-classes in the INFO inside `org-beamer-template' before calling
>> `org-latex-make-preamble'.
>>
>
> Isn't that a bit of an overkill? Since the information is already there....
> This was just a way of keeping beamer stuff things together. But it really
> doesn't have to.
> I feel that moving the function from ox-beamer to ox-latex makes the trick
> cleaner.

I hope I explained the reasons clearly in the above.
I am strongly against splitting code between libraries. We already have
too much of such practice. That is just creating headaches for future
contributors.

My suggestion may be an overkill, yes. I will be happy if you find
something simpler. But please do avoid putting ox-beamer code into
ox-latex directly.

>> > +    (concat
>> > +     pre-header
>> > +     (mapconcat (lambda (args) (apply format-theme args))
>>
>> I'd write (lambda (prop command) ...) explicitly. That's more readable
>> IMHO.
>>
> I was trying to just factor out the original code and not touch it. And
> that is how it was originally...

Right. I did not notice that. I do not object keeping it then. Although
an improvement would be welcome (while we are at it).

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