Browse Source

litorgy-ref can now find #+resname lines (allowing caching of src block evaluation)

  To demonstrate this I updated the example to now run a more
  interesting shell command (which happens to take a while to
  execute).
Eric Schulte 16 years ago
parent
commit
3fee1b9cd8
2 changed files with 18 additions and 4 deletions
  1. 17 3
      examples.org
  2. 1 1
      litorgy/litorgy-ref.el

+ 17 - 3
examples.org

@@ -11,17 +11,31 @@ labeled directory-pie and press =\C-c\C-c=.
 
 #+srcname: directories
 #+begin_src bash :results replace
-du -sc * |grep -v total | head -n 1
+cd ~ && du -sc * |grep -v total
 #+end_src
 
-| 4 | "block" |
+#+resname: directory-results
+|       64 | "Desktop"   |
+| 11882808 | "Documents" |
+|  8210024 | "Downloads" |
+|   879800 | "Library"   |
+|    57344 | "Movies"    |
+|  7590248 | "Music"     |
+|  5307664 | "Pictures"  |
+|        0 | "Public"    |
+|      152 | "Sites"     |
+|        8 | "System"    |
+|       56 | "bin"       |
+|  3274848 | "mail"      |
+|  5282032 | "src"       |
+|     1264 | "tools"     |
 
 [Eric] I sometimes get weird results here, where R will import the
 labels into the third column instead of the second.  I don't entirely
 trust the R table importing mechanisms so far.
 
 #+srcname: directory-pie
-#+begin_src R :var dirs = directories
+#+begin_src R :var dirs = directory-results
 pie(dirs[,1], labels = dirs[,2])
 #+end_src
 

+ 1 - 1
litorgy/litorgy-ref.el

@@ -102,7 +102,7 @@ return nil."
         (find-file (match-string 1 ref))
         (setf ref (match-string 2 ref)))
       (goto-char (point-min))
-      (unless (let ((regexp (concat "^#\\+\\(TBL\\|SRC\\)NAME:[ \t]*"
+      (unless (let ((regexp (concat "^#\\+\\(TBL\\|SRC\\|RES\\)NAME:[ \t]*"
                                     (regexp-quote ref) "[ \t]*$")))
                 (or (re-search-forward regexp nil t)
                     (re-search-backward regexp nil t)))