emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ob-maxima.el, etc. (was Re: [MAINTENANCE] On how much we can


From: Ihor Radchenko
Subject: Re: [PATCH] ob-maxima.el, etc. (was Re: [MAINTENANCE] On how much we can expose internals into defcustom)
Date: Sat, 16 Sep 2023 09:04:24 +0000

Leo Butler <Leo.Butler@umanitoba.ca> writes:

>> Also, non-standard arguments should be defined in 
>> `org-babel-header-args:maxima'.
>>
>
> Ok. I see that some packages (e.g. ob-gnuplot.el) use a `defvar' form,
> while others (e.g. ob-R.el) use a `defconst' form. Is there a preference?

defconst I think. The value is not supposed to be changed.

>>> I have also moved two defaults, that were embedded in the code, to
>>> `defvar' forms.
>>
>> This is fine, although I would prefer to keep these variables private for
>> now.
>
> My understanding is that a special variable defined via `defvar' is one
> that is intended to be "private", i.e. users should not change it unless
> they really know what they are doing. Is that accurate?

Users are indeed not supposed to change defvar unless they know what
they are doing. But it is not considered private - there is a guarantee
that the meaning or type of the variable is not going to change.

> Do you mean the names should be something like
>
> org-babel-maxima--command-arguments
>
> ?

Yes. Having "--" means - if you use this variable, do it at your own
risk; we can re-purpose it or change or rename or do whatever at any
time.

>>> -                              (format "batchload(%S)$" in-file))
>>> +                              (format "(linenum:0, %s(%S))$" batch/load 
>>> in-file))
>>
>> May you clarify the purpose of "linenum"?
>
> Maxima keeps track of input/output line numbers via the variable
> `linenum'. I set the linenum to 0 so that the line numbering of the
> input in `in-file' starts at 1 not 2.
>
> This idiom has been used in other Maxima front-ends, such as
> `imaxima.el', too (although imaxima now uses the lisp reader, instead).
>
> See 
> https://sourceforge.net/p/maxima/code/ci/76105d9ee231679eccac888a04c98e6ef66df087/

Do I understand correctly that the above will simply affect debug output
when maxima references where a problematic line is located in the source?

>>>                                (unless (or (string-match "batch" line)
>>>                                            (string-match "^rat: replaced 
>>> .*$" line)
>>>                                            (string-match "^;;; Loading #P" 
>>> line)
>>> +                                          (string-match "^read and 
>>> interpret" line)
>>> +                                          (string-match 
>>> "^(%\\([io]-?[0-9]+\\))[ ]+$" line)
>>
>> May you explain why you added these two conditions?
>
> When `batch' starts, it emits the line starting with 'read and
> interpret' and including the name of the file being read. This is
> extraneous output, and should be filtered out.
>
> The second addition filters out empty input/output lines. Without that
> filter, the block
>
> #+name: ob-maxima/batch+verbatim+quiet
> #+begin_src maxima :exports both :results verbatim :batch batch :cmdline 
> --quiet
> (assume(z>0),
> integrate(exp(-t)*t^z, t, 0, inf));
> #+end_src
>
> produces an output with a pair of empty lines:
>
> #+RESULTS: ob-maxima/batch+verbatim+quiet
> : (%i1) (assume(z > 0),integrate(exp(-t)*t^z,t,0,inf))
> : (%o1)                            gamma(z + 1)
> : (%i2) 
> : (%i4) 
>
>
> I don't understand why those extra lines appear. It looks to me like a
> bug in Maxima, but, because of that, they need to be filtered out.

May empty lines be intentional in some maxima code?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]