>Message: 16
>Date: Sun, 31 Dec 2023 14:40:32 +0000
>From: Ihor Radchenko <[email protected]>
>To: Pedro Andres Aranda Gutierrez <[email protected]>
>Cc: Org Mode List <[email protected]>
>Subject: Re: Adding functionality to org-latex-classes
>Message-ID: <87ttny77vj.fsf@localhost>
>Content-Type: text/plain
>
>Pedro Andres Aranda Gutierrez <[email protected]> writes:
>
>> I was just wondering whether it would be possible to add further
>> functionality to org-latex-classes and would like to start a discussion
;-)
>>
>> My use case is the following:
>>
>> The document class is tightly coupled with ~org-latex-subtitle-format~
>> and ~org-latex-subtitle-separate~. Koma-script classes, for example,
need
>> those variables to be defined with file or directory local variables in
>> order to take full profit of the layouts. If we found a way of
>> accommodating them in the class definitions, the fuzz of the extra
>> variables could easily be overcome.
>
>We may extend `org-latex-classes' to allow custom backend option values.
>For example,
>
> (latex-subtitle-format . value)
> (latex-subtitle-separate . value)
>
>Then, we can use these values as the overrides when the variables are
>not set explicitly as buffer-locals or as in-buffer/subtree export
>keywords.
>
>--
>Ihor Radchenko // yantar92,
>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>
Attached is a concept which might be useful. At least it detects when
variables are set locally and then doesn't attempt anything.
Peaceful New Year,
/PA
--
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler
Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with 'C-x C-f' and enter text in its buffer.
(defun is-in-local-variable-alists (sym)
"Check if symbol is in any local variable alist"
(when
(or (and (boundp 'connection-local-variables-alist)
(assoc sym connection-local-variables-alist))
(and (boundp 'file-local-variables-alist)
(assoc sym file-local-variables-alist))
(and (boundp 'dir-local-variables-alist)
(assoc sym dir-local-variables-alist)))
t))
(defun local-or-latex-class ()
(interactive)
;;
;; This would come from ox-latex
;;
(let ((test '((org-latex-subtitle-format . "\\subtitle{%s}")
(org-latex-subtitle-separate . t))))
(mapcar #'(lambda (element)
(let* ((sym (car element))
(skip (is-in-local-variable-alists sym))
(sym-name (symbol-name sym))
(val (cdr element)))
;; (message "--> %s" element)
;; (if skip
;; (message "%s set as file-local" sym-name)
;; (progn
;; (message "Will set %s to %s" sym-name val)
;; (eval '(setq sym-name val))))))
(unless skip
(eval '(setq sym-name val)))))
test)
(message "Is separate: %s" org-latex-subtitle-separate)
(message "subtitle: %s" org-latex-subtitle-format))
)