Browse Source

DONE (simple caching) check for named results before source blocks

Eric Schulte 16 years ago
parent
commit
43b7f90bb6
3 changed files with 12 additions and 15 deletions
  1. 3 7
      examples.org
  2. 6 4
      litorgy/litorgy-ref.el
  3. 3 4
      rorg.org

+ 3 - 7
examples.org

@@ -1,7 +1,7 @@
 #+TITLE: Examples of Litorgy in Action
 #+OPTIONS: toc:nil num:nil ^:nil
 
-* size of the rorg repository
+* size of the files in your home directory
 
 This will work for Linux and Mac users, not so sure about shell
 commands for windows users.
@@ -14,7 +14,7 @@ labeled directory-pie and press =\C-c\C-c=.
 cd ~ && du -sc * |grep -v total
 #+end_src
 
-#+resname: directory-results
+#+resname: directories
 |       64 | "Desktop"   |
 | 11882808 | "Documents" |
 |  8210024 | "Downloads" |
@@ -30,12 +30,8 @@ cd ~ && du -sc * |grep -v total
 |  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 = directory-results
+#+begin_src R :var dirs = directories
 pie(dirs[,1], labels = dirs[,2])
 #+end_src
 

+ 6 - 4
litorgy/litorgy-ref.el

@@ -102,11 +102,13 @@ return nil."
         (find-file (match-string 1 ref))
         (setf ref (match-string 2 ref)))
       (goto-char (point-min))
-      ;; TODO This should explicitly look for #+resname: lines before
-      ;; looking for #+srcname: lines to avoid re-calculating code
-      (unless (let ((regexp (concat "^#\\+\\(TBL\\|SRC\\|RES\\)NAME:[ \t]*"
+      (unless (let ((result_regexp (concat "^#\\+\\(TBL\\|RES\\)NAME:[ \t]*"
+                                            (regexp-quote ref) "[ \t]*$"))
+                    (regexp (concat "^#\\+SRCNAME:[ \t]*"
                                     (regexp-quote ref) "[ \t]*$")))
-                (or (re-search-forward regexp nil t)
+                (or (re-search-forward result_regexp nil t)
+                    (re-search-forward result_regexp nil t)
+                    (re-search-forward regexp nil t)
                     (re-search-backward regexp nil t)))
         ;; ;; TODO: allow searching for names in other buffers
         ;; (setq id-loc (org-id-find ref 'marker)

+ 3 - 4
rorg.org

@@ -3,10 +3,7 @@
 #+SEQ_TODO:  TODO PROPOSED | DONE DEFERRED REJECTED
 #+STARTUP: oddeven
 
-* Tasks [15/26]
-
-** TODO (simple caching) check for named results before source blocks
-see the TODO comment in [[file:litorgy/litorgy-ref.el::TODO%20This%20should%20explicitly%20look%20for%20resname%20lines%20before][litorgy-ref.el#litorgy-ref-resolve-reference]]
+* Tasks [16/26]
 
 ** TODO name named results if source block is named
 currently this isn't happening although it should be
@@ -229,6 +226,8 @@ mean(mean(vec))
     out some lines, and then convert it to litorgy format for
     posterity. Same for a shell session either in a *shell* buffer, or
     pasted from another terminal emulator. And python of course.
+** DONE (simple caching) check for named results before source blocks
+see the TODO comment in [[file:litorgy/litorgy-ref.el::TODO%20This%20should%20explicitly%20look%20for%20resname%20lines%20before][litorgy-ref.el#litorgy-ref-resolve-reference]]
 ** DONE set =:results silent= when eval with prefix argument
 
 #+begin_src emacs-lisp