all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Kroos <Philipp.Kroos@t-online.de>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] org-e-latex--collect-errors
Date: Sat, 15 Sep 2012 15:08:09 +0200	[thread overview]
Message-ID: <20120915130809.GA7816@desktop> (raw)
In-Reply-To: <87fw6jlbca.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]

Yes, you're completely right. I missed that.
Should be better now, I moved the defcustom to the end of the 
compilation-customs-block.

Thank you, Philipp


On Sat, Sep 15, 2012 at 02:28:05PM +0200, Nicolas Goaziou wrote:
> Hello,
> 
> Philipp Kroos <Philipp.Kroos@t-online.de> writes:
> 
> > the attached patch tries to solve two issues:
> > - Currently, org-e-latex--collect-errors only finds errors in 
> >   pdf.*latex-logs. I removed the `pdf`, cause most of the time I'm using 
> >   xelatex which wouldn't match. I don't know if this is generic enough 
> >   for all engines though.
> > - Occasionally, I'm running into errors currently not matched (Like 
> >   'Runaway argument'). What about the customizable 
> >   org-e-latex-known-errors introduced in the patch that would allow the 
> >   user to adjust the matcher to his needs and the used engine?
> >   This also makes the code more concise.
> >
> > What do you think about this?
> > (The first customizable I ever wrote, I think it's correct like this, is 
> > it?)
> 
> I think this patch is good, but would you mind moving your defcustom in
> the appropriate section within org-e-latex.el ? Also, there are spurious
> blank lines in this patch. Could you remove them too?
> 
> Thank you.
> 
> 
> Regards,
> 
> -- 
> Nicolas Goaziou

[-- Attachment #2: 0001-org-e-latex-Introduced-org-e-latex-known-errors.patch --]
[-- Type: text/plain, Size: 3045 bytes --]

From 493b2fa1914fff5e5eaf7875f1489e996efb92ca Mon Sep 17 00:00:00 2001
From: Philipp Kroos <philipp.kroos@t-online.de>
Date: Sat, 15 Sep 2012 14:58:49 +0200
Subject: [PATCH] org-e-latex: Introduced org-e-latex-known-errors

* contrib/lisp/org-e-latex.el: new customizable org-e-latex-known-errors
  is an alist of possible errors, taken from org-e-latex--collect-errors

* contrib/lisp/org-e-latex.el (org-e-latex--collect-errors):
  More concise code.
  The previous explicit search for errors is replaced by an iteration
  over the alist org-e-latex-known-errors.
---
 contrib/lisp/org-e-latex.el | 36 ++++++++++++++++++++----------------
 1 Datei geändert, 20 Zeilen hinzugefügt(+), 16 Zeilen entfernt(-)

diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index 458579c..66a4d9d 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -820,6 +820,21 @@ These are the .aux, .log, .out, and .toc files."
   :group 'org-export-e-latex
   :type 'boolean)
 
+(defcustom org-e-latex-known-errors
+  '(("Reference.*?undefined" .  "[undefined reference]")
+    ("Citation.*?undefined" .  "[undefined citation]")
+    ("Undefined control sequence" .  "[undefined control sequence]")
+    ("^! LaTeX.*?Error" .  "[LaTeX error]")
+    ("^! Package.*?Error" .  "[package error]")
+    ("Runaway argument" .  "Runaway argument"))
+  "Alist of regular expressions and associated messages for the user.
+   The regular expressions are used to find possible errors in
+   the log of a latex-run."
+  :group 'org-export-e-latex
+  :type '(repeat
+	  (cons
+	   (string :tag "Regexp")
+	   (string :tag "Message"))))
 
 \f
 ;;; Internal Functions
@@ -2709,24 +2724,13 @@ none."
     (save-excursion
       (goto-char (point-max))
       ;; Find final "pdflatex" run.
-      (when (re-search-backward "^[ \t]*This is pdf.*?TeX.*?Version" nil t)
+      (when (re-search-backward "^[ \t]*This is .*?TeX.*?Version" nil t)
 	(let ((case-fold-search t)
 	      (errors ""))
-	  (when (save-excursion
-		  (re-search-forward "Reference.*?undefined" nil t))
-	    (setq errors (concat errors " [undefined reference]")))
-	  (when (save-excursion
-		  (re-search-forward "Citation.*?undefined" nil t))
-	    (setq errors (concat errors " [undefined citation]")))
-	  (when (save-excursion
-		  (re-search-forward "Undefined control sequence" nil t))
-	    (setq errors (concat errors " [undefined control sequence]")))
-	  (when (save-excursion
-		  (re-search-forward "^! LaTeX.*?Error" nil t))
-	    (setq errors (concat errors " [LaTeX error]")))
-	  (when (save-excursion
-		  (re-search-forward "^! Package.*?Error" nil t))
-	    (setq errors (concat errors " [package error]")))
+	  (dolist (latex-error org-e-latex-known-errors)
+	    (when (save-excursion
+		    (re-search-forward (car latex-error) nil t))
+	      (setq errors (concat errors " " (cdr latex-error)))))
 	  (and (org-string-nw-p errors) (org-trim errors)))))))
 
 
-- 
1.7.12


  reply	other threads:[~2012-09-15 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-15 11:34 [PATCH] org-e-latex--collect-errors Philipp Kroos
2012-09-15 12:28 ` Nicolas Goaziou
2012-09-15 13:08   ` Philipp Kroos [this message]
2012-09-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

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

  git send-email \
    --in-reply-to=20120915130809.GA7816@desktop \
    --to=philipp.kroos@t-online.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.