From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Bottorff Subject: Re: Library of Babel confusion Date: Wed, 11 Apr 2018 09:29:26 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c0a4b6056992a093" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6FoX-000697-CN for emacs-orgmode@gnu.org; Wed, 11 Apr 2018 09:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6FoV-0007p1-Ne for emacs-orgmode@gnu.org; Wed, 11 Apr 2018 09:29:29 -0400 Received: from mail-oi0-x234.google.com ([2607:f8b0:4003:c06::234]:44154) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f6FoV-0007oh-EW for emacs-orgmode@gnu.org; Wed, 11 Apr 2018 09:29:27 -0400 Received: by mail-oi0-x234.google.com with SMTP id j143-v6so1676200oih.11 for ; Wed, 11 Apr 2018 06:29:27 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Thomas S. Dye" Cc: emacs-orgmode Mailinglist , "Berry, Charles" --000000000000c0a4b6056992a093 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I'll try that, Thomas, but this was set up by simply doing the on-board customize, i.e., it needs to have this corrected. So how do I request this correction? On Tue, Apr 10, 2018 at 3:26 PM, Thomas S. Dye wrote: > Aloha Lawrence, > > You probably want (org-babel-lob-ingest &optional FILE) > > All the best, > Tom > > > Lawrence Bottorff writes: > > Thanks for the help. However, one mystery still remains: Why is this >> >> '(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org"))) >> >> in my init.el's custom-set-variables not getting handled? I always have = to >> do an org-babel-lob-ingest to actually get library-of-babel.org loaded. >> >> On Fri, Apr 6, 2018 at 10:38 PM, Berry, Charles wrote= : >> >> >>> >>> > On Apr 6, 2018, at 4:59 PM, Thomas S. Dye > wrote: >>> > >>> >>> [Tom's response covering the main issues deleted] >>> >>> > hth, >>> > Tom >>> > >>> > Lawrence Bottorff writes: >>> > >>> >> I guess I need more information. For example, what is C-c >> C-v v >>> doing >>> >> exactly? Then C-x C-e? And M-x (symbol-function >> 'myelsquare) >>> doesn't >>> work. >>> >>> >>> `C-h k' is really your friend here. If you do not know it, try typing i= t >>> twice `C-h k C-h k'. >>> >>> As for the specific keystrokes mentioned above: >>> >>> ,----[ C-h k C-c C-v v ] >>> | C-c C-v v runs the command org-babel-expand-src-block (found in >>> | org-mode-map), which is an interactive autoloaded compiled Lisp >>> | function in =E2=80=98ob-core.el=E2=80=99. >>> | >>> | It is bound to C-c C-v v, C-c C-v C-v. >>> | >>> | (org-babel-expand-src-block &optional ARG INFO PARAMS) >>> | >>> | Expand the current source code block. >>> | Expand according to the source code block=E2=80=99s header >>> | arguments and pop open the results in a preview buffer. >>> | >>> | [back] >>> `---- >>> >>> In your case, it shows that the `mtelsquare' src block expands to: >>> >>> >>> ,---- >>> | (let ((x (quote 0))) >>> | (defun myelsquare (x) >>> | (* x x)) >>> | ) >>> `---- >>> >>> >>> ,----[ C-h k C-x C-e ] >>> | C-x C-e runs the command eval-last-sexp (found in global-map), which >>> | is an interactive compiled Lisp function in =E2=80=98elisp-mode.el=E2= =80=99. >>> | >>> | It is bound to C-x C-e. >>> | >>> | (eval-last-sexp EVAL-LAST-SEXP-ARG-INTERNAL) >>> | >>> | Evaluate sexp before point; print value in the echo area. >>> | Interactively, with prefix argument, print output into current buffer= . >>> | >>> | Normally, this function truncates long output according to the value >>> | of the variables =E2=80=98eval-expression-print-length=E2=80=99 and >>> | =E2=80=98eval-expression-print-level=E2=80=99. With a prefix argumen= t of zero, >>> | however, there is no such truncation. Such a prefix argument >>> | also causes integers to be printed in several additional formats >>> | (octal, hexadecimal, and character). >>> | >>> | If =E2=80=98eval-expression-debug-on-error=E2=80=99 is non-nil, which= is the default, >>> | this command arranges for all errors to enter the debugger. >>> | >>> | [back] >>> `---- >>> >>> So with point at the end of the preview buffer for myelsquare (which ha= s >>> one `let' expression it it) it has the same effect as running >>> `eval-buffer'. viz, the elisp function `myelsquare' is created. >>> >>> If you have gotten this far, there is an lisp function called >>> `myelsquare' >>> and the `symbol-function' expression will return its value when properl= y >>> `eval'ed. I misspoke before. I should have said >>> >>> M-: (symbol-function 'myelsquare) RET >>> >>> And that value is `(lambda (x) (* x x))'. Which simply shows you have >>> defun'ed a function and what it is. >>> >>> Once you have an elisp function, the natural way to call it is >>> src_emacs-lisp{(myelsquare 1.5)}. >>> >>> One thing you can do with LOB blocks is use them in header args of src >>> blocks just as you would use calls to ordinary src blocks. >>> >>> HTH, >>> >>> Chuck >>> >>> >>> >>> > > -- > Thomas S. Dye > http://www.tsdye.com > --000000000000c0a4b6056992a093 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'll try that, Thomas, but this was set up by simply d= oing the on-board customize, i.e., it needs to have this corrected. So how = do I request this correction?

On Tue, Apr 10, 2018 at 3:26 PM, Thomas S. Dye <tsd@tsdye.c= om> wrote:
Aloha Lawrence,<= br>
You probably want (org-babel-lob-ingest &optional FILE)

All the best,
Tom


Lawrence Bottorff writes:

Thanks for the help. However, one mystery still remains: Why is this

=C2=A0'(org-babel-lob-files (quote=C2=A0 ("~/org/worg/library-of= -babel.org")))

in my init.el's custom-set-variables not getting handled? I always have= to
do an org-babel-lob-ingest to actually get library-of-babel.org loade= d.

On Fri, Apr 6, 2018 at 10:38 PM, Berry, Charles <ccberry@ucsd.edu> wrote:



> On Apr 6, 2018, at 4:59 PM, Thomas S. Dye <tsd@tsdye.com> > wrote:
>

[Tom's response covering the main issues deleted]

> hth,
> Tom
>
> Lawrence Bottorff writes:
>
>> I guess I need more information. For example, what is C-c >>= C-v v doing
>> exactly? Then C-x C-e? And=C2=A0 M-x (symbol-function >> = 9;myelsquare) doesn't
work.


`C-h k' is really your friend here. If you do not know it, try typing i= t
twice `C-h k C-h k'.

As for the specific keystrokes mentioned above:

,----[ C-h k C-c C-v v ]
| C-c C-v v runs the command org-babel-expand-src-block (found in
| org-mode-map), which is an interactive autoloaded compiled Lisp
| function in =E2=80=98ob-core.el=E2=80=99.
|
| It is bound to C-c C-v v, C-c C-v C-v.
|
| (org-babel-expand-src-block &optional ARG INFO PARAMS)
|
| Expand the current source code block.
| Expand according to the source code block=E2=80=99s header
| arguments and pop open the results in a preview buffer.
|
| [back]
`----

In your case, it shows that the `mtelsquare' src block expands to:


,----
| (let ((x (quote 0)))
| (defun myelsquare (x)
|=C2=A0 =C2=A0(* x x))
| )
`----


,----[ C-h k C-x C-e ]
| C-x C-e runs the command eval-last-sexp (found in global-map), which
| is an interactive compiled Lisp function in =E2=80=98elisp-mode.el=E2=80= =99.
|
| It is bound to C-x C-e.
|
| (eval-last-sexp EVAL-LAST-SEXP-ARG-INTERNAL)
|
| Evaluate sexp before point; print value in the echo area.
| Interactively, with prefix argument, print output into current buffer. |
| Normally, this function truncates long output according to the value
| of the variables =E2=80=98eval-expression-print-length=E2=80=99 and
| =E2=80=98eval-expression-print-level=E2=80=99.=C2=A0 With a prefix a= rgument of zero,
| however, there is no such truncation.=C2=A0 Such a prefix argument
| also causes integers to be printed in several additional formats
| (octal, hexadecimal, and character).
|
| If =E2=80=98eval-expression-debug-on-error=E2=80=99 is non-nil, whic= h is the default,
| this command arranges for all errors to enter the debugger.
|
| [back]
`----

So with point at the end of the preview buffer for myelsquare (which has one `let' expression it it) it has the same effect as running
`eval-buffer'. viz, the elisp function `myelsquare' is created.

If you have gotten this far, there is an lisp function called `myelsquare&#= 39;
and the `symbol-function' expression will return its value when properl= y
`eval'ed. I misspoke before. I should have said

=C2=A0 =C2=A0 =C2=A0 =C2=A0 M-: (symbol-function 'myelsquare) RET

And that value is `(lambda (x) (* x x))'. Which simply shows you have defun'ed a function and what it is.

Once you have an elisp function, the natural way to call it is
src_emacs-lisp{(myelsquare 1.5)}.

One thing you can do with LOB blocks is use them in header args of src
blocks just as you would use calls to ordinary src blocks.

HTH,

Chuck





--
Thomas S. Dye
http:= //www.tsdye.com

--000000000000c0a4b6056992a093--