From: KDr2 <killy.draw@gmail.com>
To: Bastien <bzg@altern.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Prepare release 8.2.6
Date: Thu, 3 Apr 2014 18:13:39 +0800 [thread overview]
Message-ID: <CAHfjm6j6NV1vqy2XL8=YrweSQ3fC1qrhg6eTxy9iDMAsAAnaLA@mail.gmail.com> (raw)
In-Reply-To: <87sipu4zne.fsf@bzg.ath.cx>
[-- Attachment #1.1: Type: text/plain, Size: 1356 bytes --]
Hi Bastien,
I sent a mail "[PATCH] ob-scheme.el: Fix scheme code blocks execution error
in batch mode" to the list yesterday, but I don't see it at
http://news.gmane.org/gmane.emacs.orgmode, so here I sent it to you again:
The bug:
write file ~/scheme-test.org with the content below:
-------8<--------------
#+BEGIN_SRC scheme :exports results :results output raw
(display "Hello Scheme in OrgMode")
#+END_SRC
-------8<--------------
and run:
emacs --batch --eval='(load "~/.emacs.d/init.el")' ~/scheme-test.org -f
org-html-export-to-html
you will find the bug:
`org-babel-scheme-execute-with-geiser' uses `current-message' to get the
results of scheme code blocks, but `current-message' always returns nil in
batch mode, and the attached patch fixes this.
Please consider to apply it, thanks.
On Thu, Apr 3, 2014 at 3:53 PM, Bastien <bzg@altern.org> wrote:
> Hi all,
>
> I'll spend a few hours this afternoon chasing the last
> bugs in maint for Org 8.2.6. This release will then be
> merged into the emacs-24 branch, which first pretest is
> to be released very soon now.
>
> If you have outstanding bugs, please point at them.
>
> As usual, thanks in advance for your help,
>
> PS: gmane.org seems to be down since April, 1st, so I
> could not follow the discussions since that time.
>
> --
> Bastien
>
>
--
--
KDr2, http://kdr2.com
[-- Attachment #1.2: Type: text/html, Size: 2442 bytes --]
[-- Attachment #2: 0001-ob-scheme.el-Fix-scheme-code-blocks-execution-error-.patch --]
[-- Type: text/x-patch, Size: 2291 bytes --]
From cebf9fc4fe09ab22fd31ff8e5606d0f680c121e9 Mon Sep 17 00:00:00 2001
From: KDr2 <killy.draw@gmail.com>
Date: Wed, 2 Apr 2014 10:30:38 +0800
Subject: [PATCH] ob-scheme.el: Fix scheme code blocks execution error in batch
mode
* lisp/ob-scheme.el (org-babel-scheme-capture-current-message, org-babel-scheme-execute-with-geiser): Capture scheme code results via current-message both in interactive mode and noninteractive mode.
`org-babel-scheme-execute-with-geiser' uses `current-message' to get the results of scheme code blocks, but `current-message' always returns nil in batch mode, and this patch fixes this.
Modified from a patch proposal by KDr2
---
lisp/ob-scheme.el | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index b7117e9..3b7ceb2 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -118,6 +118,17 @@ org-babel-scheme-execute-with-geiser will use a temporary session."
(name))))
result))
+(defmacro org-babel-scheme-capture-current-message (&rest body)
+ "Capture current message in both interactive and noninteractive mode"
+ `(if noninteractive
+ (let ((current-message nil))
+ (flet ((message (fmt &rest args) (setq current-message (apply #'format fmt args))))
+ ,@body
+ current-message))
+ (progn
+ ,@body
+ (current-message))))
+
(defun org-babel-scheme-execute-with-geiser (code output impl repl)
"Execute code in specified REPL. If the REPL doesn't exist, create it
using the given scheme implementation.
@@ -142,10 +153,11 @@ is true; otherwise returns the last value."
(current-buffer)))))
(setq geiser-repl--repl repl-buffer)
(setq geiser-impl--implementation nil)
- (geiser-eval-region (point-min) (point-max))
+ (setq result (org-babel-scheme-capture-current-message
+ (geiser-eval-region (point-min) (point-max))))
(setq result
- (if (equal (substring (current-message) 0 3) "=> ")
- (replace-regexp-in-string "^=> " "" (current-message))
+ (if (and (stringp result) (equal (substring result 0 3) "=> "))
+ (replace-regexp-in-string "^=> " "" result)
"\"An error occurred.\""))
(when (not repl)
(save-current-buffer (set-buffer repl-buffer)
--
1.9.1
next prev parent reply other threads:[~2014-04-03 10:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-03 7:53 Prepare release 8.2.6 Bastien
2014-04-03 9:17 ` Alan Schmitt
2014-04-03 10:13 ` KDr2 [this message]
2014-04-03 11:47 ` Rainer M Krug
2014-04-18 12:04 ` Bastien
2014-04-28 13:40 ` Rainer M Krug
2014-04-03 11:47 ` Rainer M Krug
-- strict thread matches above, loose matches on Subject: below --
2014-04-03 6:37 Bastien
2014-04-04 9:05 ` Sebastien Vauban
2014-04-04 11:51 ` Michael Weylandt
2014-04-05 16:41 ` R. Michael Weylandt
2014-04-05 19:18 ` Nicolas Goaziou
2014-04-07 1:48 ` R. Michael Weylandt
2014-04-07 10:19 ` Nicolas Goaziou
2014-04-17 19:58 ` Bastien
2014-04-04 14:32 ` Michael Weylandt
2014-04-05 16:45 ` R. Michael Weylandt
2014-04-05 19:27 ` Nicolas Goaziou
2014-04-05 21:48 ` York Zhao
2014-04-06 17:51 ` R. Michael Weylandt
2014-04-06 18:03 ` Nicolas Goaziou
2014-04-11 2:43 ` Eric Schulte
2014-04-13 17:02 ` R. Michael Weylandt
2014-04-17 6:26 ` Bastien
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='CAHfjm6j6NV1vqy2XL8=YrweSQ3fC1qrhg6eTxy9iDMAsAAnaLA@mail.gmail.com' \
--to=killy.draw@gmail.com \
--cc=bzg@altern.org \
--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).