From: Lawrence Bottorff <borgauf@gmail.com>
To: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: Library of Babel confusion
Date: Wed, 4 Apr 2018 18:52:35 -0400 [thread overview]
Message-ID: <CAFAhFSXA7tOdh11BUMROtD92D0qMyjSesWQpL-Hid-_M+DT6gQ@mail.gmail.com> (raw)
In-Reply-To: <87r2nwvx4f.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 2294 bytes --]
The docs <https://orgmode.org/worg/org-contrib/babel/intro.html> have this
example:
#+name: square
#+header: :var x=0
#+begin_src python
return x*x
#+end_src
#+call: square(x=6)
...so yes, "return", but with
(defun myelsquare (x)
(* x x))
isn't the final thing evaluated what is "returned" with Elisp? AFAIK there
is no explicit return with Elisp. #+call can't really call a function, only
named blocks of REPL-style calculator snippets?
Also, today I find that a new start of Emacs doesn't load my LOB file, i.e.,
(custom-set-variables
...
'(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org")))
...
was being blown off, i.e., not populating the org-babel-library-of-babel
variable. But today org-babel-lob-injest does seem to work, i.e., it did
populate org-babel-library-of-babel. I wonder what's up.
On Tue, Apr 3, 2018 at 4:44 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:
> Lawrence Bottorff <borgauf@gmail.com> writes:
>
> > 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,
>
> What doesn't work? You call `org-babel-lob-ingest', specify a file, and
> it stores all source code blocks in the file for later use.
>
> > Now, in my org file I put this:
> >
> > #+lob: write(file="jsontest")
>
> This should be #+call: write(...)
>
> >
> > 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
> >
> > After a #+call:... I use C-c C-c to evaluate it. What am I missing
> > here?
>
> Your second block defines a function, but doesn't return its results.
> "#+call: myelsquare(...)" expects to find a block named "myelsquare",
> not an Elisp function named "myelsquare".
>
> Regards,
>
> --
> Nicolas Goaziou
>
[-- Attachment #2: Type: text/html, Size: 7415 bytes --]
next prev parent reply other threads:[~2018-04-04 22:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 20:31 Library of Babel confusion Lawrence Bottorff
2018-04-03 20:44 ` Nicolas Goaziou
2018-04-04 22:52 ` Lawrence Bottorff [this message]
2018-04-03 21:39 ` Berry, Charles
2018-04-06 22:15 ` Lawrence Bottorff
2018-04-06 23:59 ` Thomas S. Dye
2018-04-07 2:38 ` Berry, Charles
2018-04-10 18:55 ` Lawrence Bottorff
2018-04-10 19:26 ` Thomas S. Dye
2018-04-11 13:29 ` Lawrence Bottorff
2018-04-11 16:57 ` Thomas S. Dye
2018-04-11 18:20 ` Berry, Charles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFAhFSXA7tOdh11BUMROtD92D0qMyjSesWQpL-Hid-_M+DT6gQ@mail.gmail.com \
--to=borgauf@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).