[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ob-C.el compile-only header argument, was Re: How to use mpi
From: |
Leo Butler |
Subject: |
Re: [PATCH] ob-C.el compile-only header argument, was Re: How to use mpirun with C or C++ Org-babel? |
Date: |
Thu, 4 Jan 2024 17:53:38 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Fri, Dec 22 2023, Ihor Radchenko <yantar92@posteo.net> wrote:
> Leo Butler <Leo.Butler@umanitoba.ca> writes:
>
>>> What will happen if we have something like :results value or :results
>>> output instead of :results file link?
>>
>> Originally, I felt that only ":results file" makes sense. I have adopted
>> your suggestion, though, and added test cases so that the compiler
>> stderr output is caught.
>
> Thanks! This makes sense, but now the default behaviour (when no :results
> type is specified) is unexpected.
>
> When you have something like
>
> #+begin_src C :compile-only t :file foo :includes "stdio.h"
> printf("This is test");
> #+end_src
It should be "yes" not "t".
>
>
> , executing should yield file link, even though it is not explicitly
> specified.
Ok. But, isn't it a responsibility of org-babel to ensure that if :file
is set and :results is not, then the parameter list that is passed to
org-babel-*-execute includes a correctly set :result-params field
(i.e. it includes "file")? I mean, the docs say [1]:
‘file’
Interpret as a filename. Save the results of execution of the code
block to that file, then insert a link to it.
I would prefer not to fiddle in ob-*.el to implement a policy that
should be implemented at a higher level.
[1] (info "(org) Results of Evaluation"):
>
> And when you have compilation error,
>
> #+begin_src C :compile-only t :file foo :includes "stdio.h"
> printf("This is test")
> #+end_src
>
>
> the result may be empty - buffer displayed by `org-babel-eval' is
> probably enough.
Can you tell me what behaviour you expect? No #+RESULTS: ?
>
> Basically, Org babel promises DWIM behavior when :results type is not
> explicitly stated.
I am happy to modify the patch to make ob-C.el conform to the stated (or
implied) Org policies. But, "dwim" hurts my head.
>
> P.S. In my testing, I wrote
>
> #+begin_src C :compile-only t :file foo :includes "stdio.h"
> (printf "This is test")
> #+end_src
>
> and was staring at the compilation error for a good minute, trying to
> understand what the hell did I do wrongly 🤦.
Ahhh! Lisp syntax is so much nicer to read.
Happy New Year,
Leo
- Re: [PATCH] ob-C.el compile-only header argument, was Re: How to use mpirun with C or C++ Org-babel?,
Leo Butler <=