Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-27 Thread Nicolas Goaziou
Hello,

Vladimir Panteleev  writes:

> On 2018-03-26 21:42, Nicolas Goaziou wrote:
>> I'm talking about call_foo() syntax. I see no fundamental difference
>> between (org-sbe-v2 "func" ...) and call_func(...).
>
> Sorry, how do you invoke call_func from lisp, or a table formula?

I'm not sure there is a real use-case for the first case. Remember you
can chain source blocks.

The second is the reason why I'm suggesting to move org-sbe-vs to
"org-table.el".

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-26 Thread Bastien
Hello,

Nicolas Goaziou  writes:

> Alan Schmitt  writes:
>
>> On 2018-03-25 23:06, Nicolas Goaziou  writes:
>>
>>> I have reverted your changes from maint.
>>
>> Should there be a new release? This change is present in 9.1.8.
>
> I /think/ I released Org 9.1.9, but I usually goof it up, so I'm Cc'ing
> Bastien.

Yes, something went wrong in the release process, I just released
9.1.9 manually.

All best,

-- 
 Bastien



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-26 Thread Vladimir Panteleev

On 2018-03-26 21:42, Nicolas Goaziou wrote:

I'm talking about call_foo() syntax. I see no fundamental difference
between (org-sbe-v2 "func" ...) and call_func(...).


Sorry, how do you invoke call_func from lisp, or a table formula?

--
Best regards,
 Vladimir



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-26 Thread Nicolas Goaziou
Vladimir Panteleev  writes:

> By inline Babel calls, do you mean as described in
> https://orgmode.org/manual/Evaluating-code-blocks.html ? I see there
> "org-babel-execute-src-block", but it seems to attempt to infer the
> src block to execute rather than letting the caller specify one.

I'm talking about call_foo() syntax. I see no fundamental difference
between (org-sbe-v2 "func" ...) and call_func(...).



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-26 Thread Nicolas Goaziou
Hello,

Alan Schmitt  writes:

> On 2018-03-25 23:06, Nicolas Goaziou  writes:
>
>> I have reverted your changes from maint.
>
> Should there be a new release? This change is present in 9.1.8.

I /think/ I released Org 9.1.9, but I usually goof it up, so I'm Cc'ing
Bastien.

Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-26 Thread Vladimir Panteleev

On 2018-03-26 20:16, Nicolas Goaziou wrote:

Hello,

Vladimir Panteleev  writes:

What about org-sbe is specific to tables?

I'm thinking that the generic replacement could be used elsewhere, e.g.:

(with-current-buffer some-org-mode-buffer
   (org-sbe-v2 "func" ...args...))


The generic replacement of table cells, right. Otherwise you have inline
Babel calls.


Sorry, I'm not following. By "generic replacement" I meant a replacement 
(new function that will replace the current org-sbe) that is generic 
(not restricted to being used in table formulas by design).


I think you seem to have interpreted to mean substitution of table cell 
references. This is actually not pertaining org-sbe or its replacement, 
because it is not done in org-sbe, but by code invoking it.


By inline Babel calls, do you mean as described in 
https://orgmode.org/manual/Evaluating-code-blocks.html ? I see there 
"org-babel-execute-src-block", but it seems to attempt to infer the src 
block to execute rather than letting the caller specify one.


So, as far as I can see, org-sbe's successor doesn't need to have 
anything specific to tables, or have I missed something?


--
Best regards,
 Vladimir



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-26 Thread Nicolas Goaziou
Hello,

Vladimir Panteleev  writes:

> Hi,
>
> On 2018-03-25 21:06, Nicolas Goaziou wrote:
>> I agree "org-sbe" should be rewritten. However, it is specific to tables
>> because it is meant to be used in a TBLFM line. Its replacement could
>> live in "org-table.el", though.
>
> What about org-sbe is specific to tables?
>
> I'm thinking that the generic replacement could be used elsewhere, e.g.:
>
> (with-current-buffer some-org-mode-buffer
>   (org-sbe-v2 "func" ...args...))

The generic replacement of table cells, right. Otherwise you have inline
Babel calls.

Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-26 Thread Alan Schmitt
On 2018-03-25 23:06, Nicolas Goaziou  writes:

> I have reverted your changes from maint.

Should there be a new release? This change is present in 9.1.8.

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2018-02: 408.35, 2017-02: 406.42


signature.asc
Description: PGP signature


Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-25 Thread Vladimir Panteleev

Hi,

On 2018-03-25 21:06, Nicolas Goaziou wrote:

I agree "org-sbe" should be rewritten. However, it is specific to tables
because it is meant to be used in a TBLFM line. Its replacement could
live in "org-table.el", though.


What about org-sbe is specific to tables?

I'm thinking that the generic replacement could be used elsewhere, e.g.:

(with-current-buffer some-org-mode-buffer
  (org-sbe-v2 "func" ...args...))

The main obstacle preventing using the current org-sbe in this manner is 
that it is a macro, and will eagerly evaluate some things that it shouldn't.


--
Best regards,
 Vladimir



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-25 Thread Nicolas Goaziou
Hello,

Vladimir Panteleev  writes:

> One ugly fix would be to patch over this by checking for some common
> lisp forms that result in a list, such as (list ...) and (quote ...),
> and treat the remaining ones in a backwards-compatible way. However,
> the more time I spend on org-sbe, the more I think that perhaps
> a better approach would be to deprecate org-sbe (or outright remove
> it, I could argue that due to the overwhelming number of flaws its
> mere presence is downright harmful), and replace it with something
> more sensible: a function (not macro) defined somewhere other than
> ob-table (because it is not specific to tables) without any of the
> crazy string escaping logic.
>
> What do you think?

I have reverted your changes from maint.

I agree "org-sbe" should be rewritten. However, it is specific to tables
because it is meant to be used in a TBLFM line. Its replacement could
live in "org-table.el", though.

Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-25 Thread Vladimir Panteleev

On 2018-03-25 20:26, Nicolas Goaziou wrote:

I think this has been applied to the maint branch, but I cannot find a
mention of it in the ORG-NEWS file. Maybe it should be mentioned there
as it is a breaking change. For instance,(I had to modify table formulas like


Sorry, I did not intend this to be a breaking change (for any reasonably 
valid use cases).


The problem is that because org-sbe is a macro, it attempts to parse the 
sexpr without evaluating it. The intention was to check what kind of 
lisp object the argument is, and preserve the old behavior if it's a 
string, but do something more sensible if it's a list. I.e. "foo" and 
(identity "foo") are currently treated differently in org-sbe arguments. 
However, it currently can't do that because the actual evaluation occurs 
elsewhere (the sexpr is stringified mostly-as-is into a babel header and 
then parsed as such).


One ugly fix would be to patch over this by checking for some common 
lisp forms that result in a list, such as (list ...) and (quote ...), 
and treat the remaining ones in a backwards-compatible way. However, the 
more time I spend on org-sbe, the more I think that perhaps a better 
approach would be to deprecate org-sbe (or outright remove it, I could 
argue that due to the overwhelming number of flaws its mere presence is 
downright harmful), and replace it with something more sensible: a 
function (not macro) defined somewhere other than ob-table (because it 
is not specific to tables) without any of the crazy string escaping logic.


What do you think?

--
Best regards,
 Vladimir



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-25 Thread Nicolas Goaziou
Hello,

Alan Schmitt  writes:

> I think this has been applied to the maint branch, but I cannot find a
> mention of it in the ORG-NEWS file. Maybe it should be mentioned there
> as it is a breaking change. For instance,(I had to modify table formulas like
>
> #+TBLFM: @2$3..@>>$3='(org-sbe call_ledger (bucket (concat "\"" $1 "\"")) 
> (prefix "\"Bucket:Expenses:\""))
>
> into
>
> #+TBLFM: @2$3..@>>$3='(org-sbe call_ledger (bucket $$1) (prefix
> "\"Bucket:Expenses:\""))

I'm going to revert these changes from maint, then. I though that was
innocuous.

Vladimir, would you mind writing a small entry in ORG-NEWS about the
induced changes in master?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-25 Thread Alan Schmitt
Hello,

On 2018-03-20 00:07, Nicolas Goaziou  writes:

> Hello,
>
> Vladimir Panteleev  writes:
>
>> OK, here is v2 with table-based tests.
>>
>> Vladimir Panteleev (3):
>>   ob-table: Fix org-sbe's handling of quotes in cell values
>>   ob-table: Fix org-sbe's handling of list arguments
>>   ob-table: Mention passing ranges as lists in org-sbe's documentation
>
> Applied. Thank you!

I think this has been applied to the maint branch, but I cannot find a
mention of it in the ORG-NEWS file. Maybe it should be mentioned there
as it is a breaking change. For instance,(I had to modify table formulas like

#+TBLFM: @2$3..@>>$3='(org-sbe call_ledger (bucket (concat "\"" $1 "\"")) 
(prefix "\"Bucket:Expenses:\""))

into

#+TBLFM: @2$3..@>>$3='(org-sbe call_ledger (bucket $$1) (prefix 
"\"Bucket:Expenses:\""))

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2018-02: 408.35, 2017-02: 406.42


signature.asc
Description: PGP signature


Re: [O] [PATCH v2 0/3] org-sbe fixes

2018-03-19 Thread Nicolas Goaziou
Hello,

Vladimir Panteleev  writes:

> OK, here is v2 with table-based tests.
>
> Vladimir Panteleev (3):
>   ob-table: Fix org-sbe's handling of quotes in cell values
>   ob-table: Fix org-sbe's handling of list arguments
>   ob-table: Mention passing ranges as lists in org-sbe's documentation

Applied. Thank you!

Regards,

-- 
Nicolas Goaziou



[O] [PATCH v2 0/3] org-sbe fixes

2018-03-18 Thread Vladimir Panteleev
OK, here is v2 with table-based tests.

Vladimir Panteleev (3):
  ob-table: Fix org-sbe's handling of quotes in cell values
  ob-table: Fix org-sbe's handling of list arguments
  ob-table: Mention passing ranges as lists in org-sbe's documentation

 lisp/ob-table.el  | 21 +---
 testing/lisp/test-ob-table.el | 45 +++
 2 files changed, 59 insertions(+), 7 deletions(-)

-- 
2.16.2