Re: [O] Contribution: ob-groovy.el

2013-12-26 Thread Thomas S. Dye
Aloha Miro,

Thanks for your contribution to Org mode.

Have you signed the FSF papers so that ob-groovy.el can be added to Org
mode?  See:
http://orgmode.org/worg/org-contribute.html#sec-6

Contributions by authors who have not signed the FSF papers are
typically added to the contrib directory and are not distributed with
Emacs.

Also, are you willing to draft documentation?  For a link to a
documentation template, see:
http://orgmode.org/worg/org-contrib/babel/languages.html

I was going to suggest that you use the Scala documentation as a guide,
but it doesn't exist! In fact, Scala doesn't appear in Worg's list of
languages supported by Babel.  One of those days ...

Thanks again for your contribution.

All the best,
Tom

Miro Bezjak  writes:

> Hi all,
>
> I would like to contribute org-babel functions for Groovy evaluation. I
> simply
> copy/pasted ob-scala.el and made appropriate changes.
>
> I'm attaching ob-groovy.el as a file.
>
> All 3 tests pass, although I haven't created `testing/test-ob-groovy.el` -
> I'll
> look into that.
>
> --- testing last result 
> #+BEGIN_SRC groovy
> println "ignored"
> 1 + 2
> #+END_SRC
>
> #+RESULTS:
> : 3
> 
>
> --- testing results output --
> #+BEGIN_SRC groovy :results output
> println '1'
> println '2'
> println 1 + 2
> #+END_SRC
>
> #+RESULTS:
> =1
> 2
> 3
> 
>
> --- testing table --
> #+BEGIN_SRC groovy :results verbatim raw
> """
> | 1 | 2
> |--
> | a | b
> """.trim()
> #+END_SRC
>
> #+RESULTS:
> | 1 | 2 |
> |---+---|
> | a | b |
> 
>
>
> Kind Regards,
> Miro Bezjak
> Hi all,
>
> I would like to contribute org-babel functions for Groovy evaluation.
> I simply
> copy/pasted ob-scala.el and made appropriate changes.
>
> I'm attaching ob-groovy.el as a file.
>
> All 3 tests pass, although I haven't created
> `testing/test-ob-groovy.el` - I'll
> look into that.
>
> --- testing last result 
> #+BEGIN_SRC groovy
> println "ignored"
> 1 + 2
> #+END_SRC
>
> #+RESULTS:
> : 3
> 
>
> --- testing results output --
> #+BEGIN_SRC groovy :results output
> println '1'
> println '2'
> println 1 + 2
> #+END_SRC
>
> #+RESULTS:
> =1
> 2
> 3
> 
>
> --- testing table --
> #+BEGIN_SRC groovy :results verbatim raw
> """
> | 1 | 2
> |--
> | a | b
> """.trim()
> #+END_SRC
>
> #+RESULTS:
> | 1 | 2 |
> |---+---|
> | a | b |
> 
>
> Kind Regards,
> Miro Bezjak
>
>

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



[O] Contribution: ob-groovy.el

2013-12-26 Thread Miro Bezjak
Hi all,

I would like to contribute org-babel functions for Groovy evaluation. I
simply
copy/pasted ob-scala.el and made appropriate changes.

I'm attaching ob-groovy.el as a file.

All 3 tests pass, although I haven't created `testing/test-ob-groovy.el` -
I'll
look into that.

--- testing last result 
#+BEGIN_SRC groovy
println "ignored"
1 + 2
#+END_SRC

#+RESULTS:
: 3


--- testing results output --
#+BEGIN_SRC groovy :results output
println '1'
println '2'
println 1 + 2
#+END_SRC

#+RESULTS:
=1
2
3


--- testing table --
#+BEGIN_SRC groovy :results verbatim raw
"""
| 1 | 2
|--
| a | b
""".trim()
#+END_SRC

#+RESULTS:
| 1 | 2 |
|---+---|
| a | b |



Kind Regards,
Miro Bezjak
;;; ob-groovy.el --- org-babel functions for Groovy evaluation

;; Copyright (C) 2013 Free Software Foundation, Inc.

;; Author: Miro Bezjak
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see .

;;; Commentary:
;; Currently only supports the external execution.  No session support yet.

;;; Requirements:
;; - Groovy language :: http://groovy.codehaus.org
;; - Groovy major mode :: Can be installed from MELPA or
;;   https://github.com/russel/Emacs-Groovy-Mode

;;; Code:
(require 'ob)
(eval-when-compile (require 'cl))

(defvar org-babel-tangle-lang-exts) ;; Autoloaded
(add-to-list 'org-babel-tangle-lang-exts '("groovy" . "groovy"))
(defvar org-babel-default-header-args:groovy '())
(defvar org-babel-groovy-command "groovy"
  "Name of the command to use for executing Groovy code.")

(defun org-babel-execute:groovy (body params)
  "Execute a block of Groovy code with org-babel.  This function is
called by `org-babel-execute-src-block'"
  (message "executing Groovy source code block")
  (let* ((processed-params (org-babel-process-params params))
 (session (org-babel-groovy-initiate-session (nth 0 processed-params)))
 (vars (nth 1 processed-params))
 (result-params (nth 2 processed-params))
 (result-type (cdr (assoc :result-type params)))
 (full-body (org-babel-expand-body:generic
 body params))
 (result (org-babel-groovy-evaluate
  session full-body result-type result-params)))

(org-babel-reassemble-table
 result
 (org-babel-pick-name
  (cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
 (org-babel-pick-name
  (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))


(defun org-babel-groovy-table-or-string (results)
  "Convert RESULTS into an appropriate elisp value.
If RESULTS look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
  (org-babel-script-escape results))


(defvar org-babel-groovy-wrapper-method

  "class Runner extends Script {
def out = new PrintWriter(new ByteArrayOutputStream())
def run() { %s }
}

println(new Runner().run())
")


(defun org-babel-groovy-evaluate
  (session body &optional result-type result-params)
  "Evaluate BODY in external Groovy process.
If RESULT-TYPE equals 'output then return standard output as a string.
If RESULT-TYPE equals 'value then return the value of the last statement
in BODY as elisp."
  (when session (error "Sessions are not (yet) supported for Groovy"))
  (case result-type
(output
 (let ((src-file (org-babel-temp-file "groovy-")))
   (progn (with-temp-file src-file (insert body))
  (org-babel-eval
   (concat org-babel-groovy-command " " src-file) ""
(value
 (let* ((src-file (org-babel-temp-file "groovy-"))
(wrapper (format org-babel-groovy-wrapper-method body)))
   (with-temp-file src-file (insert wrapper))
   (let ((raw (org-babel-eval
   (concat org-babel-groovy-command " " src-file) "")))
 (org-babel-result-cond result-params
	   raw
   (org-babel-groovy-table-or-string raw)))


(defun org-babel-prep-session:groovy (session params)
  "Prepare SESSION according to the header arguments specified in PARAMS."
  (error "Sessions are not (yet) supported for Groovy"))

(defun org-babel-groovy-initiate-session (&optional session)
  "If

Re: [O] tables on org-mode.

2013-12-26 Thread Sharon Kimble
On Thu, 26 Dec 2013 18:27:21 +
Sharon Kimble  wrote:

> On Thu, 26 Dec 2013 17:15:47 +0100
> Nicolas Goaziou  wrote:
> 
> > Hello,
> > 
> > Sharon Kimble  writes:
> > 
> > > This in org-mode -
> > > ** Table 1. Breast Cancer and Hormone Replacement Therapy: Results
> > > From the Reanalysis of Epidemiologic Studies by The Collaborative
> > > Group On Hormonal Factors in Breast Cancer. | Time on HRT   |
> > > Breast Cancers Diagnosed During 20 Years Between the Ages of 50-50
> > > Years | Extra Breast Cancers |
> > > |---+--+--|
> > > | / |
> > > <
> > > | >| | Never |
> > > 45/1000
> > > | -| | Used 5 years  |
> > > 47/1000
> > > | 2/1000   | | Used 10 years |
> > > 51/1000
> > > | 6/1000   | | Used 15 years |
> > > 57/1000
> > > | 12/1000  | /Data from Beral V. Lancet.
> > > 1997;350:1047-1059.(3)/
> > >
> > > Shows up when exported as this section of a screenshot (attached),
> > > where it can clearly be seen as unaligned and with no visible cell
> > > borders.
> > >
> > > So how do I get them both please?
> > 
> > What Org version do you use? I cannot reproduce it in 8.2.4.
> > 
> I would've said "the current git version" which has been regularly
> updated since the end of November. But, I looked in my .emacs file and
> I couldn’t find it! So it now says - 
> ;;(add-to-list 'load-path "/home/boudiccas/git/org-mode")
> (require 'org-mode)
> (add-hook 'org-mode-hook 'turn-on-font-lock)
> 
> And I found out that it wasn’t compiled so that’s now done as -
> sudo emacs -batch -Q -L lisp
> -l /home/boudiccas/git/org-mode/mk/org-fixup -f
> rg-make-autoloads-compile
> 
> But I still have the same problem when exporting via org2blog. The
> relevant url is
> http://test.tgmeds.org.uk/2013/12/26/postmenopausal-hormone-replacement-therapy-and-breast-cancer/
> This shows the finished org-mode -> org2blog posting, but the tables
> just aren't coming through properly.
> 
It appears that I have 'org' installed from git, but also from a package
Org-mode version 8.2.4 (8.2.4-17-gfc3857-elpa @ 
/home/boudiccas/.emacs.d/elpa/org-20131223/)

So how do I just use the git version please?

Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
my git repo = https://bitbucket.org/boudiccas/dots
Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.3.2
Registered Linux user 561944


signature.asc
Description: PGP signature


Re: [O] tables on org-mode.

2013-12-26 Thread Sharon Kimble
On Thu, 26 Dec 2013 17:15:47 +0100
Nicolas Goaziou  wrote:

> Hello,
> 
> Sharon Kimble  writes:
> 
> > This in org-mode -
> > ** Table 1. Breast Cancer and Hormone Replacement Therapy: Results
> > From the Reanalysis of Epidemiologic Studies by The Collaborative
> > Group On Hormonal Factors in Breast Cancer. | Time on HRT   |
> > Breast Cancers Diagnosed During 20 Years Between the Ages of 50-50
> > Years | Extra Breast Cancers |
> > |---+--+--|
> > | / |
> > <
> > | >| | Never |
> > 45/1000
> > | -| | Used 5 years  |
> > 47/1000
> > | 2/1000   | | Used 10 years |
> > 51/1000
> > | 6/1000   | | Used 15 years |
> > 57/1000
> > | 12/1000  | /Data from Beral V. Lancet.
> > 1997;350:1047-1059.(3)/
> >
> > Shows up when exported as this section of a screenshot (attached),
> > where it can clearly be seen as unaligned and with no visible cell
> > borders.
> >
> > So how do I get them both please?
> 
> What Org version do you use? I cannot reproduce it in 8.2.4.
> 
I would've said "the current git version" which has been regularly
updated since the end of November. But, I looked in my .emacs file and
I couldn’t find it! So it now says - 
;;(add-to-list 'load-path "/home/boudiccas/git/org-mode")
(require 'org-mode)
(add-hook 'org-mode-hook 'turn-on-font-lock)

And I found out that it wasn’t compiled so that’s now done as -
sudo emacs -batch -Q -L lisp -l /home/boudiccas/git/org-mode/mk/org-fixup -f 
rg-make-autoloads-compile

But I still have the same problem when exporting via org2blog. The
relevant url is
http://test.tgmeds.org.uk/2013/12/26/postmenopausal-hormone-replacement-therapy-and-breast-cancer/
This shows the finished org-mode -> org2blog posting, but the tables
just aren't coming through properly.

Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
my git repo = https://bitbucket.org/boudiccas/dots
Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.3.2
Registered Linux user 561944


signature.asc
Description: PGP signature


Re: [O] LaTeX export, problem with quotes

2013-12-26 Thread Thomas S. Dye
Aloha Nicolas,

Ah, I see what's happening now. I've set up asynchronous export to use
the Org mode that ships with Emacs, rather than the one from the git
repo. Of course, that doesn't track your changes.

In this case, where many potential users of my reproducible research
document aren't using the latest Org mode, a file-specific
org-entities-user entry looks like the best solution.

Thanks for your patience as I puzzled this out online.

All the best,
Tom

Nicolas Goaziou  writes:

> t...@tsdye.com (Thomas S. Dye) writes:
>
>> I'm getting the same incorrect result as before with:
>>
>> Org-mode version 8.2.4 (release_8.2.4-391-g954168 @
>> /Users/dk/.emacs.d/src/org-mode/lisp/)
>
> Did you reload Org? I cannot reproduce the problem anymore.
>
>>> Nevertheless, there will always be failing cases in smart quote
>>> detection (see `org-export-smart-quotes-regexps').
>>
>> I can't comprehend the regular expression(s) there, unfortunately. If it
>> is the case that there will always be failing cases, and my goal is to
>> create a stable piece of reproducible research, would you recommend an
>> approach that sets org-entities-user appropriately at the file-local
>> level, or something else?
>
> I mean that choosing between an opening quote, a closing quote, or
> nothing is done with a regexp. It cannot cover all cases, and some
> tricky situations will fool smart quote mechanism.
>
> If that happens, and if `org-export-smart-quotes-regexps' cannot be
> improved to handle the situation consistently, you will have to specify
> LaTeX quote code manually (e.g. with an export snippet, or an entity).
>
> I cannot see the link with reproducible research, though.
>
>
> Regards,

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com



Re: [O] LaTeX export, problem with quotes

2013-12-26 Thread Thomas S. Dye
Nicolas Goaziou  writes:

> t...@tsdye.com (Thomas S. Dye) writes:
>
>> I'm getting the same incorrect result as before with:
>>
>> Org-mode version 8.2.4 (release_8.2.4-391-g954168 @
>> /Users/dk/.emacs.d/src/org-mode/lisp/)
>
> Did you reload Org? I cannot reproduce the problem anymore.

Hmm, "later" and "{l}ater" both work for me, but "[l]ater" and "(l)ater"
both fail.  I'm exporting asynchronously.

> I mean that choosing between an opening quote, a closing quote, or
> nothing is done with a regexp. It cannot cover all cases, and some
> tricky situations will fool smart quote mechanism.
>
> If that happens, and if `org-export-smart-quotes-regexps' cannot be
> improved to handle the situation consistently, you will have to specify
> LaTeX quote code manually (e.g. with an export snippet, or an entity).
>
> I cannot see the link with reproducible research, though.

I'm perhaps too wary of regressions here.

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com



Re: [O] Fwd: property drawer search -- org-element-headline-parser

2013-12-26 Thread Nicolas Goaziou
Hello,

Keith David Bershatsky  writes:

> Between the version 7.9.3f and 8.2.3a, the org team changed the
> property drawer from lowercase to capital letters for the
> org-element-headline-parser

Indeed. That was changed before 8.0 release.

> -- this resulted in several hours of lost time tracking down the
> issue. The issue is now resolved -- I hope there was a good reason for
> changing it.

Yes, there was.

Consider the conflict introduced in the following case, if we cannot
distinguish a hard-coded property and a property coming from a property
drawer.

  * Headline
:PROPERTIES:
:BEGIN: something
:END:


Regards,

-- 
Nicolas Goaziou



Re: [O] LaTeX export, problem with quotes

2013-12-26 Thread Nicolas Goaziou
t...@tsdye.com (Thomas S. Dye) writes:

> I'm getting the same incorrect result as before with:
>
> Org-mode version 8.2.4 (release_8.2.4-391-g954168 @
> /Users/dk/.emacs.d/src/org-mode/lisp/)

Did you reload Org? I cannot reproduce the problem anymore.

>> Nevertheless, there will always be failing cases in smart quote
>> detection (see `org-export-smart-quotes-regexps').
>
> I can't comprehend the regular expression(s) there, unfortunately. If it
> is the case that there will always be failing cases, and my goal is to
> create a stable piece of reproducible research, would you recommend an
> approach that sets org-entities-user appropriately at the file-local
> level, or something else?

I mean that choosing between an opening quote, a closing quote, or
nothing is done with a regexp. It cannot cover all cases, and some
tricky situations will fool smart quote mechanism.

If that happens, and if `org-export-smart-quotes-regexps' cannot be
improved to handle the situation consistently, you will have to specify
LaTeX quote code manually (e.g. with an export snippet, or an entity).

I cannot see the link with reproducible research, though.


Regards,

-- 
Nicolas Goaziou



Re: [O] LaTeX export, problem with quotes

2013-12-26 Thread Thomas S. Dye
Aloha Nicolas,

Nicolas Goaziou  writes:

> Hello,
>
> t...@tsdye.com (Thomas S. Dye) writes:
>
>> I'm having a problem with exporting quotes.  I have the #+OPTIONS ':t.
>>
>> This input in the Org mode file:
>>
>> "[l]ater walls ..."
>>
>> produces this in the tex file (open quote wrong, close quote OK):
>> "[l]ater walls ...''
>>
>> I'm expecting this in the tex file:
>> ''[l]ater walls ...''
>
> I fixed it in maint. Thank you for reporting it.

I'm getting the same incorrect result as before with:

Org-mode version 8.2.4 (release_8.2.4-391-g954168 @ 
/Users/dk/.emacs.d/src/org-mode/lisp/)

>
> Nevertheless, there will always be failing cases in smart quote
> detection (see `org-export-smart-quotes-regexps').

I can't comprehend the regular expression(s) there, unfortunately. If it
is the case that there will always be failing cases, and my goal is to
create a stable piece of reproducible research, would you recommend an
approach that sets org-entities-user appropriately at the file-local
level, or something else?

All the best,
Tom

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



Re: [O] tables on org-mode.

2013-12-26 Thread Nicolas Goaziou
Hello,

Sharon Kimble  writes:

> This in org-mode -
> ** Table 1. Breast Cancer and Hormone Replacement Therapy: Results From the 
> Reanalysis of Epidemiologic Studies by The Collaborative Group On Hormonal 
> Factors in Breast Cancer.
> | Time on HRT   | Breast Cancers Diagnosed During 20 Years Between the Ages 
> of 50-50 Years | Extra Breast Cancers |
> |---+--+--|
> | / | <   
>  | >|
> | Never | 45/1000 
>  | -|
> | Used 5 years  | 47/1000 
>  | 2/1000   |
> | Used 10 years | 51/1000 
>  | 6/1000   |
> | Used 15 years | 57/1000 
>  | 12/1000  |
> /Data from Beral V. Lancet. 1997;350:1047-1059.(3)/
>
> Shows up when exported as this section of a screenshot (attached),
> where it can clearly be seen as unaligned and with no visible cell
> borders.
>
> So how do I get them both please?

What Org version do you use? I cannot reproduce it in 8.2.4.


Regards,

-- 
Nicolas Goaziou



Re: [O] tables on org-mode.

2013-12-26 Thread Sharon Kimble
On Thu, 26 Dec 2013 14:25:12 +
Sharon Kimble  wrote:

> Two questions about tables in org-mode.
> 
> I have this as row 1 of a table -
> |Time on HRT |Breast Cancers Diagnosed During 20 Years Between the
> Ages of 50-50 Years |Extra Breast Cancers |
> How do I keep all the other rows in that table keep that formatting
> when the document is exported please?
> 
> And, following on, how do I get visible cell boundaries showing in
> that table please? So that each table has a visible border, as does
> each cell?

This in org-mode -
** Table 1. Breast Cancer and Hormone Replacement Therapy: Results From the 
Reanalysis of Epidemiologic Studies by The Collaborative Group On Hormonal 
Factors in Breast Cancer.
| Time on HRT   | Breast Cancers Diagnosed During 20 Years Between the Ages of 
50-50 Years | Extra Breast Cancers |
|---+--+--|
| / | < 
   | >|
| Never | 45/1000   
   | -|
| Used 5 years  | 47/1000   
   | 2/1000   |
| Used 10 years | 51/1000   
   | 6/1000   |
| Used 15 years | 57/1000   
   | 12/1000  |
/Data from Beral V. Lancet. 1997;350:1047-1059.(3)/

Shows up when exported as this section of a screenshot (attached),
where it can clearly be seen as unaligned and with no visible cell
borders.

So how do I get them both please?

Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
my git repo = https://bitbucket.org/boudiccas/dots
Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.3.2
Registered Linux user 561944
<>

signature.asc
Description: PGP signature


[O] tables on org-mode.

2013-12-26 Thread Sharon Kimble
Two questions about tables in org-mode.

I have this as row 1 of a table -
|Time on HRT |Breast Cancers Diagnosed During 20 Years Between the Ages
of 50-50 Years |Extra Breast Cancers |
How do I keep all the other rows in that table keep that formatting
when the document is exported please?

And, following on, how do I get visible cell boundaries showing in that
table please? So that each table has a visible border, as does each
cell?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
my git repo = https://bitbucket.org/boudiccas/dots
Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.3.2
Registered Linux user 561944


signature.asc
Description: PGP signature


Re: [O] LaTeX export, problem with quotes

2013-12-26 Thread Nicolas Goaziou
Hello,

t...@tsdye.com (Thomas S. Dye) writes:

> I'm having a problem with exporting quotes.  I have the #+OPTIONS ':t.
>
> This input in the Org mode file:
>
> "[l]ater walls ..."
>
> produces this in the tex file (open quote wrong, close quote OK):
> "[l]ater walls ...''
>
> I'm expecting this in the tex file:
> ''[l]ater walls ...''

I fixed it in maint. Thank you for reporting it.

Nevertheless, there will always be failing cases in smart quote
detection (see `org-export-smart-quotes-regexps').


Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] LaTeX command inside TITLE

2013-12-26 Thread Nicolas Goaziou
Hello,

Xavier Garrido  writes:

> I just pull the latest git commit from orgmode and I face a strange 
> behavior when exporting orgmode document to LaTeX to PDF. Here is a very 
> minimal orgmode file
>
> #+BEGIN_SRC org
> #+TITLE: Using \alpha or \beta in orgmode title
> #+END_SRC
>
> when running emacs -q over this file and then doing M-x 
> org-latex-export-to-pdf, the generated LaTeX file does not wrap neither 
> the \alpha nor the \beta. Do I miss a recent (important) change to 
> handle such title ?

This should now be fixed. Thank you for reporting it.


Regards,

-- 
Nicolas Goaziou