Re: [O] ob-python newline & indentation behavior

2017-12-18 Thread Kyle Meyer
Kyle Meyer writes: > Jack Kamm writes: > >> FSF sent me the signed papers :) I've attached them. > > great :) I've added your name here: http://orgmode.org/worg/org-contribute.html#contributors_with_fsf_papers >> Could Kyle or someone else merge in the patch, which I am reattaching? > > I'll t

Re: [O] ob-python newline & indentation behavior

2017-12-18 Thread Kyle Meyer
Jack Kamm writes: > FSF sent me the signed papers :) I've attached them. great :) > Could Kyle or someone else merge in the patch, which I am reattaching? I'll take a final look tonight (est).

Re: [O] ob-python newline & indentation behavior

2017-12-18 Thread John Kamm
Kyle Meyer writes: > Hmm, according to the site below, a response should come within 5 > business days. That fits with my personal experience, but I'm not sure > what's typical. Also, the delay might be Thanksgiving-related. FSF sent me the papers which I signed and returned about a week ago,

Re: [O] ob-python newline & indentation behavior

2017-11-26 Thread Kyle Meyer
Jack Kamm writes: > I haven't heard back from the FSF yet, any idea how long it takes to hear > from them? Hmm, according to the site below, a response should come within 5 business days. That fits with my personal experience, but I'm not sure what's typical. Also, the delay might be Thanksgiv

Re: [O] ob-python newline & indentation behavior

2017-11-26 Thread Jack Kamm
ob-ipython has a bug which renders it basically unusable to me -- it crashes when trying to interrupt the kernel with C-c C-c, which is something I often find myself needing to do (see https://github.com/gregsexton/ob-ipython/issues/115). However I agree that ob-ipython is very promising and could

Re: [O] ob-python newline & indentation behavior

2017-11-26 Thread Jack Kamm
Hello, Attached please find my revised patch based on Kyle's feedback. I simplified the behavior to send the whole block to the tmpfile (including the lastline), but restricted this change to ":results output" only (":results value" retains its old, broken behavior). I also added a test and fixed

Re: [O] ob-python newline & indentation behavior

2017-11-25 Thread Ista Zahn
ob-ipython[1] provides a working alternative: #+BEGIN_SRC jupyter-python :session :results output foo = 0 for _ in range(10): foo += 1 foo += 1 print(foo) #+END_SRC #+RESULTS: : 20 I've long wished that more org people would show ob-ipython some love. Letting jupyter handle t

Re: [O] ob-python newline & indentation behavior

2017-11-21 Thread Jack Kamm
Yes, I'm starting to see now how difficult it is to properly support ":session :results value". I would vote to remove it from ob-python... I think the patch still improves ":session :results output" so I will simplify it and restrict to that case, leaving ":session :results value" unchanged for n

Re: [O] ob-python newline & indentation behavior

2017-11-20 Thread Kyle Meyer
Jack Kamm writes: > In response to this: > >> I can't think of a good solution, though. Stepping back a bit, I think >> it's unfortunate that python blocks handle ":results value" differently >> depending on whether the block is hooked up to a session or not. For >> non-sessions, you have to us

Re: [O] ob-python newline & indentation behavior

2017-11-20 Thread Jack Kamm
Hi Kyle, In response to this: I can't think of a good solution, though. Stepping back a bit, I think > it's unfortunate that python blocks handle ":results value" differently > depending on whether the block is hooked up to a session or not. For > non-sessions, you have to use return. Using th

Re: [O] ob-python newline & indentation behavior

2017-11-19 Thread Kyle Meyer
Jack Kamm writes: > Here is the new version of the patch: I haven't had any luck applying this patch to master. Perhaps your email client is altering the inline patch; you can instead attach the output file of 'git format-patch'. > From f009da37d3b7e2730abb8cbb10f4d07b3d456dd8 Mon Sep 17 00:00

Re: [O] ob-python newline & indentation behavior

2017-11-19 Thread Kyle Meyer
Jack Kamm writes: > I adapted your old patch to the current master branch. I also extended it > to work for ":results value" (the original patch only worked for ":results > output"). I did this by not writing the last line of the code block to the > tmpfile, unless it is indented. > > I've never

Re: [O] ob-python newline & indentation behavior

2017-11-18 Thread Jack Kamm
Sorry, I should have mentioned my version info anyways. I have tested on emacs 25.3.1 and emacs 26.0.90, and org-mode versions 9.1.2 and 9.1.3 (current master). The same error occurs on all emacs and org-mode versions. However the error slightly differs between Python and IPython interpreters. IPy

Re: [O] ob-python newline & indentation behavior

2017-11-18 Thread Martin Alsinet
Sorry Jack, I overlooked the :session bit. Disregard my email please On Sat, Nov 18, 2017 at 10:27 PM Martin Alsinet wrote: > Hello Jack: > > What versions of emacs and org-mode are you using? > > I tried your example on Emacs 25.3.1 and org-mode 9.1.2-22 and I got "20" > as result > It has hap

Re: [O] ob-python newline & indentation behavior

2017-11-18 Thread Martin Alsinet
Hello Jack: What versions of emacs and org-mode are you using? I tried your example on Emacs 25.3.1 and org-mode 9.1.2-22 and I got "20" as result It has happened to me in the past that some bug I was seeing goes away just by updating org-mode. Regards, Martin On Sat, Nov 18, 2017 at 5:16 PM

Re: [O] ob-python newline & indentation behavior

2017-11-18 Thread Jack Kamm
Thanks Kyle, and sorry for missing that recent related thread. I adapted your old patch to the current master branch. I also extended it to work for ":results value" (the original patch only worked for ":results output"). I did this by not writing the last line of the code block to the tmpfile, un

Re: [O] ob-python newline & indentation behavior

2017-11-18 Thread Kyle Meyer
Hello, Jack Kamm writes: > ob-python newline & indentation behavior in :session is very ugly and > possibly broken. For example, consider the following code block: [...] > There is a 2 year old patch that fixes this behavior but has not yet > been incorporated: > https://lists.gnu.org/archiv

[O] ob-python newline & indentation behavior

2017-11-18 Thread Jack Kamm
ob-python newline & indentation behavior in :session is very ugly and possibly broken. For example, consider the following code block: #+BEGIN_SRC python :session :results output foo = 0 for _ in range(10): foo += 1 foo += 1 print(foo) #+END_SRC Ideally this would print "20"