Re: [O] [RFC] [PATCH] bug with babel call lines and cache
Hello all, 2015ko urriak 30an, Aaron Ecay-ek idatzi zuen: > > Hello all, > > In playing around with some of the cache-related issues, I’ve discovered > that C-c C-c on the following #+call line will give the following > backtrace: > [...] > > The problem is that unprocessed params (in the sense of > org-babel-process-params) are passed to org-babel-sha1-hash under some > circumstances. > > The attached patch fixes this issue by simplifying some code in > org-babel-execute-src-block. I’m slightly uncomfortable about it > because I remember touching the various nested ‘let’s which toggle > between different states of ‘params’ in that function once upon a > time, and they seemed important. Now I can’t remember why, though. > So I’d be happier if someone else familiar with babel’s code looked > the patch over. > > If no one pipes up in a few days, I will push the patch and see if > anything breaks. Pushed to master as 4750e44 (with a couple cosmetic changes from the original version). -- Aaron Ecay
[O] [RFC] [PATCH] bug with babel call lines and cache
Hello all, In playing around with some of the cache-related issues, I’ve discovered that C-c C-c on the following #+call line will give the following backtrace: , | #+name: foo | #+begin_src emacs-lisp :var bar="baz" | bar | #+end_src | | #+call: foo[:cache yes]("qux") | | #+RESULTS: | : qux ` , | Debugger entered--Lisp error: (wrong-type-argument listp "bar=\"qux\"") | car("bar=\"qux\"") | (list (car var) (list (quote quote) (cdr var))) | (print (list (car var) (list (quote quote) (cdr var | (format "%S" (print (list (car var) (list (quote quote) (cdr var) | (closure ((result-params "replace") (vars "bar=\"qux\"") (params (:cache . "yes") (:comments . "yes") (:exports . "code") (:hlines . "no") (:noweb . "no") (:padline . "") (:result-params "replace") (:result-type . value) (:results . "silent") (:session . "none") (:shebang . "") (:tangle . "no") (:var . "bar=\"qux\"")) (body . "bar") t) (var) (format "%S" (print (list (car var) (list (quote quote) (cdr var))("bar=\"qux\"") | mapconcat((closure ((result-params "replace") (vars "bar=\"qux\"") (params (:cache . "yes") (:comments . "yes") (:exports . "code") (:hlines . "no") (:noweb . "no") (:padline . "") (:result-params "replace") (:result-type . value) (:results . "silent") (:session . "none") (:shebang . "") (:tangle . "no") (:var . "bar=\"qux\"")) (body . "bar") t) (var) (format "%S" (print (list (car var) (list (quote quote) (cdr var)) ("bar=\"qux\"") "\n ") | (concat "(let (" (mapconcat (function (lambda (var) (format "%S" (print (list (car var) (list ... ...)) vars "\n ") ")\n" body "\n)") | (if (> (length vars) 0) (concat "(let (" (mapconcat (function (lambda (var) (format "%S" (print (list ... ...) vars "\n ") ")\n" body "\n)") (concat body "\n")) | (let* ((vars (org-babel--get-vars params)) (result-params (cdr (assoc :result-params params))) (print-level nil) (print-length nil) (body (if (> (length vars) 0) (concat "(let (" (mapconcat (function (lambda ... ...)) vars "\n ") ")\n" body "\n)") (concat body "\n" (if (or (member "code" result-params) (member "pp" result-params)) (concat "(pp " body ")") body)) | org-babel-expand-body:emacs-lisp("bar" ((:cache . "yes") (:comments . "yes") (:exports . "code") (:hlines . "no") (:noweb . "no") (:padline . "") (:result-params "replace") (:result-type . value) (:results . "silent") (:session . "none") (:shebang . "") (:tangle . "no") (:var . "bar=\"qux\""))) | funcall(org-babel-expand-body:emacs-lisp "bar" ((:cache . "yes") (:comments . "yes") (:exports . "code") (:hlines . "no") (:noweb . "no") (:padline . "") (:result-params "replace") (:result-type . value) (:results . "silent") (:session . "none") (:shebang . "") (:tangle . "no") (:var . "bar=\"qux\""))) | (if (fboundp expand-cmd) (funcall expand-cmd body params) (org-babel-expand-body:generic body params (and (fboundp assignments-cmd) (funcall assignments-cmd params | (let* ((rm (function (lambda (lst) (let ((--dolist-tail-- ...) p) (while --dolist-tail-- (setq p ...) (setq lst ...) (setq --dolist-tail-- ...))) lst))) (norm (function (lambda (arg) (let ((v ...)) (if (and v ...) (progn ...)) (lang (nth 0 info)) (params (nth 2 info)) (body (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info))) (expand-cmd (intern (concat "org-babel-expand-body:" lang))) (assignments-cmd (intern (concat "org-babel-variable-assignments:" lang))) (expanded (if (fboundp expand-cmd) (funcall expand-cmd body params) (org-babel-expand-body:generic body params (and (fboundp assignments-cmd) (funcall assignments-cmd params)) (let* ((it (format "%s-%s" (mapconcat (function identity) (delq nil (mapcar ... ...)) ":") expanded)) (hash (sha1 it))) (if (with-no-warnings (called-interactively-p (quote interactive))) (progn (message hash))) hash)) | (let ((print-level nil) (info (or info (org-babel-get-src-block-info (let* ((c (nthcdr 2 info))) (setcar c (sort (copy-sequence (nth 2 info)) (function (lambda (a b) (string< (car a) (car b))) (let* ((rm (function (lambda (lst) (let (... p) (while --dolist-tail-- ... ... ...)) lst))) (norm (function (lambda (arg) (let (...) (if ... ...) (lang (nth 0 info)) (params (nth 2 info)) (body (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info))) (expand-cmd (intern (concat "org-babel-expand-body:" lang))) (assignments-cmd (intern (concat "org-babel-variable-assignments:" lang))) (expanded (if (fboundp expand-cmd) (funcall expand-cmd body params) (org-babel-expand-body:generic body params (and (fboundp assignments-cmd) (funcall assignments-cmd params)) (let* ((it (format "%s-%s" (mapconcat (function identity) (delq nil ...) ":") expanded)) (hash (sha1 it))) (if (with-no-warnings (called-interactively-p (quote interactive))) (progn (message hash))) hash))) | org-babel-sha1-hash(("emacs-lisp" "bar" ((:cache