* [PATCH] Stop with an error if the LaTeX class is not known to the new exporter
@ 2013-02-05 15:43 Sebastien Vauban
2013-02-06 0:15 ` Eric S Fraga
2013-02-06 18:49 ` Nicolas Goaziou
0 siblings, 2 replies; 6+ messages in thread
From: Sebastien Vauban @ 2013-02-05 15:43 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hello Nicolas,
I've lost (a bit of) time looking at why my documents were wrong with the new
exporter. The fact is I've customized:
(setq org-e-latex-default-class "myarticle")
but hadn't added yet that private class to the list `org-e-latex-classes'.
The result: a PDF, but completely undreadable, as it's missing the
`documentclass' directive.
Here a patch to throw an error to the user, signaling he's forgotten some
pieces of the puzzle, in case he played with such vars. Better stop early, and
giving hints to the user how to correct the problem, no?
Feel free to adapt it to your wishes.
Best regards,
Seb
From 3f1ef08b5accdb16495f72e27e44fbad078b87ee Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
Date: Tue, 5 Feb 2013 16:36:29 +0100
Subject: [PATCH] Throw an error when class is unknown
* org-e-latex.el (org-e-latex-template): Throw an error when the LaTeX class
is not part of `org-e-latex-classes'.
---
contrib/lisp/org-e-latex.el | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index f115a6d..9cd0a10 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -1103,15 +1103,17 @@ holding export options."
(replace-regexp-in-string
"^[ \t]*\\\\documentclass\\(\\(\\[.*\\]\\)?\\)"
class-options header t nil 1)))))
- (when document-class-string
- (org-e-latex--guess-babel-language
- (org-e-latex--guess-inputenc
- (org-splice-latex-header
- document-class-string
- org-export-latex-default-packages-alist ; defined in org.el
- org-export-latex-packages-alist nil ; defined in org.el
- (plist-get info :latex-header-extra)))
- info)))))
+ (if document-class-string
+ (org-e-latex--guess-babel-language
+ (org-e-latex--guess-inputenc
+ (org-splice-latex-header
+ document-class-string
+ org-export-latex-default-packages-alist ; defined in org.el
+ org-export-latex-packages-alist nil ; defined in org.el
+ (plist-get info :latex-header-extra)))
+ info)
+ (error "LaTeX class `%s' is unknown; add it to `org-e-latex-classes'"
+ class)))))
;; Possibly limit depth for headline numbering.
(let ((sec-num (plist-get info :section-numbers)))
(when (integerp sec-num)
--
1.7.9
--
Sebastien Vauban
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Stop with an error if the LaTeX class is not known to the new exporter
2013-02-05 15:43 [PATCH] Stop with an error if the LaTeX class is not known to the new exporter Sebastien Vauban
@ 2013-02-06 0:15 ` Eric S Fraga
2013-02-06 7:33 ` Sebastien Vauban
2013-02-06 18:49 ` Nicolas Goaziou
1 sibling, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2013-02-06 0:15 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
Sebastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hello Nicolas,
>
> I've lost (a bit of) time looking at why my documents were wrong with the new
> exporter. The fact is I've customized:
Ah ha! We've found the same problem through different routes. See my
recent email re: beamer export also resulting in a latex file with no
documentclass.
--
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org 7.9.3e-897-g787a07
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Stop with an error if the LaTeX class is not known to the new exporter
2013-02-06 0:15 ` Eric S Fraga
@ 2013-02-06 7:33 ` Sebastien Vauban
0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Vauban @ 2013-02-06 7:33 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
Eric S Fraga wrote:
> Sebastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> I've lost (a bit of) time looking at why my documents were wrong with the new
>> exporter. The fact is I've customized:
>
> Ah ha! We've found the same problem through different routes. See my
> recent email re: beamer export also resulting in a latex file with no
> documentclass.
Absolutely... I was reading you in the other thread first, and was thinking:
that wouldn't have happen anymore with my patch! ;-)
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Stop with an error if the LaTeX class is not known to the new exporter
2013-02-05 15:43 [PATCH] Stop with an error if the LaTeX class is not known to the new exporter Sebastien Vauban
2013-02-06 0:15 ` Eric S Fraga
@ 2013-02-06 18:49 ` Nicolas Goaziou
2013-02-15 10:09 ` Sebastien Vauban
1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2013-02-06 18:49 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
Hello,
"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
> I've lost (a bit of) time looking at why my documents were wrong with the new
> exporter. The fact is I've customized:
>
> (setq org-e-latex-default-class "myarticle")
>
> but hadn't added yet that private class to the list `org-e-latex-classes'.
>
> The result: a PDF, but completely undreadable, as it's missing the
> `documentclass' directive.
>
> Here a patch to throw an error to the user, signaling he's forgotten some
> pieces of the puzzle, in case he played with such vars. Better stop early, and
> giving hints to the user how to correct the problem, no?
>
> Feel free to adapt it to your wishes.
Thank you. I have applied it on the soon to be merged back-end.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Stop with an error if the LaTeX class is not known to the new exporter
2013-02-06 18:49 ` Nicolas Goaziou
@ 2013-02-15 10:09 ` Sebastien Vauban
2013-02-15 13:23 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Sebastien Vauban @ 2013-02-15 10:09 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hello Nicolas,
Nicolas Goaziou wrote:
> "Sebastien Vauban" writes:
>
>> I've lost (a bit of) time looking at why my documents were wrong with the new
>> exporter. The fact is I've customized:
>>
>> (setq org-e-latex-default-class "myarticle")
>>
>> but hadn't added yet that private class to the list `org-e-latex-classes'.
>>
>> The result: a PDF, but completely undreadable, as it's missing the
>> `documentclass' directive.
>>
>> Here a patch to throw an error to the user, signaling he's forgotten some
>> pieces of the puzzle, in case he played with such vars. Better stop early, and
>> giving hints to the user how to correct the problem, no?
>>
>> Feel free to adapt it to your wishes.
>
> Thank you. I have applied it on the soon to be merged back-end.
Your fix misses an argument to the error message, hence the `format-string'
function is failing.
Here is the patch:
From da73b71d13cac5705c8987c87e26a673a52345be Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
Date: Fri, 15 Feb 2013 10:54:36 +0100
Subject: [PATCH] Add missing class argument in error string
* ox-latex.el (org-latex-template): Add missing `class' argument for
`format-string'.
---
lisp/ox-latex.el | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index c135042..9d5b5c5 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1112,7 +1112,7 @@ holding export options."
"^[ \t]*\\\\documentclass\\(\\(\\[.*\\]\\)?\\)"
class-options header t nil 1)))))
(if (not document-class-string)
- (user-error "Unknown LaTeX class `%s'")
+ (user-error "Unknown LaTeX class `%s'" class)
(org-latex-guess-babel-language
(org-latex-guess-inputenc
(org-splice-latex-header
--
1.7.9
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Stop with an error if the LaTeX class is not known to the new exporter
2013-02-15 10:09 ` Sebastien Vauban
@ 2013-02-15 13:23 ` Nicolas Goaziou
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2013-02-15 13:23 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
> Your fix misses an argument to the error message, hence the `format-string'
> function is failing.
Applied. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-02-15 13:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05 15:43 [PATCH] Stop with an error if the LaTeX class is not known to the new exporter Sebastien Vauban
2013-02-06 0:15 ` Eric S Fraga
2013-02-06 7:33 ` Sebastien Vauban
2013-02-06 18:49 ` Nicolas Goaziou
2013-02-15 10:09 ` Sebastien Vauban
2013-02-15 13:23 ` Nicolas Goaziou
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).