emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: daimrod@omecha.info (Grégoire Jadi)
To: emacs-orgmode@gnu.org
Subject: [PATCH] ox-taskjuggler.el: Check return code instead of error buffer
Date: Fri, 18 May 2018 10:36:04 +0200	[thread overview]
Message-ID: <87d0xtqs23.fsf@omecha.info> (raw)


[-- 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 --]

                 reply	other threads:[~2018-05-18  8:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87d0xtqs23.fsf@omecha.info \
    --to=daimrod@omecha.info \
    --cc=emacs-orgmode@gnu.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).