Re: Bug or not a bug? dot expansion in ob-shell

2020-09-07 Thread Bastien
Bastien writes: > At first, I thought "If ':results value' is always the same as the > default, why have ':results value' at all?" and thought it'd be an > argument for having different defaults for different languages but > I see how I was wrong: expectations for defaults should be stable, >

Re: Bug or not a bug? dot expansion in ob-shell

2020-09-06 Thread Bastien
Hi Jack, Jack Kamm writes: > I think it's a bad idea that ":results value", and not specifying > ":results", give different behavior. Indeed. At first, I thought "If ':results value' is always the same as the default, why have ':results value' at all?" and thought it'd be an argument for

Re: Bug or not a bug? dot expansion in ob-shell

2020-09-06 Thread Bastien
Hi Tim, sorry for the late reply, and thanks a lot for the clear summary. Tim Cross writes: > It seems to me that two separate issues have been mixed up and causing > some confusion here. However, I think it is actually quite simple once > we consider the issues separately. > > Issue 1:

Re: Bug or not a bug? dot expansion in ob-shell

2020-03-04 Thread Nick Dokos
Hi Tim, Tim Cross writes: > It seems to me that two separate issues have been mixed up and causing > some confusion here. However, I think it is actually quite simple once > we consider the issues separately. > > Issue 1: Defining the meaning of :result value and :result output > Issue 2:

Re: Bug or not a bug? dot expansion in ob-shell

2020-03-01 Thread Jack Kamm
As someone who doesn't really use ob-shell, I've made too much noise in this thread, and am intending this to be my last comment here... I think it's a bad idea that ":results value", and not specifying ":results", give different behavior. In my own Org-babel files, I usually have a header line

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-29 Thread Jack Kamm
Hi Tom, Tom Gillespie writes: > As with many things in emacs, I sometimes feel like I'm loosing my > mind, or loosing track of just exactly what variables are set You're not losing your mind. After some further testing I find that you're right, and my understanding of the situation was

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-29 Thread Tom Gillespie
Hi Jack, As with many things in emacs, I sometimes feel like I'm loosing my mind, or loosing track of just exactly what variables are set or not set, but I could swear that for at least the past year when running #+begin_src bash blocks with C-c C-c and no :results header set the results are

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-29 Thread Jack Kamm
Hi Tom, Tom Gillespie writes: > First a disclosure, I would be very unhappy if option 1 were selected, > it would require me to make a whole bunch of changes and try to find > an option to revert to the current default behavior. Wasn't option 1 already the default behavior, until the changes

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-29 Thread Tim Cross
It seems to me that two separate issues have been mixed up and causing some confusion here. However, I think it is actually quite simple once we consider the issues separately. Issue 1: Defining the meaning of :result value and :result output Issue 2: Specifying what the default :result setting

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-29 Thread Tom Gillespie
Hi all, Sorry to be late to this thread (and for a wall of text), but as a heavy user of ob-shell I wanted to chime in. First a disclosure, I would be very unhappy if option 1 were selected, it would require me to make a whole bunch of changes and try to find an option to revert to the current

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-29 Thread Jack Kamm
Sorry, I was confused about this: > According to my reading of this thread, most of the commenters were in > agreement that we should keep the original behavior and return the exit > code, as we do in 9.3. Actually, it looks like ":results value" does return the exit code. I just got confused

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-29 Thread Jack Kamm
Hi Bastien, Bastien writes: > thanks for your thoughtful inputs. I've now removed the option. I think it's good you removed the option. However, it looks like the behavior now is to return the output, instead of the exit code, when ":results value". According to my reading of this thread,

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-27 Thread Kaushal Modi
Hello all, On Wed, Feb 19, 2020 at 7:11 AM Bastien wrote: > Hi Eric, > > note that the previous behavior only _seemed_ right by chance: there > is no notion of getting the exit code of the shell command in > ob-shell.el, and returning "0" is just a hazard here, just because >

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Bastien
Hi Jack, Jack Kamm writes: > Stefan Nobis writes: > >> What about a third collection option 'none' and make this the default? > > A variant on this idea, would be to instead have the third collection > option be 'default', which would stand for a language-specific > default. For example,

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Jack Kamm
Hi Stefan, Stefan Nobis writes: > What about a third collection option 'none' and make this the default? A variant on this idea, would be to instead have the third collection option be 'default', which would stand for a language-specific default. For example, ":results default" could be

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Fraga, Eric
On Friday, 21 Feb 2020 at 09:04, Bastien wrote: [...] > That said, we have three solutions: > > 1. Stick to a strict reading of Org and bash manuals: the absence of a >:results header means "return the value, i.e. the exit status". [...] > Obviously, nobody wants the first solution.

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Bastien
Hi Stefan, Stefan Nobis writes: > The downside would be that many existing Org documents needs to be > fixed (but maybe it would be not too hard to automate the adjustments) > and some source blocks may become a little more verbose. Yes, backward-compatibilities issues, verbosity, and a

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Stefan Nobis
Bastien writes: > I agree we should have a discussion on whether :results value is a > good default. What about a third collection option 'none' and make this the default? This would emphasize that there is no sensible default for all babel languages, users and use cases. Users would be forced

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-22 Thread Bastien
Hi Nick and Jack, thanks for your thoughtful inputs. I've now removed the option. I agree we should have a discussion on whether :results value is a good default. But I think this needs previous work on documenting what is the actual behavior of the main Babel libraries wrt "value" vs

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-21 Thread Jack Kamm
Hi, Nick Dokos writes: >> That said, we have three solutions: >> >> 1. Stick to a strict reading of Org and bash manuals: the absence of a >>:results header means "return the value, i.e. the exit status". >> >> 2. Deviate from this strict reading, introduce an exception for *all* >>

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-21 Thread Nick Dokos
Hi Bastien, I think all this is reasonable. I have some inline comments and a suggestion at the end. Bastien writes: > Hi Nick, > > I didn't conduct the survey in 2013, you can find the results here: > https://orgmode.org/worg/org-configs/org-customization-survey.html > > I understand why you

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-21 Thread Bastien
Hi Nick, I didn't conduct the survey in 2013, you can find the results here: https://orgmode.org/worg/org-configs/org-customization-survey.html I understand why you (and Tim and Derek) think an option is too much. But let's separate two problems: one is that Org have many options, some perhaps

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-20 Thread Derek Feichtinger
+1 - I also think that this is the correct behavior, and that the average user's expectations can be best fulfilled by making ":results output" the default. Adding the option will make it more difficult to share code blocks and documents. Best regards, Derek On Thu, Feb 20 2020, Tim Cross

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-20 Thread Tim Cross
+1 - this is basically my feeling as well. I've spent the last couple of days thinking about the additional option suggestion, but something just didn't feel right to me. I think Nick has hit the nail on the head. Adding the additional option seems to be making things more confusing. The basic

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-20 Thread Nick Dokos
Hi Bastien, Bastien writes: > Hi Diego, > > Diego Zamboni writes: > >> I'm late to the discussion so I apologize in advance, but this fix >> seems counterintuitive to me. In my mind, for any shell code: >> >> - Return value: exit code of the last command >> - Output: whatever the commands

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Hi Diego, Diego Zamboni writes: > I'm late to the discussion so I apologize in advance, but this fix > seems counterintuitive to me. In my mind, for any shell code: > > - Return value: exit code of the last command > - Output: whatever the commands print Yes, that's what is *now* possible if

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Samuel Wales
to stir the pot: speaking for myself, i only wanted the output, and never the error mechanism, and my attempts to get output reliably ended up in my habitually putting in every shell block this boilerplate: === { the code i actually want } 2>&1 : === -- The Kafka Pandemic What is misopathy?

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Diego Zamboni
I'm late to the discussion so I apologize in advance, but this fix seems counterintuitive to me. In my mind, for any shell code: - Return value: exit code of the last command - Output: whatever the commands print So to me, it's intuitive that =:exports value= would return the exit code of the

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
I've implemented the suggestion I made in master: New option ~ob-shell-return-value-is-exit-status~ When set to =t=, consider the return value of a shell source code block is the exit status of its last command. The default for this option is =nil=, i.e. the return value of a

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Fraga, Eric
On Wednesday, 19 Feb 2020 at 14:43, Bastien wrote: > Note that currently (9.3) we have this: [...] > ... so the default today is not even to consider "the last command", > but the output of all commands. Maybe, if you wish to get version 9.4 out, the best approach would be to fix that one

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Hi Eric, "Fraga, Eric" writes: > On Wednesday, 19 Feb 2020 at 14:00, Bastien wrote: >> Anyway, I don't have yet a clue on how to add this new option. I'll >> leave it to Eric first (if he has time) then look at it later this >> week. > > Time is an issue (middle of teaching term). More

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Fraga, Eric
On Wednesday, 19 Feb 2020 at 14:00, Bastien wrote: > Anyway, I don't have yet a clue on how to add this new option. I'll > leave it to Eric first (if he has time) then look at it later this > week. Time is an issue (middle of teaching term). More importantly, my elisp-fu is not necessarily up

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Hi Tim, Tim Cross writes: > I'm not sure - need to think about it some more and go back through the > manual. My initial feeling is that the example block you show should > only return "Hello!" when you request output as the reuslts and > otherwise return the return value of echo (which is the

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Tim Cross
Hi Bastien, I'm not sure - need to think about it some more and go back through the manual. My initial feeling is that the example block you show should only return "Hello!" when you request output as the reuslts and otherwise return the return value of echo (which is the exit code in this case).

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Hi Tim, thanks for your proposal. I think we agree here. My suggestion is to have a new option ob-shell-value-is-exit-status. When set to nil (the default), the "return value" of a shell source block would be the output of the last command. This is the current behavior where we have e.g.

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Tim Cross
I think I agree with Eric here. However, perhaps I don't fully understand all the details. Many shell commans, especially those which mainly perform 'side effects' like echo, return the exit code. This value is often used in shell scripts as a type of short hand/short circuit i.e. combined with

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Bastien writes: > Then we need to fix ob-shell.el to return the exit code of the last > command when :results is not set or explicitely set to "value". Is > this something you want to look at? > > Maybe by adding a "echo $?" instruction at the end of shell blocks > or by wrapping the code into

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Hi Eric, note that the previous behavior only _seemed_ right by chance: there is no notion of getting the exit code of the shell command in ob-shell.el, and returning "0" is just a hazard here, just because (org-babel--string-to-number ".") returns "0", while it should return nil. "Fraga, Eric"

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Vladimir Nikishkin
That's an excellent response, Eric! Now what about this block: #+begin_src shell printf "%s" ' (computer . ?type) exit' #+end_src ср, 19 февр. 2020 г. в 19:56, Fraga, Eric : > On Wednesday, 19 Feb 2020 at 12:38, Bastien wrote: > > "0" is the _exit code_ of the successful echo command,

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Fraga, Eric
On Wednesday, 19 Feb 2020 at 12:38, Bastien wrote: > "0" is the _exit code_ of the successful echo command, not the value > returned by the echo command. But echo does not "return" the string as a value. It outputs the string. To quote the man page for bash, "the return value of a simple

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Hi Eric, "Fraga, Eric" writes: > On Wednesday, 19 Feb 2020 at 10:41, Bastien wrote: >> It returned "0" for me, while I guess "." is expected. > > I expected 0 as that is the "value" (i.e. the status in a shell) of > the last command. Quoting the manual: ‘value’ Default. Functional mode.

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Fraga, Eric
On Wednesday, 19 Feb 2020 at 10:41, Bastien wrote: > It returned "0" for me, while I guess "." is expected. I expected 0 as that is the "value" (i.e. the status in a shell) of the last command. If you want ".", I would expect one to use :results output in the src block header? -- : Eric S

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Bastien writes: > PS: Ouch, I broke a few tests. I'm looking at this right now. Those have been fix, together with org-babel--string-to-number, which should not allow "1 2" to be interpreted as a number. Eric, if my reading of the expected output does not match yours please let me know. --

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Bastien writes: > Let me know if it does the right thing for you. PS: Ouch, I broke a few tests. I'm looking at this right now. -- Bastien

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Bastien
Hi Eric and Vladimir, "Fraga, Eric" writes: > On Wednesday, 19 Feb 2020 at 17:02, Vladimir Nikishkin wrote: >> Could you check if the following block behaves as expected? > > It does for me. What did you expect and what did you get? It returned "0" for me, while I guess "." is expected. The

Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Fraga, Eric
On Wednesday, 19 Feb 2020 at 17:02, Vladimir Nikishkin wrote: > Could you check if the following block behaves as expected? It does for me. What did you expect and what did you get? -- : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-316-g5dd772