From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: [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 Message-ID: <86pq0eg415.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org 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 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