From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5yQr-0004SL-24 for emacs-orgmode@gnu.org; Tue, 10 Apr 2018 14:55:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5yQp-0007BX-EU for emacs-orgmode@gnu.org; Tue, 10 Apr 2018 14:55:53 -0400 Received: from mail-ot0-x22c.google.com ([2607:f8b0:4003:c0f::22c]:46619) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5yQp-00079Q-7d for emacs-orgmode@gnu.org; Tue, 10 Apr 2018 14:55:51 -0400 Received: by mail-ot0-x22c.google.com with SMTP id v64-v6so13961114otb.13 for ; Tue, 10 Apr 2018 11:55:50 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Lawrence Bottorff Date: Tue, 10 Apr 2018 14:55:49 -0400 Message-ID: Content-Type: multipart/alternative; boundary="00000000000029fbd105698312fa" Subject: Re: Library of Babel confusion List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+kyle=kyleam.com@gnu.org Sender: "Emacs-orgmode" To: "Berry, Charles" Cc: emacs-orgmode Mailinglist --00000000000029fbd105698312fa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 it > 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 argument = 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 i= s 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= ' > and the `symbol-function' expression will return its value when properly > `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 > > > --00000000000029fbd105698312fa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for the help. However, one mystery still remains: W= hy is this

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


On Fri, Apr 6, 2018 at 10:38 PM, Berry, Charles = <ccberry@ucsd.edu<= /a>> 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 do= ing
>> exactly? Then C-x C-e? And=C2=A0 M-x (symbol-function 'myelsqu= are) doesn't work.


`C-h k' is really your friend here. If you do not know it, try t= yping it 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 argume= nt 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 on= e `let' expression it it) it has the same effect as running `eval-buffe= r'. 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 pro= perly `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 d= efun'ed a function and what it is.

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

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

HTH,

Chuck



--00000000000029fbd105698312fa--