[O] Treat custom environment as verbatim on export

2015-05-22 Thread Jacob Gerlach
Hello,

I want to use a one of several custom environments for some babel
results using, for example, ":wrap myverbatim" as a header argument.
(Since I have several possible environments, I think I need to use
:wrap rather than, say, replacing "verbatim" using an export filter).

However, since this block isn't recognized as an actual verbatim
environment, markup gets processed in undesirable ways.

For example:

-
#+BEGIN_SRC sh :exports results :wrap myverbatim
echo "Hello_world"
#+END_SRC

#+RESULTS:
#+BEGIN_myverbatim
Hello_world
#+END_myverbatim
-
exports to
-
\begin{myverbatim}
Hello\(_{\text{world}}\)
\end{myverbatim}
-
instead of
-
\begin{myverbatim}
Hello_world
\end{myverbatim}
-

A couple questions:

- Is there any way I've missed to specify verbatim export as an option
for an arbitrary block/environment?

- If not, I think that I need a derived exporter to achieve this, but
the `contents' of a special-block have already had markup transcoded
by the time the derived backend function sees them. What functions
would my derived backend need to replace to allow applying verbatim
formatting to block types of my choosing?

Thanks for any tips,
Jake



Re: [O] [PATCH] org-src.el: Unescape source block on edit

2015-05-22 Thread Kyle Meyer
Nicolas Goaziou  wrote:
[...]
> Thanks. However, this wouldn't work as `org-src--edit-element' is called
> on elements that doesn't need escaping, e.g., a footnote definition.

I see.

> Anyway, it is fixed in 71641bc3a0882bb16fb2b62ebef8ebc98ba0e3d8.

Yes, this commit fixes the issue I originally reported, and it also
fixes an issue with editing fixed-width blocks.

Before, editing

: abc

would lead to

: : abc

Thank you.

--
Kyle



Re: [O] [RFC] Org linting library

2015-05-22 Thread Nicolas Goaziou
Rainer M Krug  writes:

> 1) not identifying header argument with +
> ,
> | #+PROPERTY: header-args+ :tangle no
> `
>
> results in
>
> ,
> | 87 high  Unknown header argument ""
> `

This should be fixed.

> 2) not knowing header argument "file-ext" from R
> ,
> | #+begin_src R  :exports results :file-ext pdf :results graphics :width 8 
> :height 8
> | plotSensMainEffAll(files)
> | #+end_src
> `
>
> results in
>
> ,
> |   1691 high  Unknown header argument "file-ext"
> `

Fixed too.

> 3) I am not to sure about this one, but in LaTeX labels of figures are
> with the colon. Initially, I had #+LABEL: instead of #+NAME: but changed
> it as one should use #+NAME instead of #+LABEL, but now I get the following:
>
> ,
> | #+CAPTION: The caption
> | #+NAME: fig:sensDefault
> | #+RESULTS: fig_sensDefault
> | [[file:./output/fig_sensDefault.pdf]]
> `
>
> results in
>
> ,
> |   1686 high  Name "fig:sensDefault" contains a colon; Babel cannot use it 
> as input
> `
>
> I agree with the fact that Babel can not use it as input, but I do not
> want to use it as input, only as a label in LaTeX for the figure?

Then you can ignore safely this report.

> According to the manual this should work:
>
> http://orgmode.org/manual/Images-and-tables.html:
>
> ,
> |  #+CAPTION: This is the caption for the next figure link (or table)
> |  #+NAME:   fig:SED-HR4049
> |  [[./img/a.jpg]]
> `
>
> So maybe check if this is part of a construct with a CAPTION or if it
> really is used as an input somewhere?

It is quite complicated to check if it is an input somewhere, e.g., it
could be used as an input in another document.

> 4) references where :FILE is a normal PROPERTY: (or isn't it?)
>
> ,
> | ** Koivusalo2002 - Snow processes in a forest clearing and in a coniferous 
> forest
> | :PROPERTIES:
> | :TITLE:Snow processes in a forest clearing and in a coniferous forest
> | :BTYPE:article
> | :CUSTOM_ID: Koivusalo2002
> | :AUTHOR:   Koivusalo, H. and Kokkonen, T.
> | :DOI:  10.1016/S0022-1694(02)00031-8
> | :FILE: file:./Literature/Koivusalo_2002.pdf
> | :ISSN: 00221694
> | :JOURNAL:  Journal of Hydrology
> | :KEYWORDS: energy,forest,mathematical models,melt,snow,uxes
> | :MENDELEY-GROUPS: Energy Balance,bibliography
> | :MONTH:may
> | :NUMBER:   1-4
> | :PAGES:145--164
> | :URL:  http://linkinghub.elsevier.com/retrieve/pii/S0022169402000318
> | :VOLUME:   262
> | :YEAR: 2002
> | :END:
> | [[file:Literature/Koivusalo2002.pdf]]
> `
>
> results in
>
> ,
> |  11221 high  Special property "FILE" found in a properties drawer
> `

"FILE" is a special property, i.e., it shouldn't be set in a property
drawer. See (info "(org) Special properties").

> I am really happy with org-lint - thanks a lot. This makes working with
> org files much easier.

Thanks for all the feedback.


Regards,



Re: [O] [PATCH] org-src.el: Unescape source block on edit

2015-05-22 Thread Nicolas Goaziou
Hello,

Kyle Meyer  writes:

> org-edit-src-code doesn't seem to be unescaping correctly.  For
> example, calling org-edit-src-code on
>
> #+begin_src org
>   ,* h
> #+end_src
>
> puts ",* h", not "* h", in the source buffer.  When exiting, ",*" is
> escaped again, resulting in
>
> #+begin_src org
>   ,,* h
> #+end_src
>
> The attached patch moves the unescaping call from org-edit-src-code to
> org-src--edit-element so that the source string is unescaped
> regardless of whether it was passed as an argument or extracted
> directly from the buffer.

Thanks. However, this wouldn't work as `org-src--edit-element' is called
on elements that doesn't need escaping, e.g., a footnote definition.

Anyway, it is fixed in 71641bc3a0882bb16fb2b62ebef8ebc98ba0e3d8.


Regards,

-- 
Nicolas Goaziou



Re: [O] [bug] orgstruct++-mode breaks backward-sentence

2015-05-22 Thread Rasmus
Hi,

Sorry for bringing this thread up again.

Nicolas Goaziou  writes:

> Rasmus  writes:
>
>> Forget about fill-paragraph.  Try this with test-org as nil and non-nil:
>>
>> (let ((test-org nil))
>>   (switch-to-buffer "test.org")
>>   (if test-org (org-mode) (text-mode))
>>   (erase-buffer)
>>   (insert "1. foo bar\n   baz")
>>   (backward-sentence))
>>
>> When the buffer is in org-mode backward sentence behaves differently from
>> when it's in text-mode.  I think text-mode behaves correctly.
>
> This should be fixed in 98ec17e204689f415200a2930fc148bf6a4dfe49. Thank
> you.

Actually when calling just backward-sentence this still seems broken.

(mapcar (lambda (mode)
  (with-temp-buffer
(text-mode)
(funcall mode)
(insert"- foo
  bar")
(backward-sentence)
(point)))
'(text-mode org-mode turn-on-orgstruct++))
=> (1 9 9)

It only works if I explicitly call org-backward-sentence, not
backward-sentence.  In orgstruct-mode this seems unfortunate.

—Rasmus

-- 
Spil noget med Slayer!



Re: [O] customize LOGBOOK note intro text?

2015-05-22 Thread Kyle Meyer
Lawrence Bottorff  wrote:
> When I do C-c C-z to start a LOGBOOK entry note, the text reads "Note taken
> on", then the timestamp. Is there any way to customize the text -- or get
> rid of it and have just the timestamp?

See org-log-note-headings.

-- 
Kyle



[O] customize LOGBOOK note intro text?

2015-05-22 Thread Lawrence Bottorff
When I do C-c C-z to start a LOGBOOK entry note, the text reads "Note taken
on", then the timestamp. Is there any way to customize the text -- or get
rid of it and have just the timestamp?

LB


Re: [O] float control in org

2015-05-22 Thread Zhihao Ding
Thanks a lot Rasmus. 

Zhihao

> On 22 May 2015, at 11:07, Rasmus  wrote:
> 
> Zhihao Ding  writes:
> 
>> Hi there, 
>> 
>> Could I ask for some advice on using the latex float 
>> package in org mode? I’d like to have some control on 
>> the positions of the figures, tables, code blocks etc. 
>> Currently I am doing it using latex entirely, just for 
>> my code blocks, as below 
>> 
>> #+BEGIN_LaTeX
>> \floatstyle{ruled}
>> \newfloat{Program}{tbp}{lop}[section]
>> \begin{Program}
>> \begin{verbatim}
>>  ./somescripts.sh someargs
>> \end{verbatim}
>> \caption{my caption}
>> \label{mylabel}
>> \end{Program}
>> #+END_LaTeX
>> 
>> There must be better ways of doing this?
> 
> Maybe something like this
> 
> #+latex_header: \floatstyle{ruled}
> #+latex_header: \newfloat{program}{tbp}{lop}[section]
> 
> #+caption: my program
> #+begin_program
> #+BEGIN_SRC sh
> ./somescripts.sh someargs
> #+END_SRC
> #+end_program
> 
> —Rasmus
> 
> -- 
> It was you, Jezebel, it was you



[O] Using buffers instead of string when processing and passing org-babel results

2015-05-22 Thread Bjarte Johansen
Hi,

I have been wondering: Is there a reason org-babel passes around results as 
strings instead of buffers? I understand there will be more to keep track of 
and right now there is a great chance of breaking code (org-modes code and 
other people who depend on the current behaviour).

However, I just did an elementary test with the following

#+BEGIN_SRC bash :results verbatim
  cat file.txt
#+END_SRC

I created the file with the command `base64 /dev/urandom | head -c 100M > 
file.txt`.

If I execute the script in the normal way it takes more then half a minute to 
complete. If I on the other hand convert every point on the path that expect it 
to be a string to be a buffer instead it takes less than 5 seconds to complete 
the script and insert the result into the buffer.

I understand that it might not be normal to insert these big files into the 
org-buffer, but the problem is also there if you want to silence the result and 
pass it from script to script. The creation of big strings is really slow.

I also feel that buffers are more natural vessels for the results. They are 
easier to manipulate than strings in Emacs and are much much faster. A big 
problem however is how do we handle the buffers that are created? They won’t be 
garage collected, so we need a way to safely kill them when we no longer need 
them.

Is this something that org-mode is interested in? I could try to work on it, 
but if org-mode isn’t interested in the change I am not sure I will bother.

Regards,
Bjarte


Re: [O] float control in org

2015-05-22 Thread Rasmus
Zhihao Ding  writes:

> Hi there, 
>
> Could I ask for some advice on using the latex float 
> package in org mode? I’d like to have some control on 
> the positions of the figures, tables, code blocks etc. 
> Currently I am doing it using latex entirely, just for 
> my code blocks, as below 
>
>  #+BEGIN_LaTeX
>  \floatstyle{ruled}
>  \newfloat{Program}{tbp}{lop}[section]
>  \begin{Program}
>  \begin{verbatim}
>   ./somescripts.sh someargs
>  \end{verbatim}
>  \caption{my caption}
>  \label{mylabel}
>  \end{Program}
>  #+END_LaTeX
>
>  There must be better ways of doing this?

Maybe something like this

#+latex_header: \floatstyle{ruled}
#+latex_header: \newfloat{program}{tbp}{lop}[section]

#+caption: my program
#+begin_program
#+BEGIN_SRC sh
./somescripts.sh someargs
#+END_SRC
#+end_program

—Rasmus

-- 
It was you, Jezebel, it was you





[O] float control in org

2015-05-22 Thread Zhihao Ding
Hi there, 

Could I ask for some advice on using the latex float 
package in org mode? I’d like to have some control on 
the positions of the figures, tables, code blocks etc. 
Currently I am doing it using latex entirely, just for 
my code blocks, as below 

 #+BEGIN_LaTeX
 \floatstyle{ruled}
 \newfloat{Program}{tbp}{lop}[section]
 \begin{Program}
 \begin{verbatim}
./somescripts.sh —someargs
 \end{verbatim}
 \caption{my caption}
 \label{mylabel}
 \end{Program}
 #+END_LaTeX

 There must be better ways of doing this?

Thanks very much!

Zhihao

Re: [O] org-mode, tikz and beamer

2015-05-22 Thread Bernhard Schmitz
Hi  Cédric,

If I understand it correctly, you want to include a graphical representation of 
you headlines into you beamer file, created via tikz/pgf.
That sounds quite similar to what I'm doing at the moment, only I create gantt 
charts instead of mind maps.
As far as I can tell, the best possibility to do that inside of emacs, is to 
use custom dynamic blocks. 
http://orgmode.org/manual/Dynamic-blocks.html
Simply create your own org-dblock-write:... function that parses the file and 
creates the tikz output you want.
You can have a look at org-dblock-write:clocktable and 
org-dblock-write:columnview for inspiration.
I think using org-element-parse-buffer and org-element-map should get you what 
you need.

You can also have a look at my gantt chart creation here:
https://github.com/HeyFlash/emacs-stuff/tree/master/experiments
(One el file and one org file for testing)
You can probably ignore most of the file, as you don't need the complex time 
calculations I do.
Keep in mind that this is wip and I'm not an experienced elisp / org person, so 
if anyone has better suggestions, listen to them.

I will be without internet from later today until the middle of next week, so 
if you have any questions I will not be responding until then.

Regards,
Bernhard

> -Ursprüngliche Nachricht-
> Von: cédric ody [mailto:cedric.lis...@gmail.com]
> Gesendet: Donnerstag, 21. Mai 2015 16:41
> An: emacs-orgmode@gnu.org
> Betreff: [O] org-mode, tikz and beamer
> 
> Dear org-mode users,
> 
> I have used org-mode for some months now. I find it very useful. I
> have recently used it to prepare mathematic teaching lessons using the
> beamer exporter.
> 
> I wanted to combine org-mode and tikz latex's package from latex In
> order to insert some kind of mind-mapping from the headlines between
> the main parts of the lesson. I enclose an example so that you can see
> what I am talking about. Note that you can move forth and back through
> the presentation with hyperlinks. Note also only the chapter "Droites
> dans le plan" is filled so most of links fail.
> 
> I have done that from a single org-mode file using shell scripting
> calling org-mode and emacs in a batch mode way.
> 
> Before improving my shell script, I would like to know if there is a
> proper way to handle that within org-mode in lisp language. I have no
> idea about how to do that but someone may know if it is possible or
> not, and may give me hints to follow so that I could have a try.
> 
> Thanks,
> 
> Cédric Ody


Re: [O] [RFC] Org linting library

2015-05-22 Thread Rainer M Krug
Nicolas Goaziou  writes:

> Rainer M Krug  writes:
>
>> Well - now it does. The following produces the error:
>>
>> #+PROPERTY: header-args  :tangle-mode (identity #o444)
>>
>> * Some code
>>
>> #+begin_src R :results nons
>>
>> #+end_src
>>
>> The problem is the (identity #o444) which is causing the problem.
>
> Fixed. Thank you.

Thanks - working.

Now there re a few more lints giving wrong warnings:

1) not identifying header argument with +
,
| #+PROPERTY: header-args+ :tangle no
`

results in

,
| 87 high  Unknown header argument ""
`

2) not knowing header argument "file-ext" from R
,
| #+begin_src R  :exports results :file-ext pdf :results graphics :width 8 
:height 8
| plotSensMainEffAll(files)
| #+end_src
`

results in

,
|   1691 high  Unknown header argument "file-ext"
`

3) I am not to sure about this one, but in LaTeX labels of figures are
with the colon. Initially, I had #+LABEL: instead of #+NAME: but changed
it as one should use #+NAME instead of #+LABEL, but now I get the following:

,
| #+CAPTION: The caption
| #+NAME: fig:sensDefault
| #+RESULTS: fig_sensDefault
| [[file:./output/fig_sensDefault.pdf]]
`

results in

,
|   1686 high  Name "fig:sensDefault" contains a colon; Babel cannot use it as 
input
`

I agree with the fact that Babel can not use it as input, but I do not
want to use it as input, only as a label in LaTeX for the figure?

According to the manual this should work:

http://orgmode.org/manual/Images-and-tables.html:

,
|  #+CAPTION: This is the caption for the next figure link (or table)
|  #+NAME:   fig:SED-HR4049
|  [[./img/a.jpg]]
`

So maybe check if this is part of a construct with a CAPTION or if it
really is used as an input somewhere?

4) references where :FILE is a normal PROPERTY: (or isn't it?)

,
| ** Koivusalo2002 - Snow processes in a forest clearing and in a coniferous 
forest
| :PROPERTIES:
| :TITLE:Snow processes in a forest clearing and in a coniferous forest
| :BTYPE:article
| :CUSTOM_ID: Koivusalo2002
| :AUTHOR:   Koivusalo, H. and Kokkonen, T.
| :DOI:  10.1016/S0022-1694(02)00031-8
| :FILE: file:./Literature/Koivusalo_2002.pdf
| :ISSN: 00221694
| :JOURNAL:  Journal of Hydrology
| :KEYWORDS: energy,forest,mathematical models,melt,snow,uxes
| :MENDELEY-GROUPS: Energy Balance,bibliography
| :MONTH:may
| :NUMBER:   1-4
| :PAGES:145--164
| :URL:  http://linkinghub.elsevier.com/retrieve/pii/S0022169402000318
| :VOLUME:   262
| :YEAR: 2002
| :END:
| [[file:Literature/Koivusalo2002.pdf]]
`

results in

,
|  11221 high  Special property "FILE" found in a properties drawer
`

That is all I can see at the moment.


Here is the ECM:

--8<---cut here---start->8---
#+PROPERTY: header-args  :tangle-mode (identity #o444)
#+PROPERTY: header-args  :tangle-mode (identity #o444)
#+PROPERTY: header-args+ :tangle no

* file-ext


#+begin_src R  :exports results :file-ext pdf :results graphics :width 8 
:height 8
cat(23)
#+end_src

* And the : in NAME

#+CAPTION: The caption
#+NAME: fig:sensDefault
#+RESULTS: fig_sensDefault
[[file:./output/fig_sensDefault.pdf]]

* References

** Mahat2013 - Testing above- and below-canopy representations of turbulent 
fluxes in an energy balance snowmelt model
:PROPERTIES:
:TITLE:Testing above- and below-canopy representations of turbulent fluxes 
in an energy balance snowmelt model
:BTYPE:article
:CUSTOM_ID: Mahat2013
:AUTHOR:   Mahat, Vinod and Tarboton, David G. and Molotch, Noah P.
:DOI:  10.1002/wrcr.20073
:FILE: :Users/rainerkrug/Documents/Mendeley/Files/Mahat, Tarboton, 
Molotch/Mahat, Tarboton, Molotch\_2013\_Testing above- and below-canopy 
representations of turbulent fluxes in an energy balance snowmelt model.pdf:pdf
:ISSN: 00431397
:JOURNAL:  Water Resources Research
:MONTH:feb
:NUMBER:   2
:PAGES:1107--1122
:URL:  http://doi.wiley.com/10.1002/wrcr.20073
:VOLUME:   49
:YEAR: 2013
:END:
[[file:Literature/Mahat2013.pdf]]
--8<---cut here---end--->8---

which results in
,
|  3 high  Unknown header argument ""
|  8 high  Unknown header argument "file-ext"
| 15 high  Name "fig:sensDefault" contains a colon; Babel cannot use it as 
input
| 17 low   Link to non-existent local file "./output/fig_sensDefault.pdf"
| 28 high  Special property "FILE" found in a properties drawer
| 38 low   Link to non-existent local file "Literature/Mahat2013.pdf"
`

The "Link to non-existent ..." are obvious.

I am really happy with org-lint - thanks a lot. This makes working with
org files much easier.

Thanks,

Rainer

>
> Regards,

-- 
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 :  

[O] org-caldav: VTODO entries without DTSTART

2015-05-22 Thread Tractatus
Hello,

I am testing syncing my ical files via Radicale CalDAV Server to org
usinf org-caldav. For some files I get an error "Format specifier
doesn't match argument type". [2]

In my ical files generated by Mozilla Icedove are VTODO entries [1]
without a DTSTART field. [1] I think this causes the error.
Since I do not care to sync VTODO'S is there a way to filter them out
before they are processed? Can this error be avoided?

The code seems to try to deal with missing dtstarts:
https://github.com/dengste/org-caldav/blob/master/org-caldav.el#L1198
but the error seems to occur before that:
https://github.com/dengste/org-caldav/blob/master/org-caldav.el#L1175


[1]
BEGIN:VTODO
CREATED:20150522T053330Z
LAST-MODIFIED:20150522T053352Z
DTSTAMP:20150522T053352Z
UID:b3a0257d-cf04-4675-825d-f47b802e5838
SUMMARY:test TODO
X-RADICALE-NAME:b3a0257d-cf04-4675-825d-f47b802e5838.ics
END:VTODO

[2]
Debugger entered--Lisp error: (error "Format specifier doesn't match
argument type") format("%02d:%02d" "nil" nil)
  icalendar--datetime-to-colontime(nil)
  (let* ((calendar-date-style ...) (ical-list ...) (e ...)
(zone-map ...) (dtstart ...) (dtstart-zone ...) (dtstart-dec ...)
(start-d ...) (start-t ...) (dtend ...) (dtend-zone ...)
(dtend-dec ...) (dtend-1-dec ...) end-d end-1-d end-t (summary ...)
(description ...) (rrule ...) (rdate ...) (duration ...)) (if (and
dtstart ...) (setq start-t nil)) (when duration (let ... ... ... ...))
(setq end-d (if dtend-dec ... start-d)) (setq end-1-d (if
dtend-1-dec ... start-d)) (setq end-t (if ... ... start-t)) (list
start-d start-t (if end-t end-d end-1-d) end-t summary description))
org-caldav-convert-event()