* Library of Babel confusion @ 2018-04-03 20:31 Lawrence Bottorff 2018-04-03 20:44 ` Nicolas Goaziou 2018-04-03 21:39 ` Berry, Charles 0 siblings, 2 replies; 12+ messages in thread From: Lawrence Bottorff @ 2018-04-03 20:31 UTC (permalink / raw) To: emacs-orgmode Mailinglist [-- Attachment #1: Type: text/plain, Size: 1222 bytes --] 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, 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") 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? LB [-- Attachment #2: Type: text/html, Size: 1833 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 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 2018-04-03 21:39 ` Berry, Charles 1 sibling, 1 reply; 12+ messages in thread From: Nicolas Goaziou @ 2018-04-03 20:44 UTC (permalink / raw) To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist 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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-03 20:44 ` Nicolas Goaziou @ 2018-04-04 22:52 ` Lawrence Bottorff 0 siblings, 0 replies; 12+ messages in thread From: Lawrence Bottorff @ 2018-04-04 22:52 UTC (permalink / raw) To: emacs-orgmode Mailinglist [-- 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 --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-03 20:31 Library of Babel confusion Lawrence Bottorff 2018-04-03 20:44 ` Nicolas Goaziou @ 2018-04-03 21:39 ` Berry, Charles 2018-04-06 22:15 ` Lawrence Bottorff 1 sibling, 1 reply; 12+ messages in thread From: Berry, Charles @ 2018-04-03 21:39 UTC (permalink / raw) To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist > On Apr 3, 2018, at 1:31 PM, Lawrence Bottorff <borgauf@gmail.com> 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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-03 21:39 ` Berry, Charles @ 2018-04-06 22:15 ` Lawrence Bottorff 2018-04-06 23:59 ` Thomas S. Dye 0 siblings, 1 reply; 12+ messages in thread From: Lawrence Bottorff @ 2018-04-06 22:15 UTC (permalink / raw) To: Berry, Charles, emacs-orgmode Mailinglist [-- Attachment #1: Type: text/plain, Size: 3654 bytes --] 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. Again, #+name: myelsquare #+header: :var x=0 #+begin_src emacs-lisp :var x=0 (defun myelsquare (x) (* x x)) #+end_src is Lisp code where the last thing should be returned. From library-of-babel.org: #+name: json #+begin_src emacs-lisp :var file='() :var url='() (require 'json) (cond (file (org-babel-with-temp-filebuffer file (goto-char (point-min)) (json-read))) (url (require 'w3m) (with-temp-buffer (w3m-retrieve url) (goto-char (point-min)) (json-read)))) #+end_src And this calling a sample json-containing file gives #+call: json(file="jsontest1") | glossary | (title . example glossary) | (GlossDiv (title . S) (GlossList (GlossEntry (ID . SGML) (SortAs . SGML) (GlossTerm . Standard Generalized Markup Language) (Acronym . SGML) (Abbrev . ISO 8879:1986) (GlossDef (para . A meta-markup language, used to create markup languages such as DocBook.) (GlossSeeAlso . [GML XML])) (GlossSee . markup)))) | which is correct, although not in list form. So again I'm looking at elisp code that is not in the form of a function. So I'm guessing "functions" cannot be #+call'ed, just "headless" elisp code. So what advantage does LOB offer? On Tue, Apr 3, 2018 at 5:39 PM, Berry, Charles <ccberry@ucsd.edu> wrote: > > > > On Apr 3, 2018, at 1:31 PM, Lawrence Bottorff <borgauf@gmail.com> 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 > [-- Attachment #2: Type: text/html, Size: 5233 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-06 22:15 ` Lawrence Bottorff @ 2018-04-06 23:59 ` Thomas S. Dye 2018-04-07 2:38 ` Berry, Charles 0 siblings, 1 reply; 12+ messages in thread From: Thomas S. Dye @ 2018-04-06 23:59 UTC (permalink / raw) To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist, Berry, Charles Aloha Lawrence, #+name: myelsquare #+header: :var x=0 #+begin_src emacs-lisp :var x=0 (defun myelsquare (x) (* x x)) #+end_src #+RESULTS: myelsquare : myelsquare Assuming myelsquare has been evaluated: #+name: eval-myelsquare #+header: :var y=2 #+BEGIN_SRC emacs-lisp (myelsquare y) #+END_SRC #+RESULTS: eval-myelsquare : 4 #+call: eval-myelsquare(3) #+RESULTS: : 9 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. > Again, > > #+name: myelsquare > #+header: :var x=0 > #+begin_src emacs-lisp :var x=0 > (defun myelsquare (x) > (* x x)) > #+end_src > > is Lisp code where the last thing should be returned. From > library-of-babel.org: > > #+name: json > #+begin_src emacs-lisp :var file='() :var url='() > (require 'json) > (cond > (file > (org-babel-with-temp-filebuffer file > (goto-char (point-min)) > (json-read))) > (url > (require 'w3m) > (with-temp-buffer > (w3m-retrieve url) > (goto-char (point-min)) > (json-read)))) > #+end_src > > And this calling a sample json-containing file gives > > #+call: json(file="jsontest1") > > | glossary | (title . example glossary) | (GlossDiv (title . S) > (GlossList > (GlossEntry (ID . SGML) (SortAs . SGML) (GlossTerm . Standard > Generalized > Markup Language) (Acronym . SGML) (Abbrev . ISO 8879:1986) > (GlossDef (para > . A meta-markup language, used to create markup languages such > as DocBook.) > (GlossSeeAlso . [GML XML])) (GlossSee . markup)))) | > > which is correct, although not in list form. So again I'm > looking at elisp > code that is not in the form of a function. So I'm guessing > "functions" > cannot be #+call'ed, just "headless" elisp code. So what > advantage does LOB > offer? > > On Tue, Apr 3, 2018 at 5:39 PM, Berry, Charles > <ccberry@ucsd.edu> wrote: > >> >> >> > On Apr 3, 2018, at 1:31 PM, Lawrence Bottorff >> > <borgauf@gmail.com> 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 >> -- Thomas S. Dye http://www.tsdye.com ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-06 23:59 ` Thomas S. Dye @ 2018-04-07 2:38 ` Berry, Charles 2018-04-10 18:55 ` Lawrence Bottorff 0 siblings, 1 reply; 12+ messages in thread From: Berry, Charles @ 2018-04-07 2:38 UTC (permalink / raw) To: Thomas S. Dye; +Cc: emacs-orgmode Mailinglist, Lawrence Bottorff > 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 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 ‘ob-core.el’. | | 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’s 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 ‘elisp-mode.el’. | | 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 ‘eval-expression-print-length’ and | ‘eval-expression-print-level’. 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 ‘eval-expression-debug-on-error’ 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 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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-07 2:38 ` Berry, Charles @ 2018-04-10 18:55 ` Lawrence Bottorff 2018-04-10 19:26 ` Thomas S. Dye 0 siblings, 1 reply; 12+ messages in thread From: Lawrence Bottorff @ 2018-04-10 18:55 UTC (permalink / raw) To: Berry, Charles; +Cc: emacs-orgmode Mailinglist [-- Attachment #1: Type: text/plain, Size: 3415 bytes --] 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 <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 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 ‘ob-core.el’. > | > | 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’s 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 ‘elisp-mode.el’. > | > | 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 ‘eval-expression-print-length’ and > | ‘eval-expression-print-level’. 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 ‘eval-expression-debug-on-error’ 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 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 > > > [-- Attachment #2: Type: text/html, Size: 4218 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-10 18:55 ` Lawrence Bottorff @ 2018-04-10 19:26 ` Thomas S. Dye 2018-04-11 13:29 ` Lawrence Bottorff 0 siblings, 1 reply; 12+ messages in thread From: Thomas S. Dye @ 2018-04-10 19:26 UTC (permalink / raw) To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist, Berry, Charles 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 > <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 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 ‘ob-core.el’. >> | >> | 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’s 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 ‘elisp-mode.el’. >> | >> | 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 ‘eval-expression-print-length’ and >> | ‘eval-expression-print-level’. 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 ‘eval-expression-debug-on-error’ 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 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 >> >> >> -- Thomas S. Dye http://www.tsdye.com ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 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 0 siblings, 2 replies; 12+ messages in thread From: Lawrence Bottorff @ 2018-04-11 13:29 UTC (permalink / raw) To: Thomas S. Dye; +Cc: emacs-orgmode Mailinglist, Berry, Charles [-- Attachment #1: Type: text/plain, Size: 4097 bytes --] 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 <tsd@tsdye.com> 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 <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 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 ‘ob-core.el’. >>> | >>> | 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’s 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 ‘elisp-mode.el’. >>> | >>> | 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 ‘eval-expression-print-length’ and >>> | ‘eval-expression-print-level’. 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 ‘eval-expression-debug-on-error’ 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 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 >>> >>> >>> >>> > > -- > Thomas S. Dye > http://www.tsdye.com > [-- Attachment #2: Type: text/html, Size: 5260 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-11 13:29 ` Lawrence Bottorff @ 2018-04-11 16:57 ` Thomas S. Dye 2018-04-11 18:20 ` Berry, Charles 1 sibling, 0 replies; 12+ messages in thread From: Thomas S. Dye @ 2018-04-11 16:57 UTC (permalink / raw) To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist, Berry, Charles Aloha Lawrence, Lawrence Bottorff writes: > 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? There are instructions here: https://orgmode.org/org.html#Feedback You'll need to indicate which customization option you've set and what you expected to happen vs. what actually happened. I don't use customize and am not familiar with it, but when I looked through the Babel section this morning I didn't find an option to ingest a library of babel. Perhaps I missed it, or it is found somewhere else? All the best, Tom > > On Tue, Apr 10, 2018 at 3:26 PM, Thomas S. Dye <tsd@tsdye.com> > 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 >>> <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 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 ‘ob-core.el’. >>>> | >>>> | 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’s 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 >>>> ‘elisp-mode.el’. >>>> | >>>> | 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 ‘eval-expression-print-length’ and >>>> | ‘eval-expression-print-level’. 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 ‘eval-expression-debug-on-error’ 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 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 >>>> >>>> >>>> >>>> >> >> -- >> Thomas S. Dye >> http://www.tsdye.com >> -- Thomas S. Dye http://www.tsdye.com ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Library of Babel confusion 2018-04-11 13:29 ` Lawrence Bottorff 2018-04-11 16:57 ` Thomas S. Dye @ 2018-04-11 18:20 ` Berry, Charles 1 sibling, 0 replies; 12+ messages in thread From: Berry, Charles @ 2018-04-11 18:20 UTC (permalink / raw) To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist > On Apr 11, 2018, at 6:29 AM, Lawrence Bottorff <borgauf@gmail.com> wrote: > > 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? The idiom Tom gave you is correct. There are no variables for you to handle yourself - it all happens under the hood. Chuck > > On Tue, Apr 10, 2018 at 3:26 PM, Thomas S. Dye <tsd@tsdye.com> 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 <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 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 ‘ob-core.el’. > | > | 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’s 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 ‘elisp-mode.el’. > | > | 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 ‘eval-expression-print-length’ and > | ‘eval-expression-print-level’. 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 ‘eval-expression-debug-on-error’ 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 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 > > > > > > -- > Thomas S. Dye > http://www.tsdye.com > ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-04-11 21:33 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
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).