emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-taskjuggler.el: Check return code instead of error buffer
@ 2018-05-18  8:36 Grégoire Jadi
  0 siblings, 0 replies; only message in thread
From: Grégoire Jadi @ 2018-05-18  8:36 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 356 bytes --]

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,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-ox-taskjuggler.el-Check-return-code-instead-of-error.patch --]
[-- Type: text/x-patch, Size: 2157 bytes --]

From 7113e79ef8a9cd476873d278e1a4124be2f20f12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gjadi@omecha.info>
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-18  8:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-18  8:36 [PATCH] ox-taskjuggler.el: Check return code instead of error buffer Grégoire Jadi

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).