Re: [O] [PATCH]: Add header-args property to source block info

2015-02-10 Thread Rainer M Krug
"Charles C. Berry"  writes:

> On Tue, 10 Feb 2015, Rainer M Krug wrote:
>
>> 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.
> [snip]
>>
>> 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
>> |:exportsboth
>> |:hlines no
>> |:noweb  no
>> |:resultscode exports output replace
>> |:sessionsomename
>> |:tangle no
>> `
>>
>
> This is handy!
>
> Just a thought:
>
> Perhaps allow an `(interactive "P)' type `arg' to determine whether to
> present the properties?
>
> i.e. C-u C-c C-v C-i reveals both Properties: and Header Arguments:, while
> C-c C-v C-i just the latter.

Apart from having no idea how I can do this, I think it would add just
another layer of complexity which is actually not needed as this is just
an information to be assessed visually and not to be parsed by some
code - so I do not assume there are any backward compatibility issues.

Also, as the information presented is only relative small (20 lines
max?) it is still quite easy to see the original information.

If the patch would strip away information or add a huge amount of it, I
would completely agree with your suggestion, but as it stands, I see no
harm in leaving it as it is in the patch.

Cheers,

Rainer

>
> Best,
>
> Chuck
>
>

-- 
Rainer M. Krug
email: Rainerkrugsde
PGP: 0x0F52F982


signature.asc
Description: PGP signature


Re: [O] [PATCH]: Add header-args property to source block info

2015-02-10 Thread Charles C. Berry

On Tue, 10 Feb 2015, Rainer M Krug wrote:


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.

[snip]


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
|   :exportsboth
|   :hlines no
|   :noweb  no
|   :resultscode exports output replace
|   :sessionsomename
|   :tangle no
`



This is handy!

Just a thought:

Perhaps allow an `(interactive "P)' type `arg' to determine whether to 
present the properties?


i.e. C-u C-c C-v C-i reveals both Properties: and Header Arguments:, while
C-c C-v C-i just the latter.

Best,

Chuck



[O] [PATCH]: Add header-args property to source block info

2015-02-10 Thread Rainer M Krug
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
|   :exportsboth
|   :hlines no
|   :noweb  no
|   :resultscode exports output replace
|   :sessionsomename
|   :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
|   :exportsboth
|   :hlines no
|   :noweb  no
|   :resultscode exports output replace
|   :sessionsomename
|   :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:

--8<---cut here---start->8---
#+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
--8<---cut here---end--->8---

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: Rainerkrugsde
PGP: 0x0F52F982


signature.asc
Description: PGP signature