all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Re: Adding functionality to org-latex-classes
@ 2024-01-01  8:06 Pedro Andres Aranda Gutierrez
  2024-01-01  9:21 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2024-01-01  8:06 UTC (permalink / raw)
  To: Org Mode List


[-- Attachment #1.1: Type: text/plain, Size: 1923 bytes --]

>Message: 16
>Date: Sun, 31 Dec 2023 14:40:32 +0000
>From: Ihor Radchenko <yantar92@posteo.net>
>To: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
>Cc: Org Mode List <emacs-orgmode@gnu.org>
>Subject: Re: Adding functionality to org-latex-classes
>Message-ID: <87ttny77vj.fsf@localhost>
>Content-Type: text/plain
>
>Pedro Andres Aranda Gutierrez <paaguti@gmail.com> 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

[-- Attachment #1.2: Type: text/html, Size: 2910 bytes --]

[-- Attachment #2: org-latex-classes.el --]
[-- Type: text/x-emacs-lisp, Size: 1552 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: Adding functionality to org-latex-classes
  2024-01-01  8:06 Re: Adding functionality to org-latex-classes Pedro Andres Aranda Gutierrez
@ 2024-01-01  9:21 ` Ihor Radchenko
  2024-01-01 17:00   ` Pedro Andres Aranda Gutierrez
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-01-01  9:21 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: Org Mode List

Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> Attached is a concept which might be useful. At least it detects when
> variables are set locally and then doesn't attempt anything.

You may rather need to hack on `org-export-get-environment', possibly
extending it. For example, we may allow more flexible
`org-export-options-alist'. 

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

Note that you can simply use `buffer-local-boundp'.

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: Adding functionality to org-latex-classes
  2024-01-01  9:21 ` Ihor Radchenko
@ 2024-01-01 17:00   ` Pedro Andres Aranda Gutierrez
  0 siblings, 0 replies; 3+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2024-01-01 17:00 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]

Thanks, I'll check it out!
Just a way to get over some sleepless nights...

/PA

On Mon, 1 Jan 2024 at 10:17, Ihor Radchenko <yantar92@posteo.net> wrote:

> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
>
> > Attached is a concept which might be useful. At least it detects when
> > variables are set locally and then doesn't attempt anything.
>
> You may rather need to hack on `org-export-get-environment', possibly
> extending it. For example, we may allow more flexible
> `org-export-options-alist'.
>
> > (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))
>
> Note that you can simply use `buffer-local-boundp'.
>
> --
> 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>
>


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

[-- Attachment #2: Type: text/html, Size: 2631 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-01 17:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-01  8:06 Re: Adding functionality to org-latex-classes Pedro Andres Aranda Gutierrez
2024-01-01  9:21 ` Ihor Radchenko
2024-01-01 17:00   ` Pedro Andres Aranda Gutierrez

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.