GNU bug report logs - #35847
org-babel clojure bug? nil prepended to all results?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: org-mode; Reported by: Brian Beckman <bc.beckman@HIDDEN>; dated Tue, 21 May 2019 14:30:02 UTC; Maintainer for org-mode is emacs-orgmode@HIDDEN.
bug reassigned from package 'emacs' to 'org-mode'. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 May 2019 14:29:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 21 10:29:43 2019
Received: from localhost ([127.0.0.1]:40481 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hT5lu-0005Lc-TA
	for submit <at> debbugs.gnu.org; Tue, 21 May 2019 10:29:43 -0400
Received: from eggs.gnu.org ([209.51.188.92]:41348)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bc.beckman@HIDDEN>) id 1hT4fL-00034f-CL
 for submit <at> debbugs.gnu.org; Tue, 21 May 2019 09:18:51 -0400
Received: from lists.gnu.org ([209.51.188.17]:44383)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <bc.beckman@HIDDEN>)
 id 1hT4fG-0003qT-9L
 for submit <at> debbugs.gnu.org; Tue, 21 May 2019 09:18:46 -0400
Received: from eggs.gnu.org ([209.51.188.92]:55729)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bc.beckman@HIDDEN>) id 1hT4fE-000239-F3
 for bug-gnu-emacs@HIDDEN; Tue, 21 May 2019 09:18:46 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 HTML_MESSAGE autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bc.beckman@HIDDEN>) id 1hT4fD-0003l5-2x
 for bug-gnu-emacs@HIDDEN; Tue, 21 May 2019 09:18:44 -0400
Received: from mail-ua1-x934.google.com ([2607:f8b0:4864:20::934]:35174)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <bc.beckman@HIDDEN>)
 id 1hT4fC-0003iv-Q6
 for bug-gnu-emacs@HIDDEN; Tue, 21 May 2019 09:18:43 -0400
Received: by mail-ua1-x934.google.com with SMTP id r7so6604205ual.2
 for <bug-gnu-emacs@HIDDEN>; Tue, 21 May 2019 06:18:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=twdFPReOgK6AtQt0rk/BUEjVo0A7xeK0D9JO3WFrA/0=;
 b=SrG0ZQrCAKgznhkxApdKnWT/7th+gSNJGpuzWUhpzgFrWrz8FDLQx3mnD506bIRB/J
 wpr5F/AMW73kUha4vdNbkQ1UFmDSBc9p/YyK40ZMAeDexfdQzLxMZ2BZvNujqKg5H5Id
 XuFosfqcQYz8sXHOGNIJCfbej7FcXr7QzQ/Rs7u7AAC86VvrI3v5TYFFJV63dQqp+Fae
 oX7EVOuVnnIzloM6KAAZ7niee8SY4Mw63CIJp1GLt+j8w0yFJbbICpxPKhcP93hTgZyd
 trHObQnI/uAxoYhVH9wT6q8HM2aJCWXNtos0+PIrcwPDUvDYCkdoRkNZFbkFiiA6aaYP
 bILg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=twdFPReOgK6AtQt0rk/BUEjVo0A7xeK0D9JO3WFrA/0=;
 b=Irs9kaUkv4lZ8y45Fa8wzo1zUfFn0XefgRd/sHEaR0NO6ze7E1PqSbyLvz2KxVoOD/
 493QamDiQzfuKRBfGW0vO7gIuW0sfP/+J4hlW3F47bjvexWoGho23Uwi5KNsN4yAkRdV
 WHMo6L8xuL4AX1N6bQoyQeUYhj8RdQSRXd0lAXnGkGceC81rANMUwg9XO7dKe/hVcc3S
 +jvkcUQX+/NLvblJ74UJcmO1XN0VexyV0wi6sn0uR+2pNpsWzNqgVBjWNS7a2es2hUD9
 8lhhKEWNDvpVeliKOey4jKUUYGTCImbuiHwPRteXGyAsgMnDlmIBHC12j9mBnhtz0FVX
 CqcA==
X-Gm-Message-State: APjAAAUb7PTStGA2yYkszssCQiH20nowz994I2+CmsmSBxchGrBXxT8J
 fUZ+6emLwD4Fo0XSPlVRwciAe2h2+p0nm3HNeTe3nNZKcz0=
X-Google-Smtp-Source: APXvYqwL9CPuIB6gKRbV4Ob8nQ9RoLB2jrgyZdh5FXuXgLYorSAuXML+5YCysndR6pz1G5ssy3ABYJvf+URN5oxvda4=
X-Received: by 2002:a9f:3731:: with SMTP id z46mr10290424uad.16.1558444721128; 
 Tue, 21 May 2019 06:18:41 -0700 (PDT)
MIME-Version: 1.0
From: Brian Beckman <bc.beckman@HIDDEN>
Date: Tue, 21 May 2019 06:18:28 -0700
Message-ID: <CAK2VK6tMXL07D0qVg6v_nvrO5X9vmQ9xOGgge8gRO6VB=KHXsQ@HIDDEN>
Subject: org-babel clojure bug? nil prepended to all results?
To: bug-gnu-emacs@HIDDEN, Brian Beckman <bc.beckman@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000014981058965b062"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::934
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 21 May 2019 10:29:41 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--000000000000014981058965b062
Content-Type: text/plain; charset="UTF-8"

I originally submitted this to the nrepl / cider group in github because my
workaround entailed a (most likely bogus) change to nrepl, but they closed
it and told me to submit it here. My original submission is copied below.
The response of the nrepl maintainer can be found at
https://github.com/nrepl/nrepl/issues/146

## Expected behavior

in org-babel, I expect the following
```
#+begin_src clojure
(* 6 (+ 6 2))
#+end_src

#+RESULTS:
: 48
```
## Actual behavior
```
#+begin_src clojure
(* 6 (+ 6 2))
#+end_src

#+RESULTS:
: nil48

```
## Steps to reproduce the problem

Make sure your emacs init.el (or other startup fixture like .spacemacs) has
org-babel support for Cider and Clojure, as with the following

```
  (require 'ob-clojure)
  (org-babel-do-load-languages
   'org-babel-load-languages
   '(
     (C           . t)
     (awk         . t)
     (clojure     . t) ))
```
Make a lein new app foo so that you have a project.clj file.
Create any old .org file in the foo project directory.
Put the code snippet above in the .org file.
Do M-x cider-jack-in with the cursor in that code block.
Do C-c C-c with cursor in the code block to evaluate the code block.
See the prepended "nil?" It's the same with every other code block. Every
result gets a prepended "nil."

## my workaround

I changed `elpa/cider-20190321.2129/nrepl-dict.el::nrepl--merge` as follows
to get my stuff to work. No idea whether this is a robust or worthwhile
change.

```
(defun nrepl--merge (dict1 dict2 &optional no-join)
  "Join nREPL dicts DICT1 and DICT2 in a meaningful way.
String values for non \"id\" and \"session\" keys are concatenated. Lists
are appended. nREPL dicts merged recursively. All other objects are
accumulated into a list. DICT1 is modified destructively and
then returned.
If NO-JOIN is given, return the first non nil dict."
  (if no-join
      (or dict1 dict2)
    (cond ((null dict1) dict2)
          ((null dict2) dict1)
          ((stringp dict1) (concat dict1 dict2))
          ((nrepl-dict-p dict1)
           (nrepl-dict-map
            (lambda (k2 v2)
              (nrepl-dict-put dict1 k2
                              (nrepl--merge (nrepl-dict-get dict1 k2)
                                            ;; bbeckman bug?  CHANGED RIGHT
HERE *****
                                            (if (and (string= k2 "value")
                                                     (stringp v2)
                                                     (string= v2 "nil"))
                                                "" v2)
                                            (member k2 '("id" "session")))))
            dict2)
           dict1)
          ((and (listp dict2) (listp dict1)) (append dict1 dict2))
          ((listp dict1) (append dict1 (list dict2)))
          (t `(,dict1 ,dict2)))))

```

## Environment & Version information

```
: Emacs version: GNU Emacs 26.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.4)
:  of 2019-04-12
: org version: 9.2.2

```
### Clojure version
1.10.0

### Java version

openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.10.1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.10.1, mixed
mode, sharing)

### Operating system

Ubuntu 18.04

--000000000000014981058965b062
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e,monospace">I originally submitted this to the nrepl / cider group in gith=
ub because my workaround entailed a (most likely bogus) change to nrepl, bu=
t they closed it and told me to submit it here. My original submission is c=
opied below. The response of the nrepl maintainer can be found at=C2=A0<a h=
ref=3D"https://github.com/nrepl/nrepl/issues/146" style=3D"font-family:Aria=
l,Helvetica,sans-serif">https://github.com/nrepl/nrepl/issues/146</a></div>=
<div class=3D"gmail_default" style=3D"font-family:monospace,monospace"><br>=
</div><div class=3D"gmail_default" style=3D"font-family:monospace,monospace=
">## Expected behavior<br><br>in org-babel, I expect the following<br>```<b=
r>#+begin_src clojure<br>(* 6 (+ 6 2))<br>#+end_src<br><br>#+RESULTS:<br>: =
48<br>```<br>## Actual behavior<br>```<br>#+begin_src clojure<br>(* 6 (+ 6 =
2))<br>#+end_src<br><br>#+RESULTS:<br>: nil48<br><br>```<br>## Steps to rep=
roduce the problem<br><br>Make sure your emacs init.el (or other startup fi=
xture like .spacemacs) has org-babel support for Cider and Clojure, as with=
 the following<br><br>```<br>=C2=A0 (require &#39;ob-clojure)<br>=C2=A0 (or=
g-babel-do-load-languages<br>=C2=A0 =C2=A0&#39;org-babel-load-languages<br>=
=C2=A0 =C2=A0&#39;(<br>=C2=A0 =C2=A0 =C2=A0(C =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 . t)<br>=C2=A0 =C2=A0 =C2=A0(awk =C2=A0 =C2=A0 =C2=A0 =C2=A0 . t)<br=
>=C2=A0 =C2=A0 =C2=A0(clojure =C2=A0 =C2=A0 . t) ))<br>```<br>Make a lein n=
ew app foo so that you have a project.clj file. <br>Create any old .org fil=
e in the foo project directory. <br>Put the code snippet above in the .org =
file. <br>Do M-x cider-jack-in with the cursor in that code block.<br>Do C-=
c C-c with cursor in the code block to evaluate the code block.<br>See the =
prepended &quot;nil?&quot; It&#39;s the same with every other code block. E=
very result gets a prepended &quot;nil.&quot;<br><br>## my workaround<br><b=
r>I changed `elpa/cider-20190321.2129/nrepl-dict.el::nrepl--merge` as follo=
ws to get my stuff to work. No idea whether this is a robust or worthwhile =
change.<br><br>```<br>(defun nrepl--merge (dict1 dict2 &amp;optional no-joi=
n)<br>=C2=A0 &quot;Join nREPL dicts DICT1 and DICT2 in a meaningful way.<br=
>String values for non \&quot;id\&quot; and \&quot;session\&quot; keys are =
concatenated. Lists<br>are appended. nREPL dicts merged recursively. All ot=
her objects are<br>accumulated into a list. DICT1 is modified destructively=
 and<br>then returned.<br>If NO-JOIN is given, return the first non nil dic=
t.&quot;<br>=C2=A0 (if no-join<br>=C2=A0 =C2=A0 =C2=A0 (or dict1 dict2)<br>=
=C2=A0 =C2=A0 (cond ((null dict1) dict2)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 ((null dict2) dict1)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((stringp di=
ct1) (concat dict1 dict2))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((nrepl-di=
ct-p dict1)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(nrepl-dict-map<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda (k2 v2)<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (nrepl-dict-put dict1 k2<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 (nrepl--merge (nrepl-dict-get dict1 k2)<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; bb=
eckman bug?=C2=A0 CHANGED RIGHT HERE *****<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (and (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A0 ((listp dict1) (append dict=
1 (list dict2)))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (t `(,dict1 ,dict2))=
)))<br><br>```<br><br>## Environment &amp; Version information<br><br>```<b=
r>: Emacs version: GNU Emacs 26.2 (build 2, x86_64-pc-linux-gnu, GTK+ Versi=
on 3.24.4)<br>: =C2=A0of 2019-04-12<br>: org version: 9.2.2<br><br>```<br>#=
## Clojure version<br>1.10.0<br><br>### Java version<br><br>openjdk version=
 &quot;11.0.3&quot; 2019-04-16<br>OpenJDK Runtime Environment (build 11.0.3=
+7-Ubuntu-1ubuntu218.10.1)<br>OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubun=
tu-1ubuntu218.10.1, mixed mode, sharing)<br>=C2=A0<br>### Operating system<=
br><br>Ubuntu 18.04<br></div></div>

--000000000000014981058965b062--




Acknowledgement sent to Brian Beckman <bc.beckman@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#35847; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 21 May 2019 15:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.