emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Library of Babel confusion


From: Berry, Charles
Subject: Re: [O] Library of Babel confusion
Date: Tue, 3 Apr 2018 21:39:41 +0000


> On Apr 3, 2018, at 1:31 PM, Lawrence Bottorff <address@hidden> wrote:
> 
> I've been trying to grok LOB again. So I've cloned the worg git and 
> library-of-babel.el is one of the files. org-babel-lob-injest didn't work,


Try 

M-x org-babel-lob-ingest RET org/worg/library-of-babel.org RET

Don't be a jester, be an ingester. ;-)


> so I customized org-babel-lob-files and inserted .../worg/library-of-babel.el 
> . . . and it did in fact get added to my init.el under the 
> custom-set-variables:
> 
>  '(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org")))
> 
> I checked org-babel-library-of-babel variable, and the new things seemed to 
> be there, although it's rather mind-bending to know I will be calling LOB 
> code that is internally stored inside of an association list.
> 
> Now, in my org file I put this:
> 
> #+lob: write(file="jsontest")


See (info"(org) Evaluating code blocks")

The proper idiom is

        #+call: write(file="jsontest")

Of course, there needs to be a proper 'write' src block in the file you 
ingested, etc.

> 
> and try C-c C-c on it. Nothing. My minibuffer says "local setup has been 
> refreshed". How does one use, call a LOB function? Also, while I'm 
> demonstrating my rank noobian-ness, I try this:
> 
> #+name: myelsquare
> #+header: :var x=0
> #+begin_src emacs-lisp
>   (* x x)
> #+end_src
> 
> #+call: myelsquare(x=6)
> 
> #+RESULTS:
> : 36
> 
> but this results in
> 
> #+name: myelsquare
> #+header: :var x=0
> #+begin_src emacs-lisp
>   (defun myelsquare (x)
>       (* x x))
> #+end_src
> 
> #+call: myelsquare(x=6)
> 
> #+RESULTS:
> : myelsquare2


Is this *verbatim* ? Did you cut and paste everything (including the trailing 
`2') all at once? If so, I do not get it.

I would have expected

#+RESULTS:
: myelsquare

 which is the correct behavior.

To see why put point in the myelsquare src block and type C-c C-v v

then move point to the end of the 'preview' buffer and type C-x C-e.

Look at the value echo-ed in the minibuffer.

If it still isn't clear maybe `M-x (symbol-function 'myelsquare)' will help. 

HTH,

Chuck



reply via email to

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