emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Stop with an error if the LaTeX class is not known to the ne


From: Sebastien Vauban
Subject: [O] [PATCH] Stop with an error if the LaTeX class is not known to the new exporter
Date: Tue, 05 Feb 2013 16:43:18 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.92 (windows-nt)

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 <address@hidden>
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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]