diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2011-05-06 14:45:38 -0600 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2011-05-06 14:45:38 -0600 |
commit | ec293ae62b1d92a45b752beb29b9d4163c04c573 (patch) | |
tree | 9b4251d88674d67ae011496e48b5ee50a275c584 | |
parent | a173acf275608695d0ddc6441b6cac04aa29f6bf (diff) | |
download | org-mode-ec293ae62b1d92a45b752beb29b9d4163c04c573.tar.gz |
configurable names for inline data labels
* lisp/ob-ref.el (org-babel-ref-resolve): Using the new result regexp.
* lisp/ob.el (org-babel-data-names): Configurable list of names of data.
(org-babel-result-regexp): Using new results regexp.
-rw-r--r-- | lisp/ob-ref.el | 17 | ||||
-rw-r--r-- | lisp/ob.el | 6 |
2 files changed, 13 insertions, 10 deletions
diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el index ce404af..67ff135 100644 --- a/lisp/ob-ref.el +++ b/lisp/ob-ref.el @@ -116,17 +116,16 @@ the variable." (save-restriction (widen) (goto-char (point-min)) - (if (let ((result_regexp (concat "^[ \t]*#\\+\\(TBLNAME\\|RESNAME" - "\\|RESULTS\\):[ \t]*" - (regexp-quote ref) "[ \t]*$")) - (regexp (concat org-babel-src-name-regexp - (regexp-quote ref) "\\(\(.*\)\\)?" "[ \t]*$"))) + (if (let* ((rx (regexp-quote ref)) + (res-rx (concat org-babel-result-regexp rx "[ \t]*$")) + (src-rx (concat org-babel-src-name-regexp + rx "\\(\(.*\)\\)?" "[ \t]*$"))) ;; goto ref in the current buffer (or (and (not args) - (or (re-search-forward result_regexp nil t) - (re-search-backward result_regexp nil t))) - (re-search-forward regexp nil t) - (re-search-backward regexp nil t) + (or (re-search-forward res-rx nil t) + (re-search-backward res-rx nil t))) + (re-search-forward src-rx nil t) + (re-search-backward src-rx nil t) ;; check the Library of Babel (setq lob-info (cdr (assoc (intern ref) org-babel-library-of-babel))))) @@ -306,8 +306,12 @@ specific header arguments as well.") '((:session . "none") (:results . "replace") (:exports . "results")) "Default arguments to use when evaluating an inline source block.") +(defvar org-babel-data-names '("TBLNAME" "RESNAME" "RESULTS" "DATA")) + (defvar org-babel-result-regexp - "^[ \t]*#\\+res\\(ults\\|name\\)\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*" + (concat "^[ \t]*#\\+" + (regexp-opt org-babel-data-names) + "\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*") "Regular expression used to match result lines. If the results are associated with a hash key then the hash will be saved in the second match data.") |