Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread Kyutech
John, thanks you very much.

Your code really satisfies my  demand. I plan to use your function to
replace org-export.

Thanks again, and thanks Nick for your explanation.

Best regards.




On Sat, Apr 26, 2014 at 1:56 AM, John Kitchin wrote:

> You first export your org-file to latex. the function I sent assumes the
> tex file has the same basename as the org-file, and ends in .tex.
>
> Then, with your org-file as the current buffer, call that function. It
> will modify the latex file by replacing your \includegraphics lines with
> the equivalent line minus the .png.
>
> then you need to manually build the latex file if you want the pdf.
>
> I am not sure what an ebb file is, or what the difference in latex vs
> xelatex is.
>
> https://github.com/jkitchin/jmax/blob/master/ox-manuscript.el
>
> John
>
> ---
> John Kitchin
> Associate Professor
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Fri, Apr 25, 2014 at 11:23 AM, Leu Zhe  wrote:
>
>> Dear John,
>>
>> Thanks very much for your help.
>>
>> I have tried your code but nothing happened. However, I think it is close
>> to my remand.
>>
>> I have some questions about your code:
>>
>> 1. When should this command be called?  Don't I need to call it before
>> the org-latex-pdf-process?
>>
>> 2. I use xelatex to render my .tex files. Because xelatex can not
>> recognize the boundingbox of both .png and .pdf,
>>so I need to generate .ebb for them in seperate folders, which are PNG
>> and PDF folders respectively. so i think
>>   you did not mention them?
>>
>> I am studying elisp now, but your code is really difficult for me, so can
>> you help me dig in?
>>
>> Best regard!
>>
>>
>>
>>
>> On Fri, Apr 25, 2014 at 10:54 PM, John Kitchin 
>> wrote:
>>
>>> This is how I do what I think you are describing. I just take off the
>>> extension, and let (pdf)latex pick the extension it wants.
>>>
>>> (defun ox-manuscript-remove-image-extensions ()
>>>   "Removes .png extensions from \includegraphics directives in an exported 
>>> latex file.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Run this from an org-buffer after you have exported it to a LaTeX file"
>>>   (interactive)
>>>   (let* ((org-file (file-name-nondirectory (buffer-file-name)))
>>>  (tex-file (replace-regexp-in-string "org$" "tex" org-file))
>>>  (tex-contents (with-temp-buffer (insert-file-contents tex-file) 
>>> (buffer-string
>>>
>>>
>>>
>>>
>>>
>>>
>>> (message tex-file)
>>> (with-temp-file tex-file (insert (replace-regexp-in-string
>>>
>>>
>>>
>>>
>>>
>>>
>>>   (concat "\\(\\includegraphics"
>>>   "\\(\[?[^\].*\]?\\)?\\)"  
>>>  ;; match optional [stuff]
>>>
>>>
>>>
>>>
>>>
>>>
>>>   "{\\([^}].*\\)\.\\(png\\)}")
>>>   "\\1{\\3}"  tex-contents)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> John
>>>
>>> ---
>>> John Kitchin
>>> Associate Professor
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> http://kitchingroup.cheme.cmu.edu
>>>
>>>
>>>
>>> On Thu, Apr 24, 2014 at 8:46 AM, Leu Zhe  wrote:
>>>
  I am using org-mode to write some article now. Org-mode is really a
 great tool to outline a article with great table and image support.

 Org-mode can display inline .png image but not .pdf file. Because now
 org-mode can not control the width or height of shown inline image, so i
 use matplotlib to produce low dpi .png image in PNG folder for inline
 display and higher dpi pdf image in PDF folder for finally article export.

 In .org file, the image link is like [[file:PNG\*.png]] and
 \includegraphics{PNG\*.png}in the produced .tex file. Then emacs will
 use org-latex-pdf-process to render it to pdf file. What I want is
 that before or in org-latex-pdf-process, a regexp replace function is
 added to replace the \includegraphics{PDF\*.pdf}, and then produce the
 final pdf file.

 Can anyone give a hand?

>>>
>>>
>>
>


[O] [PATCH] Fix: Capture abort: (error: The mark is not set now, so there is no region)

2014-04-25 Thread Alex Kosorukoff
I noticed a regression in the capture functionality after upgrading org.
Capture fails with error in subj

Here is a simple config to reproduce the problem and a patch that fixes it.

emacs -q -l capfail.el

Best,
Alex
From ac50a5300e35d7abd5f50317069b2a795fde4ad8 Mon Sep 17 00:00:00 2001
From: Alex Kosorukoff 
Date: Mon, 17 Mar 2014 12:56:09 -0700
Subject: [PATCH] fix org-capture error "The mark is not set now, so there is no region"

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

diff --git a/lisp/org.el b/lisp/org.el
index dc4f2cc..bc5a69e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14611,7 +14611,7 @@ When JUST-ALIGN is non-nil, only align tags.
 When JUST-ALIGN is 'ignore-column, align tags without trying to set
 the column by ignoring invisible text."
   (interactive "P")
-  (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
+  (if (and (mark t) (org-region-active-p) org-loop-over-headlines-in-active-region)
   (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
 		'region-start-level 'region))
 	org-loop-over-headlines-in-active-region)
-- 
1.7.0.4

;; capfail.el org-mode capture failure when region is active
;; $ emacs -q -l capfail.el

(setq inhibit-splash-screen t)
(add-to-list 'load-path "~/.emacs.d/org/lisp")
(require 'org)

(setq org-capture-templates
  '(("t" "Todo" entry (file "test.org")
 "* TODO Test %^g\n  %?")))

(define-key global-map (kbd "C-c c") 'org-capture)

(find-file "test.org")
(insert
 "Select some text to make a region, then try C-c c t\ntest\n"
 "Emacs 23.1.1/23.3.1/24.1/24.2 & Org-mode version 8.2.6 result:\n"
 "Capture abort: (error: The mark is not set now, so there is no region)\n")

(provide 'capfail)



Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread John Kitchin
Thanks Nick, for the more helpful explanation than mine ;)

The function I provided is part of this file:
https://github.com/jkitchin/jmax/blob/master/ox-manuscript.el

which I have been working on for publishing scientific manuscripts. This
file provides a new export menu option that not only removes the extensions
in the latex file, but also replaces the \bibliography{} line with the
contents of the .bbl file so that you have a single, standalone tex file
for submission. There is even an export and mail option for a pdf ;)

With this library installed, you can just type: C-c C-e j m
to build your latex file with extensions removed, bibliography replaced,
and open the pdf through the regular org-mode export menu. This may be more
helpful than trying to do the steps manually as I described.

John

---
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Fri, Apr 25, 2014 at 1:06 PM, Nick Dokos  wrote:

> Leu Zhe  writes:
>
> > Dear John,
> >
> > Thanks very much for your help.
> >
> > I have tried your code but nothing happened. However, I think it is
> close to my remand.
> >
> > I have some questions about your code:
> >
> > 1. When should this command be called?  Don't I need to call it before
> the org-latex-pdf-process?
> >
>
> As it says in the comment:
>
> "Run this from an org-buffer after you have exported it to a LaTeX file"
>
> The function assumes that you have already produced a .tex file from
> your .org file (e.g. with C-c C-e l l). Then, in your org file buffer
> you call it:
>
> M-x ox-manuscript-remove-image-extensions RET
>
> > I am studying elisp now, but your code is really difficult for me, so
> can you help me dig in?
>
> What the function does is get the filename for the current buffer
> (i.e. the name of your org file), derive the name of the produced
> tex file, get the contents of the tex file assigned (as a string)
> to tex-contents, do a search-and-replace operation on tex-contents
> and write the result back into the tex file. The search-and-replace
> operation searches for strings that look like this:
>
>   \includegraphics[...]{foo.png}
>
> and replaces each occurrence with
>
>   \includegraphics[...]{foo}
>
> Nick
>
>
>
>


Re: [O] beamer options on frame

2014-04-25 Thread Sebastien Vauban
Hello Bastien,

Bastien wrote:
> Neal Becker  writes:
>
>> How can I put options that would apply to a frame (e.g.,
>> \allowframebreaks)?
>
> #+BIND: org-beamer-frame-default-options "[allowframebreaks]"
>
> for allowing frame breaks for the whole document,
>
> *** A very long slide
> :PROPERTIES:
> :BEAMER_env: [allowframebreaks]
> :END:
>
> for allowing on a frame by frame basis.

Different posts, like
http://lists.gnu.org/archive/html/emacs-orgmode/2013-11/msg00466.html
(from Eric S Fraga), show that option in :BEAMER_opt:.

Not sure which one is better.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] setting left margin in PDF output of ORG file

2014-04-25 Thread Achim Gratz
J. David Boyd writes:
> However, how do I get rid of the huge left and right and top and bottom
> margins?  I like my PDFs to have no more than .75" top, bottom, left and
> right.
>
> I've looked through all the latex, org-latex, org-beamer variables I can find
> with customize-apropos, but not having any luck.

The scr* family of LaTeX packages (aka KOMA-Script) allow you to change
the margins with the DIV argument.  Depending on the base font size,
something like DIV13 or even DIV15 might give result closer to your
goal, but .75" margins are definitely reader-unfriendly (yes, journals
do that all the time, but it's still no good).


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Terratec KOMPLEXER:
http://Synth.Stromeko.net/Downloads.html#KomplexerWaves




Re: [O] setting left margin in PDF output of ORG file

2014-04-25 Thread Martin Schöön
On 25 April 2014 21:51, Thomas S. Dye  wrote:

> Bringhurst is very good.
>
> Also, good discussions from a LaTeX point of view in Chapters 2 of the
> Koma-Script and Memoir manuals.
>
> On my system, I get these with `texdoc memoir' and `texdoc koma'.
>
> hth,
> Tom
>

Both Koma and Memoir are great but their manuals are not even close to any
of the books I listed.

-- 
Martin Schöön

http://hem.bredband.net/b262106/index.html


Re: [O] setting left margin in PDF output of ORG file

2014-04-25 Thread Thomas S. Dye
Bringhurst is very good.

Also, good discussions from a LaTeX point of view in Chapters 2 of the
Koma-Script and Memoir manuals.

On my system, I get these with `texdoc memoir' and `texdoc koma'.

hth,
Tom


Martin Schöön  writes:

> Recommended reading if your are interested in typography:
>
> Robert Bringhurst: "The Elements of Typographical Style" ISBN 0-88179-205-5
> Victoria Squire: "Getting it Right with Type" ISBN-13: 978-1-85669-474-2
> Ellen Lupton: "thinking with type" ISBN 1-56898-448-0
> Derek Birdsall: "notes on book design" ISBN 0-300-10347-6
>
> I have enjoyed reading all four and I recommend you read at least two of
> them because there is not one and only one true and proper way to do this.
> Nor is it trivial so before changing anything you should make sure you know
> what you are doing! The ease with which the user can meddle with typography
> is one of the reasons word-processors such as MS Word and OpenOffice Write
> should be banned :-)
>
> -- 
> Martin Schöön
>
> http://hem.bredband.net/b262106/index.html
> Recommended reading if your are interested in typography:
>
> Robert Bringhurst: "The Elements of Typographical Style" ISBN
> 0-88179-205-5
> Victoria Squire: "Getting it Right with Type" ISBN-13:
> 978-1-85669-474-2
> Ellen Lupton: "thinking with type" ISBN 1-56898-448-0
> Derek Birdsall: "notes on book design" ISBN 0-300-10347-6
>
> I have enjoyed reading all four and I recommend you read at least two
> of them because there is not one and only one true and proper way to
> do this. Nor is it trivial so before changing anything you should make
> sure you know what you are doing! The ease with which the user can
> meddle with typography is one of the reasons word-processors such as
> MS Word and OpenOffice Write should be banned :-)

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] setting left margin in PDF output of ORG file

2014-04-25 Thread Martin Schöön
Recommended reading if your are interested in typography:

Robert Bringhurst: "The Elements of Typographical Style" ISBN 0-88179-205-5
Victoria Squire: "Getting it Right with Type" ISBN-13: 978-1-85669-474-2
Ellen Lupton: "thinking with type" ISBN 1-56898-448-0
Derek Birdsall: "notes on book design" ISBN 0-300-10347-6

I have enjoyed reading all four and I recommend you read at least two of
them because there is not one and only one true and proper way to do this.
Nor is it trivial so before changing anything you should make sure you know
what you are doing! The ease with which the user can meddle with typography
is one of the reasons word-processors such as MS Word and OpenOffice Write
should be banned :-)

-- 
Martin Schöön

http://hem.bredband.net/b262106/index.html


Re: [O] setting left margin in PDF output of ORG file

2014-04-25 Thread John Hendy
On Thu, Apr 24, 2014 at 5:29 AM, Michael Strey  wrote:
> Hi Dave,
>
> Please read
> http://en.wikipedia.org/wiki/Canons_of_page_construction
> before changing anything in the layout of margins.
>
> The typical LaTeX classes are made thorougly with those classic rules of
> page construction in mind.

I have to ask: is whatever was once considered the golden ratio for
text-to-whitespace in printed material, or even used by Gutenberg
himself for proper typesetting considered relevant/best practice
today? Default Org -> LaTeX article looks *ugly as all hell* to me.
Other than theoretical principle, is there evidence that readers
prefer the look of the default LaTeX article sizing?


John

>
>
> On 2014-04-23, J. David Boyd wrote:
>> I can export an org file to a PDF no problem, looks great.
>>
>> However, how do I get rid of the huge left and right and top and bottom
>> margins?  I like my PDFs to have no more than .75" top, bottom, left and
>> right.
>>
>> I've looked through all the latex, org-latex, org-beamer variables I can find
>> with customize-apropos, but not having any luck.
>>
>> Thanks,
>>
>> Dave
>
> --
> Michael Strey
> www.strey.biz
>
>



Re: [O] [babel] Setting python interpreter version on per-block or per-subtree basis

2014-04-25 Thread Eric Schulte
I've just applied this patch.  Thanks for the very attached nice test
and demonstration file.

Best,

William Henney  writes:

> Dear Sacha, Ian, and Eric
>
> Thanks very much for your replies.  Sacha's way is a clever idea and works
> fine, but I think Eric's patch is the best solution in the long term.
>  Please see attached test file - the patch works perfectly.  Although I did
> have to study the manual carefully to work out how get it to work using the
> #+call: syntax. The key is to use "inside header arguments".  Ian's
> solution with shebang works when tangling but not for direct evaluation of
> the source block.
>
> Cheers
>
> Will
>
>
>
>
> On Fri, Apr 25, 2014 at 10:27 AM, Eric Schulte wrote:
>
>> The attached patch should allow the specification of the python command
>> through a new :python header argument.  E.g.,
>>
>> #+begin_src python :python /path/to/python2
>>   return 1 + 2
>> #+end_src
>>
>> If someone who actually uses python could confirm that it works as
>> expected then I'll be happy to apply it.
>>
>>
>>
>> Best,
>> Eric
>>
>> William Henney  writes:
>>
>> > Hi
>> >
>> > Is there an easy way to specify the python version to use for a
>> particular
>> > block or sub-tree?
>> >
>> > My use case is that I have mainly migrated to python 3, but there is
>> still
>> > the occasional library that has not been updated yet, so I need to fall
>> > back to python 2.7 for some tasks.
>> >
>> > I can work around the problem by putting the python 2 code in a separate
>> > org file and use
>> >
>> > # Local Variables:
>> > # org-babel-python-command: "/path/to/python2"
>> > # End:
>> >
>> > but keeping everything in the same file would be preferable.
>> >
>> > Thanks
>> >
>> > Will
>>
>> --
>> Eric Schulte
>> https://cs.unm.edu/~eschulte
>> PGP: 0x614CA05D
>>
>>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread Nick Dokos
Leu Zhe  writes:

> Dear John,
>
> Thanks very much for your help.
>
> I have tried your code but nothing happened. However, I think it is close to 
> my remand. 
>
> I have some questions about your code:
>
> 1. When should this command be called?  Don't I need to call it before the 
> org-latex-pdf-process?
>

As it says in the comment:

"Run this from an org-buffer after you have exported it to a LaTeX file"

The function assumes that you have already produced a .tex file from
your .org file (e.g. with C-c C-e l l). Then, in your org file buffer
you call it:

M-x ox-manuscript-remove-image-extensions RET

> I am studying elisp now, but your code is really difficult for me, so can you 
> help me dig in? 

What the function does is get the filename for the current buffer
(i.e. the name of your org file), derive the name of the produced
tex file, get the contents of the tex file assigned (as a string)
to tex-contents, do a search-and-replace operation on tex-contents
and write the result back into the tex file. The search-and-replace
operation searches for strings that look like this:

  \includegraphics[...]{foo.png}

and replaces each occurrence with

  \includegraphics[...]{foo}

Nick





Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread John Kitchin
You first export your org-file to latex. the function I sent assumes the
tex file has the same basename as the org-file, and ends in .tex.

Then, with your org-file as the current buffer, call that function. It will
modify the latex file by replacing your \includegraphics lines with the
equivalent line minus the .png.

then you need to manually build the latex file if you want the pdf.

I am not sure what an ebb file is, or what the difference in latex vs
xelatex is.

https://github.com/jkitchin/jmax/blob/master/ox-manuscript.el

John

---
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Fri, Apr 25, 2014 at 11:23 AM, Leu Zhe  wrote:

> Dear John,
>
> Thanks very much for your help.
>
> I have tried your code but nothing happened. However, I think it is close
> to my remand.
>
> I have some questions about your code:
>
> 1. When should this command be called?  Don't I need to call it before the
> org-latex-pdf-process?
>
> 2. I use xelatex to render my .tex files. Because xelatex can not
> recognize the boundingbox of both .png and .pdf,
>so I need to generate .ebb for them in seperate folders, which are PNG
> and PDF folders respectively. so i think
>   you did not mention them?
>
> I am studying elisp now, but your code is really difficult for me, so can
> you help me dig in?
>
> Best regard!
>
>
>
>
> On Fri, Apr 25, 2014 at 10:54 PM, John Kitchin wrote:
>
>> This is how I do what I think you are describing. I just take off the
>> extension, and let (pdf)latex pick the extension it wants.
>>
>> (defun ox-manuscript-remove-image-extensions ()
>>   "Removes .png extensions from \includegraphics directives in an exported 
>> latex file.
>>
>>
>>
>>
>>
>> Run this from an org-buffer after you have exported it to a LaTeX file"
>>   (interactive)
>>   (let* ((org-file (file-name-nondirectory (buffer-file-name)))
>>  (tex-file (replace-regexp-in-string "org$" "tex" org-file))
>>  (tex-contents (with-temp-buffer (insert-file-contents tex-file) 
>> (buffer-string
>>
>>
>>
>>
>> (message tex-file)
>> (with-temp-file tex-file (insert (replace-regexp-in-string
>>
>>
>>
>>
>>   (concat "\\(\\includegraphics"
>>   "\\(\[?[^\].*\]?\\)?\\)"   
>> ;; match optional [stuff]
>>
>>
>>
>>
>>   "{\\([^}].*\\)\.\\(png\\)}")
>>   "\\1{\\3}"  tex-contents)
>>
>>
>>
>>
>>
>>
>> John
>>
>> ---
>> John Kitchin
>> Associate Professor
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> http://kitchingroup.cheme.cmu.edu
>>
>>
>>
>> On Thu, Apr 24, 2014 at 8:46 AM, Leu Zhe  wrote:
>>
>>>  I am using org-mode to write some article now. Org-mode is really a
>>> great tool to outline a article with great table and image support.
>>>
>>> Org-mode can display inline .png image but not .pdf file. Because now
>>> org-mode can not control the width or height of shown inline image, so i
>>> use matplotlib to produce low dpi .png image in PNG folder for inline
>>> display and higher dpi pdf image in PDF folder for finally article export.
>>>
>>> In .org file, the image link is like [[file:PNG\*.png]] and
>>> \includegraphics{PNG\*.png}in the produced .tex file. Then emacs will
>>> use org-latex-pdf-process to render it to pdf file. What I want is that
>>> before or in org-latex-pdf-process, a regexp replace function is added
>>> to replace the \includegraphics{PDF\*.pdf}, and then produce the final
>>> pdf file.
>>>
>>> Can anyone give a hand?
>>>
>>
>>
>


Re: [O] run R code block in the background (currently emacs freezes when running code)

2014-04-25 Thread John Hendy
On Thu, Apr 24, 2014 at 12:09 PM, Xebar Saram  wrote:
> Hi all. how does one send the eval commands to the when running R code
> blocks to RSS to the  background? currently when i evaluate a long code
> block it freezes Emacs until the process is done. here is an example code
> block i use:
>
> #+BEGIN_SRC R :session R1  :results output
> log.sga.270 <- glm(NSGA ~
> IQRfintempmabirth+sinetime+costime+age_centered+age_centered_sq+cig_preg+cig_pre+med_income+p_ospace+gender+prev_400+
> diab+hyper+lungd+diab_other+prevpret+as.factor(kess)+as.factor(MRN)+as.factor(edu_group)+as.factor(byob)+parity,data=bd,family=binomial)
> summary(log.sga.270)
> #+END_SRC
>

I didn't run this, but have trained machine learning models in the
past which run for a while. You should be able to do C-g to un-freeze
the cursor in Emacs, while the code will still be executed in your R
session. Try doing C-c C-c to start that block, C-g, and then C-x b to
switch to the R1 buffer. You should see that the cursor isn't on a
prompt, which means R is busy, yet you're free to move around in your
org buffer and keep writing or doing whatever you want, even though
the R session is tied up.


Best regards,
John

>
> thx so much in advance
>
> Z



Re: [O] [babel] Setting python interpreter version on per-block or per-subtree basis

2014-04-25 Thread William Henney
Dear Sacha, Ian, and Eric

Thanks very much for your replies.  Sacha's way is a clever idea and works
fine, but I think Eric's patch is the best solution in the long term.
 Please see attached test file - the patch works perfectly.  Although I did
have to study the manual carefully to work out how get it to work using the
#+call: syntax. The key is to use "inside header arguments".  Ian's
solution with shebang works when tangling but not for direct evaluation of
the source block.

Cheers

Will




On Fri, Apr 25, 2014 at 10:27 AM, Eric Schulte wrote:

> The attached patch should allow the specification of the python command
> through a new :python header argument.  E.g.,
>
> #+begin_src python :python /path/to/python2
>   return 1 + 2
> #+end_src
>
> If someone who actually uses python could confirm that it works as
> expected then I'll be happy to apply it.
>
>
>
> Best,
> Eric
>
> William Henney  writes:
>
> > Hi
> >
> > Is there an easy way to specify the python version to use for a
> particular
> > block or sub-tree?
> >
> > My use case is that I have mainly migrated to python 3, but there is
> still
> > the occasional library that has not been updated yet, so I need to fall
> > back to python 2.7 for some tasks.
> >
> > I can work around the problem by putting the python 2 code in a separate
> > org file and use
> >
> > # Local Variables:
> > # org-babel-python-command: "/path/to/python2"
> > # End:
> >
> > but keeping everything in the same file would be preferable.
> >
> > Thanks
> >
> > Will
>
> --
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D
>
>


-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia


multi-python.org
Description: Binary data


Re: [O] State of the art in citations

2014-04-25 Thread Grant Rettke
Is there a sub-group dedicated to this?

It is on my TODO list to catch up on the state of the art, too.
Grant Rettke | AAAS, ACM, ASA, FSF, IEEE, SIAM, Sigma Xi
gret...@acm.org | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson


On Fri, Apr 25, 2014 at 7:11 AM, Julian M. Burgos  wrote:
> Dear list,
>
> I use org-mode to write scientific papers, exporting mostly to LaTex/pdf
> (and sometimes to Word via ODT when I have to collaborate with less
> enlightened colleagues).  I keep my references in a .bib file, and so
> far I have been using bibtex in a more or less standard way, using
> reftex to insert citations in the documents.
>
> I am planning in revamping the way I deal with citations, and I was
> wondering if I can get your opinions in what is the "state of the art"
> in using citations in org-mode, in particular
>
> - Should I use biblatex instead of bibtex?
> - Are there any contributed packages that I should consider?
> - What would be the best way to get citations into html or odt?
>
> Any comments or tips will be welcomed!
> All the best,
>
> Julian
>
> --
> Julian Mariano Burgos, PhD
> Hafrannsóknastofnun/Marine Research Institute
> Skúlagata 4, 121 Reykjavík, Iceland
> Sími/Telephone : +354-5752037
> Bréfsími/Telefax:  +354-5752001
> Netfang/Email: jul...@hafro.is
>



Re: [O] python babel not running startup file

2014-04-25 Thread Ken Mankoff

On 2014-04-25 at 11:28, Eric Schulte wrote:
> Yes, customize the org-babel-python-command variable.

Right. I had tried that and it didn't work before I sent the email. This
does work:

(setq org-babel-python-command "python -i /Users/mankoff/.pythonrc")

Perhaps I had a typo or other bug with my previous attempt.

Works now!

Thanks,

  -k.



Re: [O] [babel] Setting python interpreter version on per-block or per-subtree basis

2014-04-25 Thread Eric Schulte
The attached patch should allow the specification of the python command
through a new :python header argument.  E.g.,

#+begin_src python :python /path/to/python2
  return 1 + 2
#+end_src

If someone who actually uses python could confirm that it works as
expected then I'll be happy to apply it.

>From d57887adc70c524199b3307b74f17ea5751450f0 Mon Sep 17 00:00:00 2001
From: Eric Schulte 
Date: Fri, 25 Apr 2014 09:24:04 -0600
Subject: [PATCH] allow specification of python command w/header arg

  Using the :python header arg.

* lisp/ob-python.el (org-babel-execute:python): Locally set
  `org-babel-python-command' using a header argument.
---
 lisp/ob-python.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index baa5764..eb25609 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -82,6 +82,8 @@ This function is called by `org-babel-execute-src-block'."
 	 (return-val (when (and (eq result-type 'value) (not session))
 		   (cdr (assoc :return params
 	 (preamble (cdr (assoc :preamble params)))
+	 (org-babel-python-command
+	  (or (cdr (assoc :python params)) org-babel-python-command))
  (full-body
 	  (org-babel-expand-body:generic
 	   (concat body (if return-val (format "\nreturn %s" return-val) ""))
-- 
1.9.2


Best,
Eric

William Henney  writes:

> Hi
>
> Is there an easy way to specify the python version to use for a particular
> block or sub-tree?
>
> My use case is that I have mainly migrated to python 3, but there is still
> the occasional library that has not been updated yet, so I need to fall
> back to python 2.7 for some tasks.
>
> I can work around the problem by putting the python 2 code in a separate
> org file and use
>
> # Local Variables:
> # org-babel-python-command: "/path/to/python2"
> # End:
>
> but keeping everything in the same file would be preferable.
>
> Thanks
>
> Will

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D


Re: [O] python babel not running startup file

2014-04-25 Thread Eric Schulte
Yes, customize the org-babel-python-command variable.

Best,

Ken Mankoff  writes:

> I have the PYTHONSTARTUP environment variable set to "~/.pythonrc". That
> file is not run by Org babel. Can anyone recommend how to execute that
> file, or some other method for customizing all Org babel python
> executions.
>
> Specifically, I load a custom colorbar in my ~/.pythonrc and
> ~/.ipythonrc files, and would like Org python to behave the same.
>
>   -k.
>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread Leu Zhe
Dear Feng Shu,

Thanks very much for your help.

I am not familiar with R, but I will test it later.

Best regards!


Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread Leu Zhe
Dear John,

Thanks very much for your help.

I have tried your code but nothing happened. However, I think it is close
to my remand.

I have some questions about your code:

1. When should this command be called?  Don't I need to call it before the
org-latex-pdf-process?

2. I use xelatex to render my .tex files. Because xelatex can not recognize
the boundingbox of both .png and .pdf,
   so I need to generate .ebb for them in seperate folders, which are PNG
and PDF folders respectively. so i think
  you did not mention them?

I am studying elisp now, but your code is really difficult for me, so can
you help me dig in?

Best regard!




On Fri, Apr 25, 2014 at 10:54 PM, John Kitchin wrote:

> This is how I do what I think you are describing. I just take off the
> extension, and let (pdf)latex pick the extension it wants.
>
> (defun ox-manuscript-remove-image-extensions ()
>   "Removes .png extensions from \includegraphics directives in an exported 
> latex file.
>
>
>
>
> Run this from an org-buffer after you have exported it to a LaTeX file"
>   (interactive)
>   (let* ((org-file (file-name-nondirectory (buffer-file-name)))
>  (tex-file (replace-regexp-in-string "org$" "tex" org-file))
>  (tex-contents (with-temp-buffer (insert-file-contents tex-file) 
> (buffer-string
>
>
>
> (message tex-file)
> (with-temp-file tex-file (insert (replace-regexp-in-string
>
>
>
>   (concat "\\(\\includegraphics"
>   "\\(\[?[^\].*\]?\\)?\\)"   
> ;; match optional [stuff]
>
>
>
>   "{\\([^}].*\\)\.\\(png\\)}")
>   "\\1{\\3}"  tex-contents)
>
>
>
>
>
> John
>
> ---
> John Kitchin
> Associate Professor
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Thu, Apr 24, 2014 at 8:46 AM, Leu Zhe  wrote:
>
>>  I am using org-mode to write some article now. Org-mode is really a
>> great tool to outline a article with great table and image support.
>>
>> Org-mode can display inline .png image but not .pdf file. Because now
>> org-mode can not control the width or height of shown inline image, so i
>> use matplotlib to produce low dpi .png image in PNG folder for inline
>> display and higher dpi pdf image in PDF folder for finally article export.
>>
>> In .org file, the image link is like [[file:PNG\*.png]] and
>> \includegraphics{PNG\*.png}in the produced .tex file. Then emacs will
>> use org-latex-pdf-process to render it to pdf file. What I want is that
>> before or in org-latex-pdf-process, a regexp replace function is added
>> to replace the \includegraphics{PDF\*.pdf}, and then produce the final
>> pdf file.
>>
>> Can anyone give a hand?
>>
>
>


[O] What happened to clocktable in pdf export?

2014-04-25 Thread Buddy Butterfly

Hi,

what happened to the pdf export of clocktables?
After the upgrade to Ubuntu 13.10 (emacs 24.3.1),
the clocktable export looks ugly as hell. With
the latex headers aligne=l|r etc. and the indentation
in the clocktable I got a very nice export before.
The lines where also indented and I had vertical
separators for the columns.

Now, in the new version I get "" in the PDF
for the indentation (\_) and there are not separator
lines between columns.

What changed? Is it just configuration or did change
completely?

Cheers,
Matt




Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread John Kitchin
This is how I do what I think you are describing. I just take off the
extension, and let (pdf)latex pick the extension it wants.

(defun ox-manuscript-remove-image-extensions ()
  "Removes .png extensions from \includegraphics directives in an
exported latex file.

Run this from an org-buffer after you have exported it to a LaTeX file"
  (interactive)
  (let* ((org-file (file-name-nondirectory (buffer-file-name)))
 (tex-file (replace-regexp-in-string "org$" "tex" org-file))
 (tex-contents (with-temp-buffer (insert-file-contents
tex-file) (buffer-string
(message tex-file)
(with-temp-file tex-file (insert (replace-regexp-in-string
  (concat "\\(\\includegraphics"
  "\\(\[?[^\].*\]?\\)?\\)"
  ;; match optional [stuff]
  "{\\([^}].*\\)\.\\(png\\)}")
  "\\1{\\3}"  tex-contents)



John

---
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Thu, Apr 24, 2014 at 8:46 AM, Leu Zhe  wrote:

>  I am using org-mode to write some article now. Org-mode is really a great
> tool to outline a article with great table and image support.
>
> Org-mode can display inline .png image but not .pdf file. Because now
> org-mode can not control the width or height of shown inline image, so i
> use matplotlib to produce low dpi .png image in PNG folder for inline
> display and higher dpi pdf image in PDF folder for finally article export.
>
> In .org file, the image link is like [[file:PNG\*.png]] and
> \includegraphics{PNG\*.png}in the produced .tex file. Then emacs will use
> org-latex-pdf-process to render it to pdf file. What I want is that
> before or in org-latex-pdf-process, a regexp replace function is added to
> replace the \includegraphics{PDF\*.pdf}, and then produce the final pdf
> file.
>
> Can anyone give a hand?
>


[O] State of the art in citations

2014-04-25 Thread Julian M. Burgos
Dear list,

I use org-mode to write scientific papers, exporting mostly to LaTex/pdf
(and sometimes to Word via ODT when I have to collaborate with less
enlightened colleagues).  I keep my references in a .bib file, and so
far I have been using bibtex in a more or less standard way, using
reftex to insert citations in the documents.  

I am planning in revamping the way I deal with citations, and I was
wondering if I can get your opinions in what is the "state of the art"
in using citations in org-mode, in particular

- Should I use biblatex instead of bibtex?  
- Are there any contributed packages that I should consider?
- What would be the best way to get citations into html or odt?

Any comments or tips will be welcomed!
All the best,

Julian

-- 
Julian Mariano Burgos, PhD
Hafrannsóknastofnun/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: jul...@hafro.is



Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread Feng Shu
Leu Zhe  writes:

> I am using org-mode to write some article now. Org-mode is really a
> great tool to outline a article with great table and image support.
>
> Org-mode can display inline .png image but not .pdf file. Because now
> org-mode can not control the width or height of shown inline image, so
> i use matplotlib to produce low dpi .png image in PNG folder for
> inline display and higher dpi pdf image in PDF folder for finally
> article export.
>
> In .org file, the image link is like [[file:PNG\*.png]] and
> \includegraphics{PNG\*.png}in the produced .tex file. Then emacs will
> use org-latex-pdf-process to render it to pdf file. What I want is
> that before or in org-latex-pdf-process, a regexp replace function is
> added to replace the \includegraphics{PDF\*.pdf}, and then produce the
> final pdf file.
>
> Can anyone give a hand?

I use R, Maybe this can help you ...

#+begin_src R :exports results :results output drawer :var backend=(symbol-name 
org-export-current-backend)
  require("ascii")
  plot.org  <- function (x, caption)
  {
  pngfile <- paste(caption, ".png", sep="")
  pdffile <- paste(caption, ".pdf", sep="")
  print(paragraph(paste("#+CAPTION: ", caption, sep="")),type="org")
  if (backend != "latex"){
  png(pngfile)
  plot(x)
  dev.off()
  print(paragraph(paste("[[./", pngfile, "]]", 
sep=""),new=FALSE),type="org")
  }else{
  pdf(pdffile)
  plot(x)
  dev.off()
  print(paragraph(paste("[[./", pdffile, "]]", 
sep=""),new=FALSE),type="org")
  }
  }

  plot.org(rnorm(100),"test")
#+end_src

-- 




Re: [O] Exporting to LaTeX Beamer

2014-04-25 Thread Uwe Ziegenhagen

> 
> How exactly are you trying to export?  Your output looks like a plain
> latex export (M-x org-export-dispatch RET l p), not beamer (... l P)?
> Note difference in case (p versus P) and similar for export to latex
> code alone (l or b) and for opening the PDF automatically (o versus O).
> 

Got it! My assumption was that the LaTeX export is controlled by the beamer
startup option and just user the lowercase exports.

Now it's working, thanks for the help!

Uwe




[O] [PATCH] org.el: Use `org-any-link-re' to avoid duplication

2014-04-25 Thread Albert Krewinkel
The `re' variable defined in function `org-offer-links-in-entry' is
string-equal to `org-any-link-re' and is hence replaced by the latter.
---
 lisp/org.el | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ad76e67..741529b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10694,10 +10694,7 @@ there is one, return it."
   (save-restriction
(widen)
(goto-char marker)
-   (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|"
- "\\(" org-angle-link-re "\\)\\|"
- "\\(" org-plain-link-re "\\)"))
- (cnt ?0)
+   (let ((cnt ?0)
  (in-emacs (if (integerp nth) nil nth))
  have-zero end links link c)
  (when (and (stringp zero) (string-match org-bracket-link-regexp zero))
@@ -10706,7 +10703,7 @@ there is one, return it."
  (save-excursion
(org-back-to-heading t)
(setq end (save-excursion (outline-next-heading) (point)))
-   (while (re-search-forward re end t)
+   (while (re-search-forward org-any-link-re end t)
  (push (match-string 0) links))
(setq links (org-uniquify (reverse links
  (cond
-- 
1.9.2




[O] [PATCH] org.el (org-offer-links-in-entry): Remove code duplication

2014-04-25 Thread Albert Krewinkel
* org.el (org-offer-links-in-entry): Use `org-any-link-re' to avoid
  code duplication.

The `re' variable defined in function `org-offer-links-in-entry' is
string-equal to `org-any-link-re' and is hence replaced by the latter.

This is a TINYCHANGE.
---
 lisp/org.el | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ad76e67..741529b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10694,10 +10694,7 @@ there is one, return it."
   (save-restriction
(widen)
(goto-char marker)
-   (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|"
- "\\(" org-angle-link-re "\\)\\|"
- "\\(" org-plain-link-re "\\)"))
- (cnt ?0)
+   (let ((cnt ?0)
  (in-emacs (if (integerp nth) nil nth))
  have-zero end links link c)
  (when (and (stringp zero) (string-match org-bracket-link-regexp zero))
@@ -10706,7 +10703,7 @@ there is one, return it."
  (save-excursion
(org-back-to-heading t)
(setq end (save-excursion (outline-next-heading) (point)))
-   (while (re-search-forward re end t)
+   (while (re-search-forward org-any-link-re end t)
  (push (match-string 0) links))
(setq links (org-uniquify (reverse links
  (cond
-- 
1.9.2




Re: [O] (org-insert-headline '(4)) should insert new headline before point

2014-04-25 Thread Leonard Randall
Hi Bastien,
On 25 April 2014 08:29, Bastien  wrote:


> I just fixed this in maint -- please let me know if it works
> back as expected.
>


Yes, now C-RET and the speedkey `i' now function as
described in the documentation. The only place where the
function differs from the documentation is at the beginning of
a normal line. The documentation says, `If point is at the
beginning of a normal line, turn this line into a heading.'

Currently, calling M-RET will create a newline before the
text on the current line.So, if I call M-RET at the beginning of
(a), I get (b), rather than (c) which is what I would expect from
the documentation.

-a
Text I may later turn into a headline.
--

b
*
Text I may later turn into a headline.
-

c
* Text I may later turn into a headline



Hope this helps,
All best,
Leonard


[O] image attributes in ODT export for wrapped text possible?

2014-04-25 Thread Eric S Fraga
Hello,

I (for my sins) am needing to export an org document to ODT unlike my
usual target of PDF via LaTeX.  One of my figures is ideally placed by
having text wrap (flow) around it.  Having looked at ox-odt.el, I can
see that I can specify values for :anchor, :style and :attributes but I
have no idea if what I want is possible at all and, if so, how to
specify it!  Any pointers would be greatly welcome.

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.5h-1027-g4c0a29



Re: [O] Exporting to LaTeX Beamer

2014-04-25 Thread Eric S Fraga
On Friday, 25 Apr 2014 at 09:37, Uwe Ziegenhagen wrote:
> Eric S Fraga  ucl.ac.uk> writes:
>
>> 
>> On Friday, 25 Apr 2014 at 04:38, Uwe Ziegenhagen wrote:
>> > Hi,
>> >
>> > I am trying to export an org file to individual Beamer frames but fail as
>> > Org mode exports the sections, but not the frames.
>> 
>> Use H:2 option instead of H:3 (in the #+OPTIONS line).  This setting
>> tells the exporter which level of heading constitutes frames.
>
>
> Hi Eric, thanks for the feedback. I switched to H:2 but get no difference in
> the output:

How exactly are you trying to export?  Your output looks like a plain
latex export (M-x org-export-dispatch RET l p), not beamer (... l P)?
Note difference in case (p versus P) and similar for export to latex
code alone (l or b) and for opening the PDF automatically (o versus O).

For beamer export, by the way, you do not need to specify the
latex_class.  For version 8.x of org, you no longer need
BEAMER_FRAME_LEVEL either.  For most of my beamer org documents, all I
have in terms of specifications is the following:

--8<---cut here---start->8---
#+TITLE: The title of the talk
#+AUTHOR:Eric S Fraga
#+LaTeX_CLASS_options: [bigger,allowframebreaks]
#+OPTIONS:   H:2 toc:nil num:nil
#+startup: beamer
--8<---cut here---end--->8---

followed by the actual content.  The startup option is to enable the
special key bindings that work on headlines for columns and blocks.

Also note that @...@ is no longer the specification for alterted
text.  Use *...* instead.  The example you have was for version 7.x of
org.

Finally, the documentation for the new exporter, for org v8.x, is here:
http://orgmode.org/worg/exporters/beamer/ox-beamer.html
The older documentation, written by me initially, is no longer
applicable but is there for those people still using org v7.x.

HTH,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.5h-1027-g4c0a29



Re: [O] Exporting to LaTeX Beamer

2014-04-25 Thread Uwe Ziegenhagen
Eric S Fraga  ucl.ac.uk> writes:

> 
> On Friday, 25 Apr 2014 at 04:38, Uwe Ziegenhagen wrote:
> > Hi,
> >
> > I am trying to export an org file to individual Beamer frames but fail as
> > Org mode exports the sections, but not the frames.
> 
> Use H:2 option instead of H:3 (in the #+OPTIONS line).  This setting
> tells the exporter which level of heading constitutes frames.


Hi Eric, thanks for the feedback. I switched to H:2 but get no difference in
the output:

#

#+TITLE: Writing Beamer presentations in org-mode
#+AUTHOR:Eric S Fraga
#+EMAIL: e.fr...@ucl.ac.uk
#+DATE:  2010-03-30 Tue
#+DESCRIPTION: 
#+KEYWORDS: 
#+LANGUAGE:  en
#+OPTIONS:   H:2 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0
path:http://orgmode.org/org-info.js
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:   
#+LINK_HOME:
#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]
#+BEAMER_FRAME_LEVEL: 2
#+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args)
%4BEAMER_col(Col) %10BEAMER_extra(Extra)

* Introduction
** A simple slide
This slide consists of some text with a number of bullet points:

- the first, very @important@, point!
- the previous point shows the use of the special markup which
  translates to the Beamer specific /alert/ command for highlighting
  text.


The above list could be numbered or any other type of list and may
include sub-lists.


##

generates (excerpt)


\section{Introduction}
\label{sec-1}
\subsection{A simple slide}
\label{sec-1-1}
This slide consists of some text with a number of bullet points:

\begin{itemize}
\item the first, very @important@, point!
\item the previous point shows the use of the special markup which
translates to the Beamer specific \emph{alert} command for highlighting
text.
\end{itemize}
###

Here's the .emacs file I use:

;; Do not show welcome screen
(setq inhibit-startup-message t)

;; Load Emacs Org-Mode
(add-to-list 'load-path "C:/emacs-24.3/MyLisp/org-8.2.6/lisp/")

;; load the latex extension
(require 'ox-html)
(require 'ox-latex)
(require 'ox-ascii)
(require 'ox-beamer)


;; Load Recentfile code, see entry in  menu
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)

;; show no startup-screen
(setq inhibit-startup-screen t)

;; just answer Emacs' question with 'y' or 'n'
(defalias 'yes-or-no-p 'y-or-n-p)







Re: [O] [babel] Setting python interpreter version on per-block or per-subtree basis

2014-04-25 Thread Ian Barton



Is there an easy way to specify the python version to use for a
particular block or sub-tree?

My use case is that I have mainly migrated to python 3, but there is
still the occasional library that has not been updated yet, so I need to
fall back to python 2.7 for some tasks.

I can work around the problem by putting the python 2 code in a separate
org file and use

# Local Variables:
# org-babel-python-command: "/path/to/python2"
# End:



I think you can use shebang for this. It definitely works for tangling 
files:


#+begin_src python :shebang #!/usr/bin/python2 :tangle 
./raspberrypi/weather.py :exports none :noweb yes


#+end_src



Re: [O] org-review-schedule

2014-04-25 Thread Nicolas Goaziou
Alan Schmitt  writes:

> I guess I should have asked: who decides what goes in contrib?

The Org maintainer. Another option is to turn it into an ELPA package.

> Is this mature/useful enough to be included? If so, I'll edit these as
> you suggest.

It seems useful. Maturity is not a problem since you have write access
to the repo. Anyway, Bastien will give you the definitive answer.

> After this many violations, I've added
>
> #+begin_src emacs-lisp
>   (setq-default show-trailing-whitespace t)
> #+end_src
>
> to my configuration ;-)

FWIW, I use `whitespace-mode' instead.

> It works, so I guess it's not supposed to move the point. It's to be
> used with `org-agenda-skip-function', which says:
>
> ,---
> | Function to be called at each match during agenda construction.   
> | If this function returns nil, the current match should not be skipped.
> | Otherwise, the function must return a position from where the search  
> | should be continued.  
> `---

Then I suggest to explain it in the docstring (both the return value and
that it will be used as `org-agenda-skip-function' value).


Regards,

-- 
Nicolas Goaziou



Re: [O] [RFC] Org Minor Mode?

2014-04-25 Thread Thorsten Jolitz
Ilya Shlyakhter  writes:

> On 4/19/2014 8:57 AM, Bastien wrote:
>> Hi Thorsten,
>>
>> Thorsten Jolitz  writes:
>>
>>> In summary, its about:
>>>
>>>   1. generalize the regexp constants and vars (allow for comment-syntax,
>>>   when org-minor-mode)
>>>
>>>   2. deal with hardcoded regexp-snippets in functions (my proposoal:
>>>   replace "^" with org-BOL, "$" with org-EOL, "\\*" with org-STAR)
>>>
>>>   3. outcomment new lines after calls to Org commands.
>>
>> I still think there is a simpler way, I'll explore this and
>> I'll let you know.
>>
>
> What about using advice on regexp functions to transform the regexps
> (when invoked in org-minor-mode buffers) so that $ is replaced with ";
> $" etc?

Its definitely one option, but its always said in the manuals that, if
possible, one should rather modify the sources than using advices, and
since Org-mode is not abandon-ware at all, I thought I ask first how
chances are for such modifications. 

> One other issue is the use of the number of stars to determine outline
> level.

Since outshine should bring the look&feel of Org-mode to programming
language buffers, using other language elements (like e.g. functions) as
outline items is not only a technical problem, but a conceptual problem
too. In Org-mode, functions are stored in src-blocks, they are not
headlines. Thus they should be treated in outshine rather like plain
lists or drawers or other elements that change visibility but are no
headline. 

-- 
cheers,
Thorsten




Re: [O] Exporting to LaTeX Beamer

2014-04-25 Thread Eric S Fraga
On Friday, 25 Apr 2014 at 04:38, Uwe Ziegenhagen wrote:
> Hi,
>
> I am trying to export an org file to individual Beamer frames but fail as
> Org mode exports the sections, but not the frames.

Use H:2 option instead of H:3 (in the #+OPTIONS line).  This setting
tells the exporter which level of heading constitutes frames.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.5h-1027-g4c0a29



Re: [O] [RFC] Org Minor Mode?

2014-04-25 Thread Thorsten Jolitz
Ilya Shlyakhter  writes:

Hi Ilya,

> On 4/10/2014 3:19 PM, Nicolas Goaziou wrote:
>> I don't see why you would need the "full power of Org-mode" (whatever
>> that means) in mere comments.
>
> There are actually many uses, especially if it becomes possible to
> treat language elements (functions, classes etc) as outline elements
> (cf. https://github.com/notestaff/outshine/blob/outshine-lang/outshine-lang.el
> ). Sparse trees and agenda views could be used to find all code
> elements related to a particular aspect of functionality, if items
> related to that aspect are tagged with a tag.  Sparse trees could show
> just the public (interface) elements.  Basically, outshine with the
> full power of Org and the ability to treat language elements as
> outline headings would add up to the first literate programming system
> I'd call usable.

I think outshine (or a true org-minor-mode) definitely has its merits
when its more about "literate PROGRAMMING" rather than "LITERATE
programming".

I definitely liked your idea to use navi-mode regexps as additional
outline elements - they can easily be defined by the users via
customizable vars `navi-key-mappings' and `navi-keywords', cover a wide
range of syntax elements, and would be defined once but used twice
then. The most obvious choice for outlining would be the regexp stored
in :FUN and called with 'f' in navi-mode, e.g. in elisp:

#+begin_src emacs-lisp
(defcustom navi-key-mappings
  '(("emacs-lisp" . ((:FUN . "f") ...)))
#+end_src

#+begin_src emacs-lisp
(defcustom navi-keywords
  '(("emacs-lisp" . ((:FUN
   . "^[[:space:]]*(def[maus][^elt][a-z]*\\*? ") ...)))
#+end_src

That way somebody could define a set of predefined keyword searches for a
programming language that is included in navi-mode.el (like I did for
Emacs Lisp, PicoLisp, Org-mode and ESS/R) and users could modify it or
add their own regexps and keybindings. Some of these regexps could
then be reused in outshine for visiility cycling and other stuff. 

There are many Org features I would really like to have in outshine
too, but I realized that reimplementing Org stuff in outshine
would be kind of an uphill battle in the long run, so I would rather
take what is there (orgstruct, outshine, outorg/poporg, navi) and
merge it into a true org-minor-mode reusing existing Org-mode
functionality.

I have a pretty clear picture what is needed for an org-minor-mode,
and started implementation in 

,
| https://github.com/tj64/omm
`

already. But I feel that this should be done together with the Org
maintainers and the Org community, otherwise bad things could happen:

 - I write the whole thing (changing Org sources) and the maintainers
   say NO to it.

 - I write the whole thing (changing Org sources), the maintainers say
   NO to it, but I want it anyway and become the unvoluntary maintainer
   of an unmaintainable Org fork (nightmare).

 - I write the whole thing w/o changing Org sources (if that is
   possible), e.g. using advices, the Org people like it and reimplement
   it w/o advices, and my effort is wasted.

So I would rather have a clear picture of the 'political situation' wrt
to org-minor-mode and some technical discussion first. But anyway, I
will not have time to work on this again before June.

-- 
cheers,
Thorsten




Re: [O] org-review-schedule

2014-04-25 Thread Alan Schmitt
Hi Nicolas,

Thanks a lot for these very helpful comments. I'll take them into
account. I have a couple questions of my own now.

On 2014-04-25 08:51, Nicolas Goaziou  writes:

>> I would like to propose to add this to the contrib directory, but
>> I don't know the procedure to submit this code.
>
> You simply copy the file in the contrib/lisp/ directory, edit
> contrib/README and edit `org-modules' defcustom in "org.el".

I guess I should have asked: who decides what goes in contrib? Is this
mature/useful enough to be included? If so, I'll edit these as you
suggest.

>> ;; Example use.
>> ;; 
>
> Trailing whitespace.

After this many violations, I've added

#+begin_src emacs-lisp
  (setq-default show-trailing-whitespace t)
#+end_src

to my configuration ;-)

>> (defun org-review-insert-last-review (&optional prompt)
>>   "Insert the current date as last review. If prefix argument:
>> prompt the user for the date."
>>   (interactive "P")
>>   (let* ((ts (if prompt
>> (concat "<" (org-read-date) ">")
>>   (format-time-string (car org-time-stamp-formats)
>> (save-excursion
>
> I don't think this `save-excursion' is needed.

Indeed. I copied this from org-expiry. Looking at the code for
`org-entry-put', I see that it uses `org-with-point' that also uses
save-excursion inside.

>> (defun org-review-skip ()
>>   "Skip entries that are not scheduled to be reviewed."
>>   (save-restriction
>> (widen)
>> (let ((next-headline (save-excursion (or (outline-next-heading)
>>  (point-max)
>>   (cond
>>((org-review-toreview-p) nil)
>>(t next-headline)
>
> This function doesn't move point (so it skips nothing), is it
> expected?

It works, so I guess it's not supposed to move the point. It's to be
used with `org-agenda-skip-function', which says:

,---
| Function to be called at each match during agenda construction.   
| If this function returns nil, the current match should not be skipped.
| Otherwise, the function must return a position from where the search  
| should be continued.  
`---

Thanks again,

Alan



Re: [O] (org-insert-headline '(4)) should insert new headline before point

2014-04-25 Thread Bastien
Hi Leonard,

I just fixed this in maint -- please let me know if it works
back as expected.

Thanks,

-- 
 Bastien