emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [PATCH] ox-taskjuggler.el: Check return code instead of error buffer


From: Grégoire Jadi
Subject: [O] [PATCH] ox-taskjuggler.el: Check return code instead of error buffer
Date: Fri, 18 May 2018 10:36:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix)

Hello orgmode@,

I've recently tried taskjuggler and it reports some warnings about
Fixnum: https://github.com/taskjuggler/TaskJuggler/issues/200

However, this warnings do not prevent taskjuggler from exporting a
report. This patch checks the return code instead of the error buffer to
determine if the export process was successful or not.

WDYT?
Best,

From 7113e79ef8a9cd476873d278e1a4124be2f20f12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <address@hidden>
Date: Fri, 18 May 2018 10:30:38 +0200
Subject: [PATCH] ox-taskjuggler.el: Check return code instead of error buffer

* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-compile): Check the
return code of the taskjuggler call instead of the error buffer to
determine if the export by taskjuggler was successful or not (ignore
warnings). Also, do not erase the output buffer as it is already done
by `shell-command'.
---
 contrib/lisp/ox-taskjuggler.el | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
index 5dd9b2202..125cf7891 100644
--- a/contrib/lisp/ox-taskjuggler.el
+++ b/contrib/lisp/ox-taskjuggler.el
@@ -998,18 +998,16 @@ Return a list of reports."
       (let ((outbuf (get-buffer-create "*Org Taskjuggler Output*")))
        (unless (file-directory-p out-dir)
          (make-directory out-dir t))
-       (with-current-buffer outbuf (erase-buffer))
-       (shell-command
-        (replace-regexp-in-string
-         "%f" (shell-quote-argument full-name)
-         (replace-regexp-in-string
-          "%o" (shell-quote-argument out-dir)
-          org-taskjuggler-process-command t t) t t) outbuf)
-       ;; Collect standard errors from output buffer.
-       (setq errors (org-taskjuggler--collect-errors outbuf)))
-      (if (not errors)
-         (message "Process completed.")
-       (error (format "TaskJuggler failed with errors: %s" errors))))
+       (if (zerop (shell-command
+                   (replace-regexp-in-string
+                    "%f" (shell-quote-argument full-name)
+                    (replace-regexp-in-string
+                     "%o" (shell-quote-argument out-dir)
+                     org-taskjuggler-process-command t t) t t) outbuf))
+           (message "Process completed.")
+         ;; Collect standard errors from output buffer.
+         (setq errors (org-taskjuggler--collect-errors outbuf))
+         (error (format "TaskJuggler failed with errors: %s" errors)))))
     (file-expand-wildcards (format "%s/*.html" out-dir))))
 
 (defun org-taskjuggler--collect-errors (buffer)
-- 
2.16.2

Attachment: signature.asc
Description: PGP signature


reply via email to

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