emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Loading several latex classes for ox-latex
@ 2013-07-10 13:28 Julien Cubizolles
  2013-07-10 13:33 ` Nicolas Richard
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Cubizolles @ 2013-07-10 13:28 UTC (permalink / raw)
  To: emacs-orgmode

How can I run several add-to-list after a given package is loaded ? I
could of course do multiples:

(eval-after-load 'package_name '(add-to-list 'element 'list))

but I'm sure there's a more elegant way.

I tried the following:
--8<---------------cut here---------------start------------->8---
(eval-after-load 'ox-latex
  (progn '(add-to-list 'org-latex-classes
		       '("mpsi_beamer" "\\documentclass{mpsi_beamer}\n [NO-DEFAULT-PACKAGES]"
			 ("\\section{%s}" . "\\section*{%s}")
			 ("\\subsection{%s}" . "\\subsection*{%s}")
			 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
			 ))
	 '(add-to-list 'org-latex-classes 
		       '("mpsi" "\\documentclass[cours,Version,colonne]{mpsi}"
			 ("\\section{%s}" . "\\section*{%s}")
			 ("\\subsection{%s}" . "\\subsection*{%s}")
			 ))
	 ))
--8<---------------cut here---------------end--------------->8---

but only the second one (mpsi) is loaded.

Julien.

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

* Re: Loading several latex classes for ox-latex
  2013-07-10 13:28 Loading several latex classes for ox-latex Julien Cubizolles
@ 2013-07-10 13:33 ` Nicolas Richard
  2013-07-11  5:44   ` Julien Cubizolles
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Richard @ 2013-07-10 13:33 UTC (permalink / raw)
  To: Julien Cubizolles; +Cc: emacs-orgmode

Julien Cubizolles <j.cubizolles@free.fr> writes:
> I tried the following:
> --8<---------------cut here---------------start------------->8---
> (eval-after-load 'ox-latex
>   (progn '(add-to-list 'org-latex-classes
> 		       '("mpsi_beamer" "\\documentclass{mpsi_beamer}\n [NO-DEFAULT-PACKAGES]"
> 			 ("\\section{%s}" . "\\section*{%s}")
> 			 ("\\subsection{%s}" . "\\subsection*{%s}")
> 			 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
> 			 ))
> 	 '(add-to-list 'org-latex-classes 
> 		       '("mpsi" "\\documentclass[cours,Version,colonne]{mpsi}"
> 			 ("\\section{%s}" . "\\section*{%s}")
> 			 ("\\subsection{%s}" . "\\subsection*{%s}")
> 			 ))
> 	 ))
> --8<---------------cut here---------------end--------------->8---
>
> but only the second one (mpsi) is loaded.

that's because your (progn) is unquoted and thus evaluated at the same
time as eval-after-load, i.e. it returns its last value (which is the
second add-to-list form) and that is what is being added to the
eval-after-load list. What you want is the whole (progn) added there, so
an easy fix probably is to say '(progn ...) *and* remove the quotes
around the calls to add-to-list.

-- 
Nico.

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

* Re: Loading several latex classes for ox-latex
  2013-07-10 13:33 ` Nicolas Richard
@ 2013-07-11  5:44   ` Julien Cubizolles
  0 siblings, 0 replies; 3+ messages in thread
From: Julien Cubizolles @ 2013-07-11  5:44 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:


> that's because your (progn) is unquoted and thus evaluated at the same
> time as eval-after-load, i.e. it returns its last value (which is the
> second add-to-list form) and that is what is being added to the
> eval-after-load list. What you want is the whole (progn) added there, so
> an easy fix probably is to say '(progn ...) *and* remove the quotes
> around the calls to add-to-list.

Thank you, you were right.

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

end of thread, other threads:[~2013-07-11  5:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-10 13:28 Loading several latex classes for ox-latex Julien Cubizolles
2013-07-10 13:33 ` Nicolas Richard
2013-07-11  5:44   ` Julien Cubizolles

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).