summaryrefslogtreecommitdiff
path: root/lisp/ob-lob.el
diff options
context:
space:
mode:
authorS├ębastien Delafond <sdelafond@gmail.com>2015-08-25 12:27:35 +0200
committerS├ębastien Delafond <sdelafond@gmail.com>2015-08-25 12:27:35 +0200
commit1be13d57dc8357576a8285c6dadc03db9e3ed7b0 (patch)
treee35b32d4dbd60cb6cea09f3c0797cc8877352def /lisp/ob-lob.el
parent4dc4918d0d667f18f3d5e3dd71e6f117ddb8af8a (diff)
Imported Upstream version 8.3.1
Diffstat (limited to 'lisp/ob-lob.el')
-rw-r--r--lisp/ob-lob.el35
1 files changed, 25 insertions, 10 deletions
diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el
index 4e635da..0267f44 100644
--- a/lisp/ob-lob.el
+++ b/lisp/ob-lob.el
@@ -1,6 +1,6 @@
;;; ob-lob.el --- functions supporting the Library of Babel
-;; Copyright (C) 2009-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2015 Free Software Foundation, Inc.
;; Authors: Eric Schulte
;; Dan Davison
@@ -70,8 +70,8 @@ To add files to this list use the `org-babel-lob-ingest' command."
(defconst org-babel-inline-lob-one-liner-regexp
(concat
- "\\([^\n]*?\\)call_\\([^\(\)\n]+?\\)\\(\\[\\(.*?\\)\\]\\|\\(\\)\\)"
- "\(\\([^\n]*?\\)\)\\(\\[\\(.*?\\)\\]\\)?")
+ "\\([^\n]*?\\)call_\\([^\(\)[:space:]\n]+?\\)\\(\\[\\(.*?\\)\\]\\|\\(\\)\\)"
+ "\(\\(.*?\\)\)\\(\\[\\(.*?\\)\\]\\)?")
"Regexp to match inline calls to predefined source block functions.")
(defconst org-babel-lob-one-liner-regexp
@@ -116,9 +116,10 @@ if so then run the appropriate source block from the Library."
(match-string 2) (match-string 11)))
(save-excursion
(forward-line -1)
- (and (looking-at (concat org-babel-src-name-regexp
- "\\([^\n]*\\)$"))
- (org-no-properties (match-string 1))))))))))
+ (save-match-data
+ (and (looking-at (concat org-babel-src-name-regexp
+ "\\([^\n]*\\)$"))
+ (org-no-properties (match-string 1)))))))))))
(defvar org-babel-default-header-args:emacs-lisp) ; Defined in ob-emacs-lisp.el
(defun org-babel-lob-execute (info)
@@ -142,18 +143,32 @@ if so then run the appropriate source block from the Library."
(pre-info (funcall mkinfo pre-params))
(cache-p (and (cdr (assoc :cache pre-params))
(string= "yes" (cdr (assoc :cache pre-params)))))
- (new-hash (when cache-p (org-babel-sha1-hash pre-info)))
- (old-hash (when cache-p (org-babel-current-result-hash)))
+ (new-hash (when cache-p
+ (org-babel-sha1-hash
+ ;; Do *not* pre-process params for call line
+ ;; hash evaluation, since for a call line :var
+ ;; extension *is* execution.
+ (let* ((params (nth 2 pre-info))
+ (sha1-nth2 (list
+ (cons
+ (cons :c-var (cdr (assoc :var params)))
+ (assq-delete-all :var (copy-tree params)))))
+ (sha1-info (copy-tree pre-info)))
+ (prog1 sha1-info
+ (setcar (cddr sha1-info) sha1-nth2))))))
+ (old-hash (when cache-p (org-babel-current-result-hash pre-info)))
(org-babel-current-src-block-location (point-marker)))
(if (and cache-p (equal new-hash old-hash))
- (save-excursion (goto-char (org-babel-where-is-src-block-result))
+ (save-excursion (goto-char (org-babel-where-is-src-block-result
+ nil pre-info))
(forward-line 1)
(message "%S" (org-babel-read-result)))
(prog1 (let* ((proc-params (org-babel-process-params pre-params))
org-confirm-babel-evaluate)
(org-babel-execute-src-block nil (funcall mkinfo proc-params)))
;; update the hash
- (when new-hash (org-babel-set-current-result-hash new-hash))))))
+ (when new-hash
+ (org-babel-set-current-result-hash new-hash pre-info))))))
(provide 'ob-lob)