From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: problem with babel call with post action Date: Wed, 21 Jun 2017 06:51:01 +0100 Message-ID: <878tkllwhm.fsf@t3610> References: <874lvaadbt.fsf@delle7240.chemeng.ucl.ac.uk> <7f25f31c2d8946deb9f1ac6d35fede98@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> Reply-To: Eric S Fraga Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNYXo-000791-G4 for emacs-orgmode@gnu.org; Wed, 21 Jun 2017 01:51:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNYXl-0004e5-Aj for emacs-orgmode@gnu.org; Wed, 21 Jun 2017 01:51:12 -0400 Received: from mail-he1eur01on0119.outbound.protection.outlook.com ([104.47.0.119]:11449 helo=EUR01-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dNYXk-0004cC-N2 for emacs-orgmode@gnu.org; Wed, 21 Jun 2017 01:51:09 -0400 In-Reply-To: <7f25f31c2d8946deb9f1ac6d35fede98@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> (Nicolas Goaziou's message of "Tue, 20 Jun 2017 19:23:25 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hi Nicolas, Thanks for the quick response! On Tuesday, 20 Jun 2017 at 19:23, Nicolas Goaziou wrote: [...] > That is a serious babel call. :-) I think it's a symptom of being lazy and spending way too much time on codes to make life easier... as in "The tale of the man who was too lazy to fail" by Robert Heinlein [1]. > I improved babel call arguments parsing. Could you confirm that your > wizardry is in order now? I got further but there's still an error. See attached debug output. I don't understand as org-table-to-lisp does exist. I don't think it's a configuration problem but... thanks, eric Footnotes: [1] https://en.wikipedia.org/wiki/Time_Enough_for_Love -- : Eric S Fraga via Emacs 26.0.50, Org release_9.0.8-568-ga615d3 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=debugoutput.txt Content-Transfer-Encoding: quoted-printable Debugger entered--Lisp error: (void-function org-table-to-lisp) (org-table-to-lisp) (mapcar (function (lambda (row) (if (and (symbolp row) (equal row (quote = hline))) row (mapcar (function (lambda (el) (org-babel-read el ...))) row))= )) (org-table-to-lisp)) org-babel-read-table() (cond ((eq val (quote fixed-width)) (let ((v (org-trim (org-element-prope= rty :value element)))) (or (org-babel--string-to-number v) v))) ((eq val (q= uote table)) (org-babel-read-table)) ((eq val (quote plain-list)) (org-babe= l-read-list)) ((eq val (quote example-block)) (let ((v (org-element-propert= y :value element))) (if (or org-src-preserve-indentation (org-element-prope= rty :preserve-indent element)) v (org-remove-indentation v)))) ((eq val (qu= ote export-block)) (org-remove-indentation (org-element-property :value ele= ment))) ((eq val (quote paragraph)) (skip-chars-forward " ") (if (and (loo= king-at org-bracket-link-regexp) (save-excursion (goto-char (match-end 0)) = (skip-chars-forward " =0D \n") (<=3D (org-element-property :end element) (p= oint)))) (org-babel-read-link) (buffer-substring-no-properties (org-element= -property :contents-begin element) (org-element-property :contents-end elem= ent)))) ((memq val (quote (special-block verse-block quote-block center-blo= ck))) (org-remove-indentation (buffer-substring-no-properties (org-element-= property :contents-begin element) (org-element-property :contents-end eleme= nt)))) (t nil)) (let* ((val (org-element-type element))) (cond ((eq val (quote fixed-widt= h)) (let ((v (org-trim (org-element-property :value element)))) (or (org-ba= bel--string-to-number v) v))) ((eq val (quote table)) (org-babel-read-table= )) ((eq val (quote plain-list)) (org-babel-read-list)) ((eq val (quote exam= ple-block)) (let ((v (org-element-property :value element))) (if (or org-sr= c-preserve-indentation (org-element-property :preserve-indent element)) v (= org-remove-indentation v)))) ((eq val (quote export-block)) (org-remove-ind= entation (org-element-property :value element))) ((eq val (quote paragraph)= ) (skip-chars-forward " ") (if (and (looking-at org-bracket-link-regexp) (= save-excursion (goto-char (match-end 0)) (skip-chars-forward " =0D \n") (<= =3D (org-element-property :end element) (point)))) (org-babel-read-link) (b= uffer-substring-no-properties (org-element-property :contents-begin element= ) (org-element-property :contents-end element)))) ((memq val (quote (specia= l-block verse-block quote-block center-block))) (org-remove-indentation (bu= ffer-substring-no-properties (org-element-property :contents-begin element)= (org-element-property :contents-end element)))) (t nil))) (save-restriction (widen) (goto-char (org-element-property :post-affiliat= ed element)) (let* ((val (org-element-type element))) (cond ((eq val (quote= fixed-width)) (let ((v (org-trim ...))) (or (org-babel--string-to-number v= ) v))) ((eq val (quote table)) (org-babel-read-table)) ((eq val (quote plai= n-list)) (org-babel-read-list)) ((eq val (quote example-block)) (let ((v (o= rg-element-property :value element))) (if (or org-src-preserve-indentation = (org-element-property :preserve-indent element)) v (org-remove-indentation = v)))) ((eq val (quote export-block)) (org-remove-indentation (org-element-p= roperty :value element))) ((eq val (quote paragraph)) (skip-chars-forward "= ") (if (and (looking-at org-bracket-link-regexp) (save-excursion (goto-ch= ar ...) (skip-chars-forward " =0D \n") (<=3D ... ...))) (org-babel-read-lin= k) (buffer-substring-no-properties (org-element-property :contents-begin el= ement) (org-element-property :contents-end element)))) ((memq val (quote (s= pecial-block verse-block quote-block center-block))) (org-remove-indentatio= n (buffer-substring-no-properties (org-element-property :contents-begin ele= ment) (org-element-property :contents-end element)))) (t nil)))) (save-excursion (save-restriction (widen) (goto-char (org-element-propert= y :post-affiliated element)) (let* ((val (org-element-type element))) (cond= ((eq val (quote fixed-width)) (let ((v ...)) (or (org-babel--string-to-num= ber v) v))) ((eq val (quote table)) (org-babel-read-table)) ((eq val (quote= plain-list)) (org-babel-read-list)) ((eq val (quote example-block)) (let (= (v ...)) (if (or org-src-preserve-indentation ...) v (org-remove-indentatio= n v)))) ((eq val (quote export-block)) (org-remove-indentation (org-element= -property :value element))) ((eq val (quote paragraph)) (skip-chars-forward= " ") (if (and (looking-at org-bracket-link-regexp) (save-excursion ... ..= . ...)) (org-babel-read-link) (buffer-substring-no-properties (org-element-= property :contents-begin element) (org-element-property :contents-end eleme= nt)))) ((memq val (quote (special-block verse-block quote-block center-bloc= k))) (org-remove-indentation (buffer-substring-no-properties (org-element-p= roperty :contents-begin element) (org-element-property :contents-end elemen= t)))) (t nil))))) org-babel-read-element((table (:begin 14485 :end 15445 :type org :tblfm n= il :contents-begin 14508 :contents-end 15444 :value nil :post-blank 1 :post= -affiliated 14508 :name "subtasks-table" :parent nil))) (let* ((sym (org-babel-read-element e))) (if sym (let ((v sym)) (throw :f= ound v)) (error "Reference not found"))) (cond ((eq val (quote babel-call)) (throw :found (org-babel-execute-src-b= lock nil (org-babel-lob-get-info e) params))) ((eq val (quote src-block)) (= throw :found (org-babel-execute-src-block nil nil (and (not org-babel-updat= e-intermediate) params)))) (t (let* ((sym (org-babel-read-element e))) (if = sym (let ((v sym)) (throw :found v)) (error "Reference not found"))))) (let* ((val (org-element-type e))) (cond ((eq val (quote babel-call)) (th= row :found (org-babel-execute-src-block nil (org-babel-lob-get-info e) para= ms))) ((eq val (quote src-block)) (throw :found (org-babel-execute-src-bloc= k nil nil (and (not org-babel-update-intermediate) params)))) (t (let* ((sy= m (org-babel-read-element e))) (if sym (let ((v sym)) (throw :found v)) (er= ror "Reference not found")))))) (progn (goto-char (org-element-property :post-affiliated e)) (let* ((val = (org-element-type e))) (cond ((eq val (quote babel-call)) (throw :found (or= g-babel-execute-src-block nil (org-babel-lob-get-info e) params))) ((eq val= (quote src-block)) (throw :found (org-babel-execute-src-block nil nil (and= (not org-babel-update-intermediate) params)))) (t (let* ((sym (org-babel-r= ead-element e))) (if sym (let (...) (throw :found v)) (error "Reference not= found"))))))) (if (equal (org-element-property :name e) ref) (progn (goto-char (org-ele= ment-property :post-affiliated e)) (let* ((val (org-element-type e))) (cond= ((eq val (quote babel-call)) (throw :found (org-babel-execute-src-block ni= l (org-babel-lob-get-info e) params))) ((eq val (quote src-block)) (throw := found (org-babel-execute-src-block nil nil (and ... params)))) (t (let* ((s= ym ...)) (if sym (let ... ...) (error "Reference not found")))))))) (let ((e (org-element-at-point))) (if (equal (org-element-property :name = e) ref) (progn (goto-char (org-element-property :post-affiliated e)) (let* = ((val (org-element-type e))) (cond ((eq val (quote babel-call)) (throw :fou= nd (org-babel-execute-src-block nil ... params))) ((eq val (quote src-block= )) (throw :found (org-babel-execute-src-block nil nil ...))) (t (let* (...)= (if sym ... ...)))))))) (if (org-in-commented-heading-p) nil (let ((e (org-element-at-point))) (i= f (equal (org-element-property :name e) ref) (progn (goto-char (org-element= -property :post-affiliated e)) (let* ((val (org-element-type e))) (cond ((e= q val ...) (throw :found ...)) ((eq val ...) (throw :found ...)) (t (let* .= .. ...)))))))) (while (re-search-forward regexp nil t) (if (org-in-commented-heading-p) = nil (let ((e (org-element-at-point))) (if (equal (org-element-property :nam= e e) ref) (progn (goto-char (org-element-property :post-affiliated e)) (let= * ((val ...)) (cond (... ...) (... ...) (t ...)))))))) (catch :found (while (re-search-forward regexp nil t) (if (org-in-comment= ed-heading-p) nil (let ((e (org-element-at-point))) (if (equal (org-element= -property :name e) ref) (progn (goto-char (org-element-property :post-affil= iated e)) (let* (...) (cond ... ... ...))))))) (if (org-babel-ref-goto-head= line-id ref) (progn (throw :found (org-babel-ref-headline-body)))) (let ((i= nfo (cdr (assq (intern ref) org-babel-library-of-babel)))) (if info (progn = (throw :found (org-babel-execute-src-block nil info params))))) (error "Ref= erence `%s' not found in this buffer" ref)) (let* ((params (append args (quote ((:results . "silent"))))) (regexp (or= g-babel-named-data-regexp-for-name ref)) (result (catch :found (while (re-s= earch-forward regexp nil t) (if (org-in-commented-heading-p) nil (let (...)= (if ... ...)))) (if (org-babel-ref-goto-headline-id ref) (progn (throw :fo= und (org-babel-ref-headline-body)))) (let ((info (cdr ...))) (if info (prog= n (throw :found ...)))) (error "Reference `%s' not found in this buffer" re= f)))) (cond ((symbolp result) (format "%S" result)) ((and index (listp resu= lt)) (org-babel-ref-index-list index result)) (t result))) (save-restriction (widen) (goto-char (point-min)) (let* ((params (append = args (quote ((:results . "silent"))))) (regexp (org-babel-named-data-regexp= -for-name ref)) (result (catch :found (while (re-search-forward regexp nil = t) (if (org-in-commented-heading-p) nil (let ... ...))) (if (org-babel-ref-= goto-headline-id ref) (progn (throw :found ...))) (let ((info ...)) (if inf= o (progn ...))) (error "Reference `%s' not found in this buffer" ref)))) (c= ond ((symbolp result) (format "%S" result)) ((and index (listp result)) (or= g-babel-ref-index-list index result)) (t result)))) (save-excursion (save-restriction (widen) (goto-char (point-min)) (let* (= (params (append args (quote (...)))) (regexp (org-babel-named-data-regexp-f= or-name ref)) (result (catch :found (while (re-search-forward regexp nil t)= (if ... nil ...)) (if (org-babel-ref-goto-headline-id ref) (progn ...)) (l= et (...) (if info ...)) (error "Reference `%s' not found in this buffer" re= f)))) (cond ((symbolp result) (format "%S" result)) ((and index (listp resu= lt)) (org-babel-ref-index-list index result)) (t result))))) (let ((case-fold-search t) args new-refere new-header-args new-referent s= plit-file split-ref index) (if (and (string-match "\\[\\([^\\[]+\\)\\]$" re= f) (let ((str (substring ref 0 (match-beginning 0)))) (=3D (cl-count 40 str= ) (cl-count 41 str)))) (progn (setq index (match-string 1 ref)) (setq ref (= substring ref 0 (match-beginning 0))))) (if (string-match "^\\(.+?\\)\\(\\[= \\(.*\\)\\]\\|\\(\\)\\)(\\(.*\\))$" ref) (progn (setq new-refere (match-str= ing 1 ref)) (setq new-header-args (match-string 3 ref)) (setq new-referent = (match-string 5 ref)) (if (> (length new-refere) 0) (progn (if (> (length n= ew-referent) 0) (progn (setq args ...))) (if (> (length new-header-args) 0)= (progn (setq args ...))) (setq ref new-refere))))) (if (string-match "^\\(= .+\\):\\(.+\\)$" ref) (progn (setq split-file (match-string 1 ref)) (setq s= plit-ref (match-string 2 ref)) (find-file split-file) (setq ref split-ref))= ) (save-excursion (save-restriction (widen) (goto-char (point-min)) (let* (= (params (append args (quote ...))) (regexp (org-babel-named-data-regexp-for= -name ref)) (result (catch :found (while ... ...) (if ... ...) (let ... ...= ) (error "Reference `%s' not found in this buffer" ref)))) (cond ((symbolp = result) (format "%S" result)) ((and index (listp result)) (org-babel-ref-in= dex-list index result)) (t result)))))) (save-excursion (let ((case-fold-search t) args new-refere new-header-arg= s new-referent split-file split-ref index) (if (and (string-match "\\[\\([^= \\[]+\\)\\]$" ref) (let ((str (substring ref 0 ...))) (=3D (cl-count 40 str= ) (cl-count 41 str)))) (progn (setq index (match-string 1 ref)) (setq ref (= substring ref 0 (match-beginning 0))))) (if (string-match "^\\(.+?\\)\\(\\[= \\(.*\\)\\]\\|\\(\\)\\)(\\(.*\\))$" ref) (progn (setq new-refere (match-str= ing 1 ref)) (setq new-header-args (match-string 3 ref)) (setq new-referent = (match-string 5 ref)) (if (> (length new-refere) 0) (progn (if (> ... 0) (p= rogn ...)) (if (> ... 0) (progn ...)) (setq ref new-refere))))) (if (string= -match "^\\(.+\\):\\(.+\\)$" ref) (progn (setq split-file (match-string 1 r= ef)) (setq split-ref (match-string 2 ref)) (find-file split-file) (setq ref= split-ref))) (save-excursion (save-restriction (widen) (goto-char (point-m= in)) (let* ((params (append args ...)) (regexp (org-babel-named-data-regexp= -for-name ref)) (result (catch :found ... ... ... ...))) (cond ((symbolp re= sult) (format "%S" result)) ((and index ...) (org-babel-ref-index-list inde= x result)) (t result))))))) (save-current-buffer (set-buffer (or org-babel-exp-reference-buffer (curr= ent-buffer))) (save-excursion (let ((case-fold-search t) args new-refere ne= w-header-args new-referent split-file split-ref index) (if (and (string-mat= ch "\\[\\([^\\[]+\\)\\]$" ref) (let ((str ...)) (=3D (cl-count 40 str) (cl-= count 41 str)))) (progn (setq index (match-string 1 ref)) (setq ref (substr= ing ref 0 (match-beginning 0))))) (if (string-match "^\\(.+?\\)\\(\\[\\(.*\= \)\\]\\|\\(\\)\\)(\\(.*\\))$" ref) (progn (setq new-refere (match-string 1 = ref)) (setq new-header-args (match-string 3 ref)) (setq new-referent (match= -string 5 ref)) (if (> (length new-refere) 0) (progn (if ... ...) (if ... .= ..) (setq ref new-refere))))) (if (string-match "^\\(.+\\):\\(.+\\)$" ref) = (progn (setq split-file (match-string 1 ref)) (setq split-ref (match-string= 2 ref)) (find-file split-file) (setq ref split-ref))) (save-excursion (sav= e-restriction (widen) (goto-char (point-min)) (let* ((params ...) (regexp .= ..) (result ...)) (cond (... ...) (... ...) (t result)))))))) (progn (save-current-buffer (set-buffer (or org-babel-exp-reference-buffe= r (current-buffer))) (save-excursion (let ((case-fold-search t) args new-re= fere new-header-args new-referent split-file split-ref index) (if (and (str= ing-match "\\[\\([^\\[]+\\)\\]$" ref) (let (...) (=3D ... ...))) (progn (se= tq index (match-string 1 ref)) (setq ref (substring ref 0 ...)))) (if (stri= ng-match "^\\(.+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)(\\(.*\\))$" ref) (progn (= setq new-refere (match-string 1 ref)) (setq new-header-args (match-string 3= ref)) (setq new-referent (match-string 5 ref)) (if (> ... 0) (progn ... ..= . ...)))) (if (string-match "^\\(.+\\):\\(.+\\)$" ref) (progn (setq split-f= ile (match-string 1 ref)) (setq split-ref (match-string 2 ref)) (find-file = split-file) (setq ref split-ref))) (save-excursion (save-restriction (widen= ) (goto-char (point-min)) (let* (... ... ...) (cond ... ... ...)))))))) (unwind-protect (progn (save-current-buffer (set-buffer (or org-babel-exp= -reference-buffer (current-buffer))) (save-excursion (let ((case-fold-searc= h t) args new-refere new-header-args new-referent split-file split-ref inde= x) (if (and (string-match "\\[\\([^\\[]+\\)\\]$" ref) (let ... ...)) (progn= (setq index ...) (setq ref ...))) (if (string-match "^\\(.+?\\)\\(\\[\\(.*= \\)\\]\\|\\(\\)\\)(\\(.*\\))$" ref) (progn (setq new-refere ...) (setq new-= header-args ...) (setq new-referent ...) (if ... ...))) (if (string-match "= ^\\(.+\\):\\(.+\\)$" ref) (progn (setq split-file ...) (setq split-ref ...)= (find-file split-file) (setq ref split-ref))) (save-excursion (save-restri= ction (widen) (goto-char ...) (let* ... ...))))))) (set-window-configuratio= n wconfig)) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (s= ave-current-buffer (set-buffer (or org-babel-exp-reference-buffer (current-= buffer))) (save-excursion (let ((case-fold-search t) args new-refere new-he= ader-args new-referent split-file split-ref index) (if (and ... ...) (progn= ... ...)) (if (string-match "^\\(.+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)(\\(.*= \\))$" ref) (progn ... ... ... ...)) (if (string-match "^\\(.+\\):\\(.+\\)$= " ref) (progn ... ... ... ...)) (save-excursion (save-restriction ... ... .= ..)))))) (set-window-configuration wconfig))) org-babel-ref-resolve("subtasks-table[2:-1]") --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSPXCedOQfhSlwpVw3IkZPY//z2fQUCWUoJRgAKCRDIkZPY//z2 fcWKAJkBjoz0bMkF1xMOoQHYkdQo9nrX2QCfR6y/X3+zq+lYrHS6lt5DPCBLXk4= =X+PC -----END PGP SIGNATURE----- --==-=-=--