all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#35847: org-babel clojure bug? nil prepended to all results?
@ 2019-05-21 13:18 Brian Beckman
  2020-05-22 12:14 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Beckman @ 2019-05-21 13:18 UTC (permalink / raw)
  To: 35847, bc.beckman

[-- Attachment #1: Type: text/plain, Size: 3253 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 4290 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#35847: org-babel clojure bug? nil prepended to all results?
  2019-05-21 13:18 bug#35847: org-babel clojure bug? nil prepended to all results? Brian Beckman
@ 2020-05-22 12:14 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2020-05-22 12:14 UTC (permalink / raw)
  To: Brian Beckman; +Cc: 35847-done

Hi Brian,

Brian Beckman <bc.beckman@gmail.com> writes:

> 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

ob-clojure.el has been going through a major rewrite since last year,
and I cannot reproduce this issue.  I am closing this report now.  If
you still see the issue, please report it to emacs-orgmode@gnu.org.

Thanks,

-- 
 Bastien




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-22 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-21 13:18 bug#35847: org-babel clojure bug? nil prepended to all results? Brian Beckman
2020-05-22 12:14 ` Bastien

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.