Ver Fonte

Babel: add comments to ERT for reading properties

* testing/examples/babel.org (use case of reading entry properties):
Add comments to function definitions.
Michael Brand há 11 anos atrás
pai
commit
77710ec262
1 ficheiros alterados com 8 adições e 0 exclusões
  1. 8 0
      testing/examples/babel.org

+ 8 - 0
testing/examples/babel.org

@@ -413,6 +413,9 @@ Note: Just export of a property can be done with a macro: {{{property(a)}}}.
 
 **** function definition
 
+comments for ":var":
+- The "or" is to deal with a property not present.
+- The t is to get property inheritance.
 #+NAME: src_block_location_shell
 #+HEADER: :var a=(or (org-entry-get org-babel-current-src-block-location "a" t) "0")
 #+HEADER: :var b=(or (org-entry-get org-babel-current-src-block-location "b" t) "0")
@@ -433,6 +436,11 @@ Note: Just export of a property can be done with a macro: {{{property(a)}}}.
 #+HEADER: :var e='nil
 #+BEGIN_SRC emacs-lisp :exports results
   (setq
+   ;; - The first `or' together with ":var <var>='nil" is to check for
+   ;;   a value bound from an optional call argument, in the examples
+   ;;   here: c=5, e=6
+   ;; - The second `or' is to deal with a property not present
+   ;; - The t is to get property inheritance
    a (or a (string-to-number
             (or (org-entry-get org-babel-current-src-block-location "a" t)
                 "0")))