From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: [PATCH]: BUG fix and Add header-args property to source block info Date: Tue, 10 Feb 2015 14:39:34 +0100 Message-ID: References: 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]:45728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLB7i-0004rO-51 for emacs-orgmode@gnu.org; Tue, 10 Feb 2015 08:45:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLB7d-0003Re-18 for emacs-orgmode@gnu.org; Tue, 10 Feb 2015 08:45:06 -0500 Received: from mail-wg0-f45.google.com ([74.125.82.45]:33898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLB2S-00012C-At for emacs-orgmode@gnu.org; Tue, 10 Feb 2015 08:39:40 -0500 Received: by mail-wg0-f45.google.com with SMTP id x12so33372564wgg.4 for ; Tue, 10 Feb 2015 05:39:39 -0800 (PST) Received: from Rainers-MacBook-Pro.local ([2a01:e35:8baa:b070:d417:1a08:dd41:3cc0]) by mx.google.com with ESMTPSA id k1sm20826233wjn.9.2015.02.10.05.39.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Feb 2015 05:39:38 -0800 (PST) In-Reply-To: (Rainer M. Krug's message of "Tue, 10 Feb 2015 10:09:04 +0100") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Please find attached the below described patch including the fix for the error reported - function raises error when property value is numeric. Cheers, Rainer --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=add-header-args-to-output.diff Content-Description: Bugfix and added header-args diff --git a/lisp/ob-core.el b/lisp/ob-core.el index ceda1aa..aa39c11 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -409,12 +409,16 @@ a window into the `org-babel-get-src-block-info' function." (header-args (nth 2 info))) (when name (funcall printf "Name: %s\n" name)) (when lang (funcall printf "Lang: %s\n" lang)) + (funcall printf "Properties:\n") + (funcall printf "\t:header-args \t%s\n" (org-entry-get (point) "header-args" t)) + (funcall printf "\t:header-args:%s \t%s\n" lang (org-entry-get (point) (concat "header-args:" lang) t)) + (when (funcall full switches) (funcall printf "Switches: %s\n" switches)) (funcall printf "Header Arguments:\n") (dolist (pair (sort header-args (lambda (a b) (string< (symbol-name (car a)) (symbol-name (car b)))))) - (when (funcall full (cdr pair)) + (when (funcall full (format "%s" (cdr pair))) (funcall printf "\t%S%s\t%s\n" (car pair) (if (> (length (format "%S" (car pair))) 7) "" "\t") --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Rainer M Krug writes: > Hi > > Following a recent discussion (based on me forgetting a ":" when setting > the property :header-args), I added the output of the property > header-args to the output of org-babel-get-src-block-info to make > debugging easier. Before the function resulted in the following output > (using my faulty code block): > > ,---- > | Lang: R > | Header Arguments: > | :cache no > | :exports both > | :hlines no > | :noweb no > | :results code exports output replace > | :session somename > | :tangle no > |=20 > `---- > > One only saw that the property :results was not correct but not where it > came from. > > Using the patched version, one gets the following: > > ,---- > | Lang: R > | Properties: > | :header-args :exports both :results output exports code > | :header-args:R :session somename > | Header Arguments: > | :cache no > | :exports both > | :hlines no > | :noweb no > | :results code exports output replace > | :session somename > | :tangle no > `---- > > Here one can clearly see that the property :header-args is not set > correctly and can easily trace it down in the original org file. > > Also, actually seeing the property :header-args makes it easier to > understand the whole inheritance of header arguments and how header-args > and header-args+ interact.=20 > > The same applir=3Des to the property :header-args:R (or any language > specific header-args:language property) > > Cheers, > > Rainer > > > Here is again the faulty org file which lead to the patch: > > #+PROPERTY: header-args:R :session somename > #+PROPERTY: header-args :exports both > #+PROPERTY: header-args+ :results output > * The bug > This file create an (possibly endless?) loop during export > * here exports both > #+begin_src R=20 > cat(13+14) > #+end_src > > * and here only code > :PROPERTIES: > :header-args+: exports code > :END: > #+begin_src R=20 > paste(13+14) > #+end_src > diff --git a/lisp/ob-core.el b/lisp/ob-core.el > index ceda1aa..94a07f6 100644 > --- a/lisp/ob-core.el > +++ b/lisp/ob-core.el > @@ -409,6 +409,10 @@ a window into the `org-babel-get-src-block-info' fun= ction." > (header-args (nth 2 info))) > (when name (funcall printf "Name: %s\n" name)) > (when lang (funcall printf "Lang: %s\n" lang)) > + (funcall printf "Properties:\n") > + (funcall printf "\t:header-args \t%s\n" (org-entry-get (point) "heade= r-args" t)) > + (funcall printf "\t:header-args:%s \t%s\n" lang (org-entry-get (point= ) (concat "header-args:" lang) t)) > + > (when (funcall full switches) (funcall printf "Switches: %s\n" switch= es)) > (funcall printf "Header Arguments:\n") > (dolist (pair (sort header-args =2D-=20 Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJU2goWAAoJENvXNx4PUvmCQ3MH/0YPyXTKA3nIqJcqhLugX/qG Q6dHvuA19V0mJY3LtAJLW451hSgEn8w0QM8DtH5bwotaoxXa2+BiyYSMnG6NyOVA UrOsiISIRL59QGmysM+Dp4ojjJS2dddc+337iTwftJNCrW4wCARxUMme+gj9odw/ PD+VLiQNGX79+hCYWZC++2Pfq1GU50TY6pl58bjovr3hYd1zLoaasRJnYuIxuvK+ MSMjJ9uYBMsNAQtohd4SU46PMCsGo8FIYJtunM83gIcAhvlR0QHvgEO1JRyVv07p pVJFoFUVIHHQEZOvqwb09GB0tJrB7tJOR3U3ELOKI/WEdPHsGEGKYTzZTapdMJM= =u+XL -----END PGP SIGNATURE----- --==-=-=--