+1
/PA

On Sun, 5 Jul 2026 at 14:02, Ihor Radchenko <[email protected]> wrote:

> Visuwesh <[email protected]> writes:
>
> > Please find attached patch.  There is still a small problem with it that
> > I'm not sure how to resolve.  Consider the following scenario:
> >
> >   1. Set Calc's language to Mathematica by doing C-x * * d M
> >   2. Then with the patch applied, go to an Org mode buffer and write out
> >      the following
> >      #+BEGIN_SRC calc :language mathematica
> >      B_12
> >      #+END_SRC
> >   3. Evaluate the source block and witness an error
> > ...
> > I could always set calc-language to normal regardless of the presence of
> > the :language parameter but that would be a breaking change.  I think
> > erroring out when an incorrect language value is given is the better
> > solution, WDYT?  Something like
> >
> >     Invalid language parameter; accepted values are c, pascal, ...
>
> Yes, it would make sense.
> I am not sure what would be breaking about this.
>
> > +    ;; This is needed so that we can force Org to print the results as
> > +    ;; "raw" format.  If there's a colon in front, then C-c C-x C-l
> > +    ;; does not do the job anymore.
> > +    (when (equal "latex" (cdr (assq :language params)))
> > +      (cl-callf (lambda (v) (nconc v '("raw")))
> > +          (alist-get :result-params params)))))
>
> This is awkward. What about extending ob-core itself. There is already
> :results code, but it does not allow custom languages. We may extend that.
>
> >  +(defun org-babel-calc--format-lang (result params old-lang
> old-lang-opt)
> >  +  "Return RESULT as per the Calc language given in PARAMS.
> >  +This resets the Calc language back to OLD-LANG, and the options to
> >  +OLD-LANG-OPT."
> >  +  (calc-set-language (org-babel-calc--valid-lang-p params))
> >  +  (prog1
> >  +      (if (eq calc-language 'latex)
> >  +          (concat "\\begin{equation*}\n"
> >  +                  (calc-eval result)
> >  +                  "\n\\end{equation*}")
> >  +        (calc-eval result))
>
> What about inline src blocks?
>
> --
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> 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>
>
>

-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

"Sagen's Paradeiser" (ORF: Als Radiohören gefährlich war) => write BE!
Year 2 of the New Koprocracy

This was produced by a human (implied virtues and weaknesses acknowledged)
I'd hate this being fed to any form of AS (sorry AI)...

Reply via email to