emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
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	[thread overview]
Message-ID: <86pq0eg415.fsf@somewhere.org> (raw)

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

             reply	other threads:[~2013-02-05 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 15:43 Sebastien Vauban [this message]
2013-02-06  0:15 ` [PATCH] Stop with an error if the LaTeX class is not known to the new exporter 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86pq0eg415.fsf@somewhere.org \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).