Re: [O] Problem with babel and R + lattice

2012-03-09 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/03/12 21:52, John Hendy wrote:
 Drat. I meant to add that when I run the code exactly as I have it from R 
 directly, it works. I
 literally copy and paste my org-mode babel block code line by line into a 
 terminal and obtain
 the proper output via tikz. *That's* the perplexing part. What would be 
 working directly from R
 and not from Org-mode?
 
 For reference, I've generated plenty of stuff just like this via 
 org-mode/babel. Come to think
 of it, even another lattice plot.
 
 Not sure how to pinpoint what's goofy about this specific plot.
 
 John
 
 On Thu, Mar 8, 2012 at 2:40 PM, John Hendy jw.he...@gmail.com wrote:
 I have an R block like so:
 
 #+begin_src R
 
 library(lattice) library(tikzDevice)
 
 =bunch of code=
 
 barchart(side$name~side$x2,groups=side$type,horiz=T, 
 xlim=c(0,0.75),col=c(lightblue,yellow),xlab=Product Performance 
 (2-box))
 
 dev.off() tools::texi2dvi(bar-2b.tex,pdf=T)
 
 #+end_src
 
 The resultant tex file is empty where the tikz code should be and texi2dvi 
 fails. Any
 suggestions? If I change my plot to base graphics with barplot, it works. 
 I'm thinking this
 is a lattice/babel issue?

As with ggplot, you have to print your plot (if I remember correctly), i.e:

print(barchart(...))

Cheers,

Rainer

 
 
 Thanks for any input, John
 


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys.
(Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9ZwlcACgkQoYgNqgF2egqMewCfar+JxC9uV9p1O2IYVVYcqyeM
7/4AnRLp8gYqSDe/74D9helafqNR5Vgt
=aDVb
-END PGP SIGNATURE-



Re: [O] Org-mode workshop: has anyone done this already?

2012-03-09 Thread Bernard H .
Eric Schulte eric.schulte at gmx.com writes:

 Later this month I will be giving a talk on the use of code blocks in
 Org-mode.  I haven't yet begun preparing the slides, but when I do they
 will live at https://github.com/eschulte/babel-presentation.
 
 Cheers,
 

Great !
Where will it take place ? Is it possible to attend ?
Will you be video recording it ?

Best Regards,

Bernard





Re: [O] worg latex example 11 Styling the Frontmatter

2012-03-09 Thread Myles English
 On Thu, 08 Mar 2012 18:20:10 -1000, Thomas S Dye said:

   Hi Myles, Thanks for making me look more closely at this.  There are
   two things:

   1) #+BEGIN_abstract ... #+END_abstract requires org-special-blocks.
   So,

   2) The abstract text ends up in the title because there is no export
   option template at the top of your org file.  With point at the
   start of the buffer, C-c C-e t.

That's solved it, thanks very much!  Turn out that the whole export
option template is not needed; just the #+TITLE: piece.

Myles



Re: [O] Problem loading a symlink'ed file in Emacs batch

2012-03-09 Thread Sebastien Vauban
Hi Achim,

Achim Gratz wrote:
 If you are using NTemacs rather than the one supplied by Cygwin it simply
 doesn't know about symlinks.

I was using an official GNU Emacs binary for Windows (found on
http://alpha.gnu.org/gnu/emacs/windows/).

Anyway, switching to Cygwin Emacs does resolve the symlink problem. Thanks a
lot for your answer!

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] Bug: 3 bugs and 2 proposals on ascii/html export [7.8.03]

2012-03-09 Thread Gustav Wikström



 For me, it makes a lot of sense to invert both, as Mathias is suggesting
 it.


+1

It would conform more to a sort of standard that way, (see
http://en.wikipedia.org/wiki/Lightweight_markup_language#Section_headers)


 Best regards,
  Seb

 --
 Sebastien Vauban



/Gustav


Re: [O] Org-mode workshop: has anyone done this already?

2012-03-09 Thread Eric Schulte
Bernard H. un.compte.pour.tes...@gmail.com writes:

 Eric Schulte eric.schulte at gmx.com writes:

 Later this month I will be giving a talk on the use of code blocks in
 Org-mode.  I haven't yet begun preparing the slides, but when I do they
 will live at https://github.com/eschulte/babel-presentation.
 
 Cheers,
 

 Great !
 Where will it take place ?

On March 25th in Albuquerque New Mexico at the monthly meeting of the
Albuquerque Lisp/Scheme user group.

 Is it possible to attend ?

I would like to check with the group, but I am almost certain they
wouldn't mind extra attendees.

 Will you be video recording it ?


I have not previously been to an ABQ Lisp/Scheme meeting so I do not
know what their setup will be, but it sounds rather informal (a small
group many of which are already Org-mode literate) so my guess is that
it will not be video taped.  We may spend more time interactively
working through usage examples rather than sticking to a presentation
format.


 Best Regards,

 Bernard




-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] [Babel] : Bug in org-tangle with :comments, patch included

2012-03-09 Thread Eric Schulte
Applied. Thanks,

aditya siram aditya.si...@gmail.com writes:

 Hi all,
 When I tangle a source block with :comments yes any spaces in the
 sub-heading in which the block is found are replaced with %2520
 instead of %20. As a consequence when I org-babel-detangle the
 correct heading is not found.

 As an example given the following org file:
 * Babel Tangling
 ** Test Source 1
#+begin_src c :tangle /tmp/source1.txt :comments yes
nothing
#+end_src

 running org-babel-tangle generates the following source:
 /* [[file:~/WorkingFiles/Org.org::*Test%2520Source%25201][Test-Source-1:1]] */

 nothing

 /* Test-Source-1:1 ends here */

 The problem is in the org-babel-spec-to-string function which takes
 the correctly escaped link generated by org-store-link:
  [[file:~/WorkingFiles/Org.org::*Test%20Source%201][Test-Source-1:1]]
 and escapes it again with org-link-escape which yielding the erroneous:
  [[file:~/WorkingFiles/Org.org::*Test%2520Source%25201][Test-Source-1:1]].

 I have included a patch that removes the call to org-link-escape and
 that fixes it on my machine. A grep of my current source tree shows
 that org-babel-spec-to-string is only called from
 org-babel-tangle. I don't know if any other contribs are using this
 function.

 -deech

 From 249f60fe17913db08f81bca40d12e114f66db4b6 Mon Sep 17 00:00:00 2001
 From: Deech deech@deech-ThinkPad-X200.(none)
 Date: Thu, 8 Mar 2012 13:25:14 -0600
 Subject: [PATCH 3/3] The link generated by org-store-link is escaped twice 
 when tangling with :comments yes flag.

 ---
  lisp/ob-tangle.el |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
 index 15c0518..e629c12 100644
 --- a/lisp/ob-tangle.el
 +++ b/lisp/ob-tangle.el
 @@ -381,7 +381,7 @@ form
(start-line file link source-name params body comment)
(let* ((start-line (nth 0 spec))
(file (nth 1 spec))
 -  (link (org-link-escape (nth 2 spec)))
 +  (link (nth 2 spec))
(source-name (nth 3 spec))
(body (nth 5 spec))
(comment (nth 6 spec))

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Problem with babel and R + lattice

2012-03-09 Thread John Hendy
On Fri, Mar 9, 2012 at 2:41 AM, Rainer M Krug r.m.k...@gmail.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 08/03/12 21:52, John Hendy wrote:
 Drat. I meant to add that when I run the code exactly as I have it from R 
 directly, it works. I
 literally copy and paste my org-mode babel block code line by line into a 
 terminal and obtain
 the proper output via tikz. *That's* the perplexing part. What would be 
 working directly from R
 and not from Org-mode?

 For reference, I've generated plenty of stuff just like this via 
 org-mode/babel. Come to think
 of it, even another lattice plot.

 Not sure how to pinpoint what's goofy about this specific plot.

 John

 On Thu, Mar 8, 2012 at 2:40 PM, John Hendy jw.he...@gmail.com wrote:
 I have an R block like so:

 #+begin_src R

 library(lattice) library(tikzDevice)

 =bunch of code=

 barchart(side$name~side$x2,groups=side$type,horiz=T,
 xlim=c(0,0.75),col=c(lightblue,yellow),xlab=Product Performance 
 (2-box))

 dev.off() tools::texi2dvi(bar-2b.tex,pdf=T)

 #+end_src

 The resultant tex file is empty where the tikz code should be and texi2dvi 
 fails. Any
 suggestions? If I change my plot to base graphics with barplot, it works. 
 I'm thinking this
 is a lattice/babel issue?

 As with ggplot, you have to print your plot (if I remember correctly), i.e:

 print(barchart(...))

I stumbled on this, too but hadn't posted back to the list yet. What
got me on the track to the solution was copying my babel block code
into an R source file and trying to do =  source(path/to/file)=
directly from R. That wasn't working either, so I knew it was
something I was doing and not org. I found the R faq which said that
source files don't generate output for everything unless you tell them
to print() :)

Thanks!
John



 Cheers,

 Rainer



 Thanks for any input, John



 - --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
 UCT), Dipl. Phys.
 (Germany)

 Centre of Excellence for Invasion Biology
 Stellenbosch University
 South Africa

 Tel :       +33 - (0)9 53 10 27 44
 Cell:       +33 - (0)6 85 62 59 98
 Fax :       +33 - (0)9 58 10 27 44

 Fax (D):    +49 - (0)3 21 21 25 22 44

 email:      rai...@krugs.de

 Skype:      RMkrug
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAk9ZwlcACgkQoYgNqgF2egqMewCfar+JxC9uV9p1O2IYVVYcqyeM
 7/4AnRLp8gYqSDe/74D9helafqNR5Vgt
 =aDVb
 -END PGP SIGNATURE-



Re: [O] org tables

2012-03-09 Thread John Hendy
On Thu, Mar 8, 2012 at 8:20 PM, Peter Salazar cycleofs...@gmail.com wrote:
 Hey everyone,

 Is there a way to get org to wrap text within a table cell? I want to be
 able to enter long text entries into cells without expanding column width.

 Also, is there a way to merge cells—say, three cells vertically?

I don't think you can do this via org. Whenever I have tables of any
complexity, I end up doing them manually with tabular inside a
#+begin_latex section. If you find a solution, I'd love to hear it!
Perhaps there's a quicker way of using org-table placeholders and then
doing some quick tweak to the .tex file generated rather than me doing
the whole thing in LaTeX.


Good luck,
John


 Finally, orgtbl-mode is broken in markdown-mode. Does anyone know a
 solution?

 Thanks,
 Pater



[O] Another gsoc idea -- ragel

2012-03-09 Thread Rustom Mody
Ragel http://www.complang.org/ragel/ is a tool that integrates regular
expressions and state machines under one umbrella.
It has backends currently for C, C++, Objective-C, D, Java and Ruby.  I do
not think having an elisp backend would be a very big task.

After that (in my estimate) org-mode code would (could) become half as long
and twice as fast -- at least those sections that are heavily regex oriented


Re: [O] Another gsoc idea -- ragel

2012-03-09 Thread Thorsten
Rustom Mody rustompm...@gmail.com writes:

 Ragel http://www.complang.org/ragel/ is a tool that integrates regular
 expressions and state machines under one umbrella.
 It has backends currently for C, C++, Objective-C, D, Java and Ruby. 
 I do not think having an elisp backend would be a very big task.

 After that (in my estimate) org-mode code would (could) become half as
 long and twice as fast -- at least those sections that are heavily
 regex oriented

I took the freedom to add your (slightly modified) proposal to the GSoC
2012 ideas page:
http://orgmode.org/worg/org-contrib/gsoc2012/orgmode-gsoc2012-ideas.html

-- 
cheers,
Thorsten




Re: [O] Bug: 3 bugs and 2 proposals on ascii/html export [7.8.03]

2012-03-09 Thread Gregor Zattler
Hi Gustav,
* Gustav Wikström gustav.e...@gmail.com [09. Mar. 2012]:
 For me, it makes a lot of sense to invert both, as Mathias is suggesting
 it.

 +1
+1
 
 It would conform more to a sort of standard that way, (see
 http://en.wikipedia.org/wiki/Lightweight_markup_language#Section_headers)

We did it this way on mechanical typewriters.

Fred Flintstone



[O] Refile clear-cache after refiling to new headline?

2012-03-09 Thread Nathan Neff
I have org-refile-use-cache set.

I refile a headline to foo.org/foo which doesn't exist yet.

I'm prompted to create foo headline.  I accept.

Then, I refile another note to foo.org/foo

foo.org/foo appears as the default refile location in the mini-buffer.
So far so good.  I press Enter.

But now, I'm prompted again to create foo headline.  I accept, and
now foo.org has two foo headlines.

Is this correct behavior?

Of course, if I run C-0 C-x C-w then the foo headline is accepted
without a prompt.

It seems like org-mode didn't need to have the cache refreshed if
you added a new headline by using org-refile.  Am I just imagining things?

Thanks,
-Nate



Re: [O] Another gsoc idea -- ragel

2012-03-09 Thread Eric Schulte
Thorsten quintf...@googlemail.com writes:

 Rustom Mody rustompm...@gmail.com writes:

 Ragel http://www.complang.org/ragel/ is a tool that integrates regular
 expressions and state machines under one umbrella.
 It has backends currently for C, C++, Objective-C, D, Java and Ruby. 
 I do not think having an elisp backend would be a very big task.

 After that (in my estimate) org-mode code would (could) become half as
 long and twice as fast -- at least those sections that are heavily
 regex oriented

 I took the freedom to add your (slightly modified) proposal to the GSoC
 2012 ideas page:
 http://orgmode.org/worg/org-contrib/gsoc2012/orgmode-gsoc2012-ideas.html

Perhaps related to this proposal would be a project to formally specify
Org-mode's syntax.  I'm thinking this could be an extension of the truly
remarkable formalization work recently undertaken by Nicolas in support
of his Org-mode AST representation and exporter, but with more of a
focus on specification in such a way as to facilitate developing
Org-mode parsers in other languages, be they Ragel, OCaml [1], VIM [2],
Haskell (e.g., pandoc [3]), or scripting languages to allow exporting
without Emacs (e.g., a replacement for org-ruby [4]) for use at github,
wikis or any website in which Emacs is too large of a dependency.

Cheers,

Footnotes: 
[1]  http://thread.gmane.org/gmane.emacs.orgmode/52736

[2]  http://www.vim.org/scripts/script.php?script_id=3342

[3]  http://johnmacfarlane.net/pandoc/

[4]  http://orgmode.org/worg/org-tutorials/org-ruby.html

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Participating in Google Summer of Code 2012

2012-03-09 Thread Nicolas Goaziou
Hello,

Jambunathan K kjambunat...@gmail.com writes:

 Can the org-export driver make listified headings transparent to the
 backend? 

I am reluctant to fake data presented to transcoders. I am even more
reluctant when some information is lost in the process. A back-end might
need to tell the difference between an headline that should be treated
as a list and a regular list. For example some back-end with weak list
concept (limited in the types of objects lists can contain) would rather
not turn headlines into items.

Currently, the exporter API is more oriented towards showing full info,
and giving clues on how to handle it.

 Currently listified headings are handled within org-e-backend-headline
 through first-sibling and last sibling checks and the backends *do
 know* that it is handling a headline in a special way.

 If you have reservations in considering the above request, I believe
 handling of indented tables will be fragmented across plain-list/item
 callbacks and headline callbacks. 

This is a back-end specific limitation. I guess it is unavoidable.

Though, if you think about a generic tool that could reduce the amount
of work required, I will include it in org-export.el.


Regards,

-- 
Nicolas Goaziou



[O] Babel Python sessions severely broken

2012-03-09 Thread Jacek Generowicz
Hi,

Picking up a few-month-old thread ...

On Tue, 21 Jun 2011 10:26:17 -0700, Eric Schulte wrote:

 You are suggesting that code to be run interactively should be written
 to an external file then loaded into the interactive session.  This
 would certainly work around the syntax limitation of the current setup.
 My two concerns here are that
 
 1. users who use interactive babel blocks side-by-side with the session
may be used jumping into the session to play with code interactively
and debug, in such cases rather than seeing their code in the session
history they would only see execfile('/tmp/blahblah').

This is (almost) exactly what Emacs' python mode does, so I suspect
that many people who wish to work in this way, would be very familiar
with this state of affairs.

Actually, In modern python modes (Emacs 23, 24, maybe even 22) no clue
about any code having been injected into the session appars at all:
instead of seeing execfile(/'tmp/blah') they see nothing at all. I
think that IPyton's emacs-python-mode, might visually inject the whole
evaluated code into the session buffer. 

Note I do recall discussion on list related to user's reading
their session code in the inferior session buffer.

I'd say that that interacting with their code in the session buffer is
more important than reading it there (on the grounds of this being the
usual python-mode workflow), but reading it there could be good too.

 2. similarly error messages would now point into this temporary file,
rather than back into the session history

Yes, this is what happens in current python modes, but M-g M-n and M-g
M-p usually manage to send you to the correct place (i.e. your genuine
source file, rather than the temporary file) anyway.

To see this in action:

1. (In Emacs 23 or 24) Create the following buffer

,[ foo.py ]
| print 1
| print 1/0
| print 2
`
   
2. Ensure that Python mode is enabled for the buffer (Emacs should
   have switched it on automatically, by observing the .py extension.)

3. C-c C-z (This should start an inferior Python process, and switch
   to its buffer.)

4. Go back to the foo.py buffer

5. C-c C-c (This should evaluate the whole buffer)

   The inferior Python buffer should now show something like

,[ *Python* ]
|  1
| Traceback (most recent call last):
|   File /tmp/py79095qL, line 2, in module
| print 1/0
| ZeroDivisionError: integer division or modulo by zero
|  
`

6. M-g M-n (This should jump to line 2 in the foo.py buffer)

Maybe some of the stuff that's already in python-mode can be reused ?

 Basically you would prefer more decoupling from the interpreter

I would prefer it to be useable for evaluating normally formatted
Python code. In its current state it isn't. That makes it pretty much
unuseable for literal programming, creating documentation, tutorials,
etc.

I don't understand what you mean by more decoupling from the
interpreter. Do you mean overcoming Python's standard REPL's
inability to receive copy-pasted standard Pyton code?. I think that
would be a *very* worthwhile thing to support, which is why pretty
much anything that pretends to support Python interactivity, goes out
of its way to make it possible (Emacs' python-mode, IPython, IDLE are
a few obvious examples that come to mind.)

 and I'm not sure for the average user if this would be a worthwhile
 exchange simply to be able to avoid syntax errors like your
 originally mentioned example (which was the first such post I've
 seen on this list).

The current situation essentially makes Python babel sessions unusable
for anything but the most trivial cases. (Or it makes non-trivial use
possible at the cost of presening code in a horribly formatted style,
one which would be a horror to read.)

 I'm disinclined to make such a change without a wider base of support
 for the request from the Babel/Python user community

Please, please, make it possible to evaluate normal Python code in
Python babel sessions.

It's really important to understand that the restrictions imposed by
Python's plain REPL really are a horrible quirk: I can't imagine
anyone preferring the broken (if standard) behaviour, over correct
behaviour.

Put another way: You won't find many people who take Python
interactivity seriously, using the standard REPL. They all use
something that gets around the horrible restrictions it
imposes. Nobody wants this.

 or at least without more complaints about the existing behavior.

Please consider this to be a *vehement* complaint about the existing
behaviour. :-)

(I'd be happy to try to contribute some code to this, but I won't have
any time to think about it for, at least, the next 3 weeks.)




[O] android mobileorg: next week in agenda

2012-03-09 Thread Renato
Hello, wasn't able to find an answer to this. Is it possible in
the Android MobileOrg version, when viewing agenda, to go to next or
previous week? I'm using version 0.8.3

best wishes,
renato



[O] [OT] Pipe mouse-highlight to FestivalLite/flite

2012-03-09 Thread brian powell
* Does anyone know how to pipe Link: http://orgmode.org; highlighted text
to flite

** Maybe a hook?

(add-hook 'org-occur-highlights 'etc...

** I mean: I'm trying to get the mouse-highlight text that pops-up sent to
flite--FestivalLite---then text-to-speech would be done---emacs could
literally tell me what the OrgMode LINK:... is.

*** To me, this could be used when the lights go out/turned screen off; for
others, say if you're blind, it may be useful as a simple way to announce a
link in an OrgMode buffer--before running it/going to the link.

 I'm familiar with emacspeak and speechd-el (
http://devel.freebsoft.org/speechd-el and http://emacspeak.sourceforge.net)
but both of these have many dependencies etc.--flite is quick and
easy to install:

apt-get install flite


[O] Pipe mouse-highlight to FestivalLite/flite

2012-03-09 Thread brian powell
* Does anyone know how to pipe Link: http://orgmode.org; highlighted text
to flite

** Maybe a hook?

(add-hook 'org-occur-highlights 'etc...

** Trying to get the mouse-highlight text that pops-up sent to
flite--FestivalLite---then text-to-speech would be done---emacs could
literally tell me what the OrgMode LINK:... is.

*** This could be used when the lights go out/turned screen off; for
others, say if you're blind, it may be useful as a simple way to announce a
link in an OrgMode buffer--before running it/going to the link.

 Familiar with emacspeak and speechd-el
http://devel.freebsoft.org/speechd-el
and
http://emacspeak.sourceforge.net

* Both of these have many dependencies etc.--'flite is quick and easy
to install:

apt-get install flite


Re: [O] Babel Python sessions severely broken

2012-03-09 Thread Eric Schulte
Jacek Generowicz jacek.generow...@cern.ch writes:

 Hi,

 Picking up a few-month-old thread ...

 On Tue, 21 Jun 2011 10:26:17 -0700, Eric Schulte wrote:

 You are suggesting that code to be run interactively should be written
 to an external file then loaded into the interactive session.  This
 would certainly work around the syntax limitation of the current setup.
 My two concerns here are that
 
 1. users who use interactive babel blocks side-by-side with the session
may be used jumping into the session to play with code interactively
and debug, in such cases rather than seeing their code in the session
history they would only see execfile('/tmp/blahblah').

 This is (almost) exactly what Emacs' python mode does, so I suspect
 that many people who wish to work in this way, would be very familiar
 with this state of affairs.

 Actually, In modern python modes (Emacs 23, 24, maybe even 22) no clue
 about any code having been injected into the session appars at all:
 instead of seeing execfile(/'tmp/blah') they see nothing at all. I
 think that IPyton's emacs-python-mode, might visually inject the whole
 evaluated code into the session buffer. 

Note I do recall discussion on list related to user's reading
their session code in the inferior session buffer.

 I'd say that that interacting with their code in the session buffer is
 more important than reading it there (on the grounds of this being the
 usual python-mode workflow), but reading it there could be good too.

 2. similarly error messages would now point into this temporary file,
rather than back into the session history

 Yes, this is what happens in current python modes, but M-g M-n and M-g
 M-p usually manage to send you to the correct place (i.e. your genuine
 source file, rather than the temporary file) anyway.

 To see this in action:

 1. (In Emacs 23 or 24) Create the following buffer

 ,[ foo.py ]
 | print 1
 | print 1/0
 | print 2
 `

 2. Ensure that Python mode is enabled for the buffer (Emacs should
have switched it on automatically, by observing the .py extension.)

 3. C-c C-z (This should start an inferior Python process, and switch
to its buffer.)

 4. Go back to the foo.py buffer

 5. C-c C-c (This should evaluate the whole buffer)

The inferior Python buffer should now show something like

 ,[ *Python* ]
 |  1
 | Traceback (most recent call last):
 |   File /tmp/py79095qL, line 2, in module
 | print 1/0
 | ZeroDivisionError: integer division or modulo by zero
 |  
 `

 6. M-g M-n (This should jump to line 2 in the foo.py buffer)

 Maybe some of the stuff that's already in python-mode can be reused ?

 Basically you would prefer more decoupling from the interpreter

 I would prefer it to be useable for evaluating normally formatted
 Python code. In its current state it isn't. That makes it pretty much
 unuseable for literal programming, creating documentation, tutorials,
 etc.

 I don't understand what you mean by more decoupling from the
 interpreter. Do you mean overcoming Python's standard REPL's
 inability to receive copy-pasted standard Pyton code?. I think that
 would be a *very* worthwhile thing to support, which is why pretty
 much anything that pretends to support Python interactivity, goes out
 of its way to make it possible (Emacs' python-mode, IPython, IDLE are
 a few obvious examples that come to mind.)

 and I'm not sure for the average user if this would be a worthwhile
 exchange simply to be able to avoid syntax errors like your
 originally mentioned example (which was the first such post I've
 seen on this list).

 The current situation essentially makes Python babel sessions unusable
 for anything but the most trivial cases. (Or it makes non-trivial use
 possible at the cost of presening code in a horribly formatted style,
 one which would be a horror to read.)

 I'm disinclined to make such a change without a wider base of support
 for the request from the Babel/Python user community

 Please, please, make it possible to evaluate normal Python code in
 Python babel sessions.

 It's really important to understand that the restrictions imposed by
 Python's plain REPL really are a horrible quirk: I can't imagine
 anyone preferring the broken (if standard) behaviour, over correct
 behaviour.

 Put another way: You won't find many people who take Python
 interactivity seriously, using the standard REPL. They all use
 something that gets around the horrible restrictions it
 imposes. Nobody wants this.

 or at least without more complaints about the existing behavior.

 Please consider this to be a *vehement* complaint about the existing
 behaviour. :-)

 (I'd be happy to try to contribute some code to this, but I won't have
 any time to think about it for, at least, the next 3 weeks.)


Alright, I abhor python myself and played very little role in developing
the current python support and thus have no personal opinion on the
matter.  I think the sentiment in 

Re: [O] org babel execute shell in sh?

2012-03-09 Thread Panruo Wu
Thanks tom! This is exactly what I need.

regards,
robb

On Wed, Mar 7, 2012 at 9:24 PM, Tom Regner t...@goochesa.de wrote:

 Hi,

 Panruo Wu p...@mymail.mines.edu writes:

  Dear list,
 
 
  #+begin_src sh
  for np in {1..32}
  do
  echo $np
  done
  #+end_src
 
  when executing, the output only shows
  {1..32}
  which is clearly not I want..
 
  After some investigation, I found that orgmode
  uses sh that cannot understand the for loop above.
 
  My question is, how can I suggest orgmode to use
  bash to execute shell script?
 
  I tried :shebang #!/bin/bash but it does not work

 I have the following in my config:

 %--
  I really like org-babel to use zsh
  #+begin_src emacs-lisp
(setq org-babel-sh-command zsh)
  #+end_src
 %--

 It is apparently not possible to set this variable via #+BIND: to only
 change this for one code block, at least I did not succeed to do so in
 my attempts to do so -- but maybe I just didn't read enough of the
 documentation to /get it right/.

 I don't know, if zsh||bash instead of sh breaks any assumptions org-mode
 makes about the environment in which sh code blocks are executed; up
 until now it works like a charm.

 Kind regards,
 Tom



Re: [O] Date-tree navigation question

2012-03-09 Thread Martin Pohlack
Hi Robert,

Not sure what you want to do after opening but I have some code that
extracts a time range out of a date tree.  Maybe you can reuse the
searching parts ...

Cheers,
Martin

--
(defun mp26/org-find-headline-prefix-in-buffer (heading optional buffer 
pos-only)
  Find node with heading-prefix HEADING in BUFFER.
Return a marker to the heading if it was found, or nil if not.
If POS-ONLY is set, return just the position instead of a marker.

The heading prefix must match as prefix of the full headline.  It
may have a TODO keyword, a priority cookie and tags in the
standard locations.
  (with-current-buffer (or buffer (current-buffer))
(save-excursion
  (save-restriction
(widen)
(goto-char (point-min))
(let (case-fold-search)
  (if (re-search-forward
   (format org-complex-heading-regexp-format
   (concat (regexp-quote heading) .*)) nil t)
  (if pos-only
  (match-beginning 0)
(move-marker (make-marker) (match-beginning 0)

(defun mp26/org-week-from-journal ()
  Insert a copy of the current week from the journal.
  (interactive)
  (insert
   (mapconcat
'identity
(with-current-buffer Journal.orgDaten
  (loop for days in '(-6 -5 -4 -3 -2 -1 0)
collect
(let* ((date (calendar-current-date days))
   (date-string
(format %d-%02d-%02d
(nth 2 date) (nth 0 date) (nth 1 date
  (setq pos (mp26/org-find-headline-prefix-in-buffer
 date-string nil t))
  (when pos
(goto-char pos)
(org-copy-subtree)
(car kill-ring)
   )))
--



Re: [O] Babel Python sessions severely broken

2012-03-09 Thread Jacek Generowicz
At Fri, 9 Mar 2012 13:31:05 -0700,
Eric Schulte wrote:

 I look forward to upcoming patches.

I've not dug around the implementation of babel before. Any pointers
on where to start?



Re: [O] Babel Python sessions severely broken

2012-03-09 Thread Eric Schulte
Jacek Generowicz jacek.generow...@cern.ch writes:

 At Fri, 9 Mar 2012 13:31:05 -0700,
 Eric Schulte wrote:

 I look forward to upcoming patches.

 I've not dug around the implementation of babel before. Any pointers
 on where to start?


Sure,

The best place to look at is existing lisp/ob-*.el files both for Python
itself and other languages.  These provide examples of how to deal with
nearly every session execution contingency.  The lisp/ob-comint.el file
provides functions which abstract away some of the hairy details of
working with session comint buffer.

Largely I would hope that you'll have to spend more time with the python
library which will be performing the evaluation, rather than with the
related Org-mode functions.

On the more general elisp dev side of things, one hint which I find
useful when exploring the workings of new code is edebug, which allows
single-stepping through the evaluation of a function.

Thanks, please do let me know if I can help with advice or explanation,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Bug: 3 bugs and 2 proposals on ascii/html export [7.8.03]

2012-03-09 Thread Ivy Foster
On 09 Mar 2012, at  3:09 am +0100, Bastien wrote:
 Mathias Bauer mba...@gmx.org writes:
  As default, all level 1 headlines are underlined by -
  characters and level 2 headlines with =. Wouldn't it be
  more logical the other way round

 Unless many users think this is illogical, I won't change
 the default.

Personally, I tend to agree with Mathias here. Maybe it's
just because I like Markdown, but the `=' underline just
feels like stronger emphasis to me. (Of course, I keep
meaning to write a Markdown exporter, but also keep putting
it off, so there you go.)

Ivy



[O] add binding to org-babel-goto-named-src-block

2012-03-09 Thread Daimrod

Hi,
many functions in org-babel are bound to a letter X and C-X, it would be
nice if it was the case for org-babel-goto-named-src-block.

Here is a trivial patch.

diff --git a/lisp/ob-keys.el b/lisp/ob-keys.el
index cc11343..759bef3 100644
--- a/lisp/ob-keys.el
+++ b/lisp/ob-keys.el
@@ -60,7 +60,6 @@ functions which are assigned key bindings, and see
 (u . org-babel-goto-src-block-head)
 (\C-u . org-babel-goto-src-block-head)
 (g . org-babel-goto-named-src-block)
-(\C-g . org-babel-goto-named-src-block)
 (r . org-babel-goto-named-result)
 (\C-r . org-babel-goto-named-result)
 (\C-b . org-babel-execute-buffer)


[O] Blank first line in a tangled file prevents src block execution

2012-03-09 Thread Leo Alekseyev
I have the following source block that I tangle to produce a short script:

#+begin_src sh :tangle code/get_wavs.sh
  #!/bin/bash
  for fn_in in $@; do
  fn_out=$(sed -e 's|\.3gp$||g' -e 's|$|.wav|g'  $fn_in)
  ffmpeg -i $fn_in -vn -f wav -acodec pcm_u8 $fn_out
  done
#+end_src

However, the tangled file has a blank first line.  As a result, I
can't seem to run this script either using sh -c, or by putting it
inside a code block.  In other words, the following line fails:

sh -c code/test.sh data/salsa/20120308_av_jc/song2/*.3gp
code/test.sh: 4: Syntax error: redirection unexpected

And, similarly, this fails

#+begin_src sh
  code/get_wavs.sh data/salsa/20120308_av_jc/song2/*.3gp
#+end_src


On the other hand, the script runs fine from the command line, or from
an org-mode shell: link, i.e. just running

code/test.sh data/salsa/20120308_av_jc/song2/*.3gp

at bash prompt produces the desired result.


I am not sure what the rules are about blank lines before the
hash-bang directive in Bash, and why in particular the blank line
seems to cause sh -c ... and orb-babel src execution to break, but the
current behavior seems broken.



Re: [O] Blank first line in a tangled file prevents src block execution

2012-03-09 Thread Nick Dokos
Leo Alekseyev dnqu...@gmail.com wrote:

 I have the following source block that I tangle to produce a short script:
 
 #+begin_src sh :tangle code/get_wavs.sh
   #!/bin/bash
   for fn_in in $@; do
   fn_out=$(sed -e 's|\.3gp$||g' -e 's|$|.wav|g'  $fn_in)
   ffmpeg -i $fn_in -vn -f wav -acodec pcm_u8 $fn_out
   done
 #+end_src
 
 However, the tangled file has a blank first line.  As a result, I
 can't seem to run this script either using sh -c, or by putting it
 inside a code block.  In other words, the following line fails:
 

Add :padline no

Nick



Re: [O] Blank first line in a tangled file prevents src block execution

2012-03-09 Thread Eric Schulte
Nick Dokos nicholas.do...@hp.com writes:

 Leo Alekseyev dnqu...@gmail.com wrote:

 I have the following source block that I tangle to produce a short script:
 
 #+begin_src sh :tangle code/get_wavs.sh
   #!/bin/bash
   for fn_in in $@; do
   fn_out=$(sed -e 's|\.3gp$||g' -e 's|$|.wav|g'  $fn_in)
   ffmpeg -i $fn_in -vn -f wav -acodec pcm_u8 $fn_out
   done
 #+end_src
 
 However, the tangled file has a blank first line.  As a result, I
 can't seem to run this script either using sh -c, or by putting it
 inside a code block.  In other words, the following line fails:
 

 Add :padline no


Or try

#+begin_src sh :tangle code/get_wavs.sh :shebang #!/bin/bash
  for fn_in in $@; do
  fn_out=$(sed -e 's|\.3gp$||g' -e 's|$|.wav|g'  $fn_in)
  ffmpeg -i $fn_in -vn -f wav -acodec pcm_u8 $fn_out
  done
#+end_src

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Blank first line in a tangled file prevents src block execution

2012-03-09 Thread Nick Dokos
Eric Schulte eric.schu...@gmx.com wrote:

 Or try
 
 #+begin_src sh :tangle code/get_wavs.sh :shebang #!/bin/bash
   for fn_in in $@; do
   fn_out=$(sed -e 's|\.3gp$||g' -e 's|$|.wav|g'  $fn_in)
   ffmpeg -i $fn_in -vn -f wav -acodec pcm_u8 $fn_out
   done
 #+end_src
 

That reminds me: I believe shebang is used in tangling, but not in evaluation.
Assuming that's correct, is there any fundamental reason for it not being used
in evaluation?

Panruo Wu's question in another thread ( 
http://thread.gmane.org/gmane.emacs.orgmode/53157 )
brought this to mind.

Thanks,
Nick



Re: [O] org babel execute shell in sh?

2012-03-09 Thread Nick Dokos
Tom Regner t...@goochesa.de wrote:

 Hi,
 
 Panruo Wu p...@mymail.mines.edu writes:
 
  Dear list,
 
 
  #+begin_src sh=C2=A0
  for np in {1..32}
  do
  =C2=A0 =C2=A0 echo $np
  done
  #+end_src
 
  when executing, the output only shows
  {1..32}
  which is clearly not I want..
 
  After some investigation, I found that orgmode
  uses sh that cannot understand the for loop above.
 
  My question is, how can I suggest orgmode to use
  bash to execute shell script?
 
  I tried :shebang #!/bin/bash but it does not work
 
 I have the following in my config:
 
 %--
   I really like org-babel to use zsh
   #+begin_src emacs-lisp
 (setq org-babel-sh-command zsh)
   #+end_src
 %--
 
 It is apparently not possible to set this variable via #+BIND: to only
 change this for one code block, at least I did not succeed to do so in
 my attempts to do so -- but maybe I just didn't read enough of the
 documentation to /get it right/.
 

You are right that it is not possible: #+BIND is effective only when you
are exporting - basically, people wanted to change various setting on
export, and adding options for each and every one was too much, so
Carsten implemented BIND as a general mechanism for that. But it does
not apply to anything else; in particular, code block evaluation is
completely separate.

But you can use general emacs mechanisms to set it for a particular file:
that's what file local variables are all about:

(info (emacs)Local Variables in Files)

Nick

 I don't know, if zsh||bash instead of sh breaks any assumptions org-mode
 makes about the environment in which sh code blocks are executed; up
 until now it works like a charm.
 
 Kind regards,
 Tom
 



Re: [O] Bug: 3 bugs and 2 proposals on ascii/html export [7.8.03]

2012-03-09 Thread Carsten Dominik

On 9.3.2012, at 11:12, Sebastien Vauban wrote:

 Hi Bastien and Mathias,
 
 Bastien wrote:
 As default, all level 1 headlines are underlined by - characters and level
 2 headlines with =. Wouldn't it be more logical the other way round: the
 lower the level, the more important the headline and hence the bigger its
 underlining? (Of course the user can change the variable
 org-export-ascii-underline.)
 
 Unless many users think this is illogical, I won't change the default.
 
 To be honest, fixing this was on my (huge) todo list: I've always found it
 disturbing to have more imposing level-2 titles than the level-1 titles.
 
 For me, it makes a lot of sense to invert both, as Mathias is suggesting it.

For what it is worth, I do agree that this looks wrong now and changing
it would make it better.  I do not remember why I chose the sequence
that we have now.  Looking at it now, I would also insert ... after
^^, and hope that # and $ never get any use :)

Also I do not remember to consciously make the underlining one
character too long but I also agree with Bastien that it
does not look bad.  Maybe another variable.

- Carsten

 
 Best regards,
  Seb
 
 -- 
 Sebastien Vauban
 
 




Re: [O] org babel execute shell in sh?

2012-03-09 Thread Tom Regner


Nick Dokos nicholas.do...@hp.com schrieb:

Tom Regner t...@goochesa.de wrote:

 Hi,

 Panruo Wu p...@mymail.mines.edu writes:

  Dear list,
 
 
  #+begin_src sh=C2=A0
  for np in {1..32}
  do
  =C2=A0 =C2=A0 echo $np
  done
  #+end_src
 
  when executing, the output only shows
  {1..32}
  which is clearly not I want..
 
  After some investigation, I found that orgmode
  uses sh that cannot understand the for loop above.
 
  My question is, how can I suggest orgmode to use
  bash to execute shell script?
 
  I tried :shebang #!/bin/bash but it does not work

 I have the following in my config:

 %--
   I really like org-babel to use zsh
   #+begin_src emacs-lisp
 (setq org-babel-sh-command zsh)
   #+end_src
 %--

 It is apparently not possible to set this variable via #+BIND: to
only
 change this for one code block, at least I did not succeed to do so
in
 my attempts to do so -- but maybe I just didn't read enough of the
 documentation to /get it right/.


You are right that it is not possible: #+BIND is effective only when
you
are exporting - basically, people wanted to change various setting on
export, and adding options for each and every one was too much, so
Carsten implemented BIND as a general mechanism for that. But it does
not apply to anything else; in particular, code block evaluation is
completely separate.

But you can use general emacs mechanisms to set it for a particular
file:
that's what file local variables are all about:

(info (emacs)Local Variables in Files)

Nick
Ah, I didn't know that about BIND; but I do know file local variables. I don't 
need them in this case, as I always want to use zsh. And the OP asked for a 
different shell for one code block only, not the whole file.

But I'm often bitten by the distinction between export and tangling -- 
:padline, :shebang come to mind, where I expected org-babel to honour the 
setting in both cases.

well you live and learn: -) And org-mode truly is a joy to use, a marvelous 
piece of software, without which I couldn't do all my work im emacs.

Tom

 I don't know, if zsh||bash instead of sh breaks any assumptions
org-mode
 makes about the environment in which sh code blocks are executed; up
 until now it works like a charm.

 Kind regards,
 Tom



--
http://www.tomsdiner.de
xmpp: t...@sec.goochesa.de



[O] How to get header in second table generated by src block

2012-03-09 Thread Vladimir Lomov
--- 8 ---
#+TITLE: One code two tables

Hello, I'm adopting my workflow to org, and now I want to understand what I do 
wrong in following.

Suppose I have two tables with headers and three columns. In export to html I 
want to get two tables
with first and third columns only. The first table is
#+name: raw-to-table
#+begin_src emacs-lisp :var table=raw :exports results
  (mapcar
   (lambda (row)
 (if (equal row 'hline) ;; - special handling for 'hline
 row
   (list (concat ~ (nth 0 row) ~) (nth 2 row
   table)
#+end_src

The second table is
#+call: raw-to-table[:exports results](table=raw2)

In my environment the second table doesn't have headers. Why? What I do wrong?

* COMMENT The tables data
#+tblname: raw
| Key  | Code  | Description |
|--+---+-|
| KEY1 | CODE1 | DESCR1  |
| KEY2 | CODE2 | DESCR2  |
| KEY3 | CODE3 | DESCR3  |

Second table, key, code and description differ.

#+tblname: raw2
| Key| Code| Description |
|+-+-|
| KEY_A1 | CODE_A1 | DESCR_A1|
| KEY_A2 | CODE_A2 | DESCR_A2|
| KEY_A3 | CODE_A3 | DESCR_A3|


P.S. This is not mine code I borrowed it from Eric Schulte. Thanks Eric for the 
code!

P.S.S. The ~:exports results~ in ~#+call~ is taken from previous version
of code when I tried src block with ~:exports none~ (at first I wanted
to separate code and where to insert table).
--- 8 ---

-- 
It has been said that man is a rational animal.  All my life I have
been searching for evidence which could support this.
-- Bertrand Russell