emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <Rainer@krugs.de>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH]: BUG fix and Add header-args property to source block info
Date: Tue, 10 Feb 2015 14:39:34 +0100	[thread overview]
Message-ID: <m2y4o528dl.fsf@krugs.de> (raw)
In-Reply-To: <m2386e3zgv.fsf@krugs.de> (Rainer M. Krug's message of "Tue, 10 Feb 2015 10:09:04 +0100")


[-- Attachment #1.1: Type: text/plain, Size: 162 bytes --]

Please find attached the below described patch including the fix for the
error reported - function raises error when property value is numeric.

Cheers,

Rainer


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: Bugfix and added header-args --]
[-- Type: text/x-patch, Size: 1066 bytes --]

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")

[-- Attachment #1.3: Type: text/plain, Size: 2893 bytes --]



Rainer M Krug <Rainer@krugs.de> 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
> | 
> `----
>
> 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. 
>
> The same applir=es 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 
> cat(13+14)
> #+end_src
>
> * and here only code
> :PROPERTIES:
> :header-args+: exports code
> :END:
> #+begin_src R 
> 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' 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

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 494 bytes --]

  reply	other threads:[~2015-02-10 13:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10  9:09 [PATCH]: Add header-args property to source block info Rainer M Krug
2015-02-10 13:39 ` Rainer M Krug [this message]
2015-02-10 21:36   ` [PATCH]: BUG fix and " Nicolas Goaziou
2015-02-10 21:58     ` Rainer M Krug
2015-02-11 12:10       ` Alan Schmitt
2015-02-12  9:34         ` Rainer M Krug
2015-02-12  9:36       ` Rainer M Krug
2015-02-12 18:27         ` Charles C. Berry
2015-02-12 23:45         ` Nicolas Goaziou
2015-02-13  9:21           ` Rainer M Krug
2015-02-13  9:36             ` Sebastien Vauban
2015-02-13  9:51               ` Rainer M Krug
2015-02-10 17:58 ` [PATCH]: " Charles C. Berry
2015-02-10 20:54   ` Rainer M Krug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2y4o528dl.fsf@krugs.de \
    --to=rainer@krugs.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).