Re: [O] accessing source block header arguments from exporters

2015-04-10 Thread Charles Berry
Robert Klein roklein at roklein.de writes:

 
 Hi,
 
 is there a way, to read header arguments to source blocks in the
 exporters org-exporter-src-block funktions?

Not directly. org-babel-exp-code has no provision for headers. 
They get dropped.


 E.g. is there a way to access :firstline in the example below?
 

Not exactly, but ...

If you precede the code block with

#+attr_firstline: 23 

then with point in the src block

(org-element-property :attr_firstline (org-element-context))

will return (23). And org-*-src-block functions can use it.

If you really want to use the :firstline idiom, you can add a hook in 
`org-export-before-processing-hook' to find :firstline headers and 
insert #+attr_firstline lines in the buffer copy that the exporter is using.

 #+begin_src c++ -n :firstline 23
static struct
   {
   char*entity;
   unsigned char   equiv;
   } entities[] =
 {
   { lt,   '' } ,
   { gt,   '' } ,
   { amp,  '' } ,
   { quot, '' } ,
   { trade,153 } , /* trade mark */
 #+end_src
 
 I didn't find it in the `element' structure.
 
 However, if I use
 
 #+begin_src c++ firstline=23
   // random C++
 #+end_src
 
 I could access :parameters from `element' and parse the string.
 However I'm not sure if I'd break some babel stuff or not.


C-c C-v C-i on that src block shows that 'firstline=23' is treated as 
a switch by babel. So if there is any language that tries to use that 
as a switch (or has a regexp that matches it), there could be trouble.  
 
But in C it looks innocuous.

 If I'm trying to implement a firstline feature -- source blocks with
 new line numbering (-n) beginning at a given line number -- I'd prefer
 to use :firstline, but I didn't find anything to suggest `:XXX ZZ'
 header arguments to source blocks are available to the exporters.
 

HTH,

Chuck




Re: [O] Bug: problem when exporting a org-mode file with a lots of code blocks

2015-03-10 Thread Charles Berry
XIE Yuheng xyheme at gmail.com writes:

 
 
 Bug: org-babel-parse-src-block-match reporting Wrong type argument:
 stringp, nil when exporting a org-mode file with a lots of code blocks
 [8.3beta (release_8.3beta-895-g375c83  at  
 /usr/share/emacs/site-lisp/org/)]
 
 the following is *Messages* buffer
https://www.refheap.com/98243
 the following is the org-mode file with a lot of code blocks
https://github.com/the-little-language-designer/cicada-nymph/blob/
master/cicada-nymph.org


Look at the *Messages*  buffer and you will see a list of src blocks that were 
processed without error. 

The src block *after* the last block in the list (before the error message) 
caused the error.

`org-babel-parse-src-block-match' expects a language for a src block.

Specify a language for every src block and it will export.

HTH,

Chuck




Re: [O] [BUG] on export resulting in endless evaluation

2015-02-09 Thread Charles Berry
Rainer M Krug Rainer at krugs.de writes:

 
 Sebastien Vauban sva-news@...
 writes:
 
  Rainer M Krug wrote:
  Charles Berry ccberry@... writes:
  Rainer M Krug Rainer at krugs.de writes:
  
  when exporting the fillowing org file, I get an endless loop of
  evaluations.
  
  --8---cut here---start-8---
  #+PROPERTY: header-args :exports both
  #+PROPERTY: header-args+ :results output
  * The bug
  This file create an (possibly endless?) loop during export
  * here exports both
  #+begin_src R 
  cat(13+14)
  #+end_src
  
  * and here only code
  :PROPERTIES:
  :header-args+: exports code
  :END:
  #+begin_src R 
  paste(13+14)
  #+end_src
  --8---cut here---end---8---
 

[discussion of problem, diagnostic methods, and cures deleted]


 1) I thought that header-args is simply a string, but it already seems
 to be a list?

Depends on which `header-args' one is discussing:

1. A property, as in `(org-entry-get (point) header-args t)'

2. The value of `(nth 2 (org-babel-get-src-block-info))'

3. The value of an elisp variable like `org-babel-default-header-args'

4. The 4th string matched by `org-babel-src-block-regexp' 

5. The first string matched by `org-babel-multi-line-header-regexp'

1, 4 and 5 are strings. 2 and 3 are lists.

 
[more questions deleted]
 

Exactly what happens and when is a long story, involving a bunch of 
functions.

You might start by reading `org-babel-get-src-block-info' and 
`org-babel-merge-params'.

I think most of what you need to know really is in 

   (info (org) Using header arguments)
and
   (info (org) Property syntax)

Just remember that a property called `header-args' is a string until Babel 
starts working on it.


 5) Is there any way in getting, in this function, the same output
 (header-args) as from the code block suggested by Charles:
 

You might try

#+BEGIN_SRC emacs-lisp :results pp
   (cons (org-entry-get (point) header-args t)
 (nth 2 (org-babel-get-src-block-info)))
#+END_SRC

HTH,

Chuck




Re: [O] [BUG] on export resulting in endless evaluation

2015-02-06 Thread Charles Berry
Rainer M Krug Rainer at krugs.de writes:

 
 
 Hi
 
 when exporting the fillowing org file, I get an endless loop of
 evaluations.
 
 This happens with only orgmode and languages enabled
 
 ,
 | GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0, Carbon Version 157
 | Org-mode version 8.3beta (release_8.3beta-798-g528b90  at  
 `
 
 --8---cut here---start-8---
 #+PROPERTY: header-args :exports both
 #+PROPERTY: header-args+ :results output
 * The bug
 This file create an (possibly endless?) loop during export
 * here exports both
 #+begin_src R 
 cat(13+14)
 #+end_src
 
 * and here only code
 :PROPERTIES:
 :header-args+: exports code
 :END:
 #+begin_src R 
 paste(13+14)
 #+end_src
 --8---cut here---end---8---
 

Add this to the end of your example and run the src block:

--8---cut here---start-8---

#+BEGIN_SRC emacs-lisp :results pp
(org-entry-get (point) header-args t)
#+END_SRC

#+RESULTS:
: :exports both :results output exports code

--8---cut here---end---8---


As you see the property API merely adds the `exports code' to the end of the
 header-argsvalue.

Babel then ignores the 'exports' and you end up with `:results output code' 
which creates an executable src block. Since :exports both' is set, that src 
block is executed. And so on.

A bug? 

I guess Babel could do a better job of screening header-args and barf if 
invalid 
args are submitted. I believe that `org-babel-merge-params' is the place where 
a check could be introduced, but AFAICS there is none such.

Of course `:exports code' solves this, but I think you knew that. :-)

HTH,

Chuck






Re: [O] Custom export backend based on HTML: how to implement own blocks?

2014-11-23 Thread Charles Berry
Marcin Borkowski mbork at wmi.amu.edu.pl writes:

 
 Hello,
 
 I'd like to (ab)use the underline syntax for something else.
 Basically, I'd like to translate
 
 _underlined_
 
 to
 
 span class=my-ownvariantunderlinedvariant/span
 
 and
 
 _underlined|with variant_
 
 to
 
 span class=my ownvariantunderlined/variantvariantwith
 variant/variant/span
 
 but only if the underlining is between
 
 #+BEGIN_MYBLOCK
 ...
 #+END_MYBLOCK
 
 How to achieve this?  In particular, I'd like to know:
 
 1. How can I know (in org-html-underline, for instance) whether I am in
 a MYBLOCK or not?
 

You do not need to know this directly. See below:

 2. How do I best translate the | syntax into variants?  More
 specifically: is it a good idea to do it in org-my-html-underline, by
 analysing the underlined text (as a string) or maybe it's better to
 write a filter?  (I guess the former idea is better.)
 

Define two derived backends:

backend 1)  Use 'html as the parent. Add 'MYBLOCK' to the `:export-block'
list and define your own `org-backend1-export-block' transcoder with a fallback
to the parent backend for HTML blocks.

You will have access to the :value of MYBLOCK as a string. You can use 
`org-export-string-as' to process that value according to an arbitrary backend -
in this case you use `backend2'.

backend 2) Use html as the parent of this backend and define
 `org-backend2-underline' to use the rules you outline above. You can 
parse the `contents' arg for the `|' etc.

There might be a case for making `backend2' anonymous since you only replace 
one transcoder of the parent. There is an example in 
` org-html--format-toc-headline'.

HTH,

Chuck






Re: [O] #+CALL get the first row of output table lost when using latex export

2014-11-16 Thread Charles Berry
 iemacs at gmail.com writes:

 
 Hi,
 
 I encounter a problem when I use #+CALL to create a table with latex
 export.  The problem is that the first row of the table is missing, if
 the table is created with #+CALL.
 
[deleted - setup info]

 The minimal table example is
 
 #+BEGIN_EXAMPLE
 #+NAME: t1
 #+BEGIN_SRC python :exports results
   return [['A'],None,[2]]
 #+END_SRC
 
 #+CAPTION: T1
 #+RESULTS: t1
 
 #+NAME: t2
 #+CALL: t1() :exports results
 
 #+CAPTION: T2
 #+RESULTS: t2
 #+END_EXAMPLE
 

This is not a latex issue per se. If you evaluate t2 with  

  `org-babel-execute-maybe'

the same thing will happen.

org-babel-execute:python does its own formatting. #+CALL: OTOH passes 
the results to babel.

The workaround is to use 

  #+CALL: t1() :colnames yes

HTH,

Chuck





Re: [O] Inline code :results replace not working

2014-11-12 Thread Charles Berry
Sebastien Vauban sva-news@... writes:

 
 Charles C. Berry wrote:
  I find myself writing an inline src block, then typing `C-c C-c C-x u' 
   to view
  and then remove the result, then revise, and repeat. I'd be happy to 
  just leave
  it in the document.
 
 What command are you calling with the above?

Oops! Make that  'C-c C-c y C-x u'

- C-c C-c runs the command org-ctrl-c-ctrl-c.

- y confirms code block evaluation

- pause here to ponder result
 
- C-x u runs the command undo.

---

saving myself two keystrokes (C-x u) isn't much, but if I wonder off and do 
something else, then I have to navigate back, find the offending result and 
edit it out.

Best,

Chuck





Re: [O] Stack overflow in regexp matcher

2014-10-24 Thread Charles Berry
Alan Schmitt alan.schmitt at polytechnique.org writes:

 
 Hello,
 
 I've just got the following backtrace when opening an org
 file. Unfortunately I cannot reproduce it reliably, but I was wondering
 if others had seen something similar.
 

I do. Try this. Start emacs 24.4.1.

1) Copy this line:

CLOCK: [2013-07-22 Mon 12:29]--[2013-07-22 Mon 15:26] =  2:57

into a new *.org file.

2) Save and close the file and reopen. 

3) If no such error, kill the text in the buffer, and yank it twice.

4) Repeat 2 and 3 till the message

   File mode specification error: (error Stack overflow in regexp matcher)

shows up. 

5) prune lines from the file and try step 2 till the error disappears.


For me somewhere between 400 and 500 lines is the difference between opening
with no error message and opening with the message.

Emacs 24.3.1 does not show this behavior - no error message. 

HTH,

Chuck





Re: [O] Text above first headline is being exported, despite :export: tag being used.

2014-10-16 Thread Charles Berry
Brady Trainor algebrat at uw.edu writes:


 
 I read
 
 ,
 | ‘SELECT_TAGS’ 
 | The tags that select a tree for export (org-export-select-tags). The
 | default value is :export:. Within a subtree tagged with :export:,
 | you can still exclude entries with :noexport: (see below). When
 | headlines are selectively exported with :export: anywhere in a file,
 | text before the first headline is ignored.
 `
 
 But I have trees tagged for export, while text above first headline is
 being exported. Can anyone confirm? 

It works for me. Can you provide an ECM[1]?

HTH,

Chuck

[1] http://orgmode.org/worg/org-faq.html#ecm




Re: [O] [ob-R] table variable passing broken

2014-10-14 Thread Charles Berry
Andreas Leha andreas.leha at med.uni-goettingen.de writes:

 
 Hi all,
 
 There seems to be a bug in table passing as variables now using the
 tangle-friendly version of passing variables.
 
 Here is an example (I get an error also with emacs -Q):
 
 --8---cut here---start-8---
 * test
 #+name: testtab
 | variable  | display   | unit  |
 |---+---+---|
 | num_cells | Number of Cells in Well   |   |
 | cell_area | Cell Area | μm²   |
 | nucleus_area  | Nucleus Area  | μm²   |
 | roundness | Cell Roundness|   |
 | ratio_w2l | Cell Width to Length Ratio|   |
 | inten_nuc_dapi_median | Intensity Nucleus DAPI Median |   |
 | dapi_median   | Intensity Nucleus DAPI Median |   |
 | edu_median| Intensity edu Median  |   |
 | oct4_median   | Intensity oct4 Median |   |
 | clump_size| Clump Size| cells |
 | short_name| Cell Line |   |
 | p_col | Column|   |
 | batch | Batch |   |
 | concentration | Fibronectin Concentration | ugml  |
 | Residual  | Residual  |   |
 | evaluation_guid   | Plate |   |
 | donor | Genotype  |   |
 
 #+BEGIN_SRC R :session *test* :var test=testtab
   test
 #+END_SRC
 
 #+RESULTS:
 --8---cut here---end---8---
 
 I see this in my R session:
 
 --8---cut here---start-8---
 Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, 
 na.strings,  (from
 testorg.org!917613Wp#22) : 
   line 17 did not have 3 elements
 --8---cut here---end---8---
 

I think this is the wrong diagnosis.

Did you actually revert to the earlier version of ob-R.el to confirm that 
this would have run correctly? 

The reason I ask is that I just tried this with org-babel-R-assign-elisp
from 

  org-mode-a5686d87786b1d6514ec85959a2188f703346a06/lisp/ob-R.el

and got the same error. Note this:

--8---cut here---start-8---

#+name: testtab2
| variable | display  | unit |
|--+--+--|
| donor| Genotype |  |

  
#+BEGIN_SRC emacs-lisp :var test=testtab2
(orgtbl-to-tsv test '(:fmt org-babel-R-quote-tsv-field))
#+END_SRC

#+RESULTS:
: donor   Genotype


#+BEGIN_SRC emacs-lisp :var value=testtab2
;; from org-babel-R-assign-elisp
(mapcar 'length (org-remove-if-not 'sequencep value))
#+END_SRC

#+RESULTS:
| 3 |

--8---cut here---end---8---

In particular, the empty table cells are omitted even though 

`value' or `test' has all lengths as 3. This results in 
calling read.table ( ..., fill=FALSE) implicitly.

Not sure if the fix is to retool org-babel-R-assign-elisp or something
in org-table.el.

HTH,

Chuck




Re: [O] left aligned changes to right alignment in table after adding one row - possible bug?

2014-10-13 Thread Charles Berry
Rainer M Krug Rainer at krugs.de writes:

 
 
 #+PROPERTY: header-args :exports both
 
 * Changing alignment when one row is added
 Despite of all values are strings, the alignment changes in the below
 example. Is this a bug or am I missing something?
 

One of these two maybe:

,[ C-h v org-table-number-regexp RET ]
| org-table-number-regexp is a variable defined in `org-table.el'.
| Its value is
| ^\\([]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|[]?[-+]?0[xX][0-9a-
| [wrapped] fA-F.]+\\|[]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$
| 
| Documentation:
| Regular expression for recognizing numbers in table columns.
| If a table column contains mostly numbers, it will be aligned to the
| right.  If not, it will be aligned to the left.
| 
| The default value of this option is a regular expression which allows
| anything which looks remotely like a number as used in scientific
| context.  For example, all of the following will be considered a
| number:
| 1212.22.4e-082x10^124.034+-0.022.7(10)  3.5
| 
| Other options offered by the customize interface are more restrictive.
| 
| You can customize this variable.
| 
| [back]
`



,[ C-h v org-table-number-fraction RET ]
| org-table-number-fraction is a variable defined in `org-table.el'.
| Its value is 0.5
| 
| Documentation:
| Fraction of numbers in a column required to make the column align right.
| In a column all non-white fields are considered.  If at least
| this fraction of fields is matched by `org-table-number-regexp',
| alignment to the right border applies.
| 
| You can customize this variable.
| 
| [back]
`


With the added row, the fraction is exceeded in the last two columns.


HTH,

Chuck





[O] debugging export error

2014-10-08 Thread Charles Berry

I am trying to debug a subtree export. 

I get 

member-ignore-case: Wrong type argument: stringp, nil

and it seems to come from `org-export-get-environment' but if I instrument
that function, the error goes away whether I step thru it or `c' on entry.

Likewise, if I M-x debug-on-entry and just `c' on entry, I get no error.

Bisecting the file with the subtree I am trying to export, I can find things
- like removing an unused src block - that when changed get rid of the 
error.

But I'd really like to know what is going on here and not being able to
see the problem thru a debugger is a frustration.

Advice appreciated.

Chuck





Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 at /usr/local/share/emacs/site-lisp/org/)]

2014-10-07 Thread Charles Berry
Henrik Singmann henrik.singmann at psychologie.uni-freiburg.de writes:

 
 Dear all,
 
 Sorry to resurrect this thread but I still have the issue discussed here.
I get Error: could not find
 function .ess.eval when inside an R code block with :session *R* but 
 not without :session *R*.
 

Please confirm that when you do

 M-x find-function RET org-babel-R-initiate-session RET

and scroll down 15 lines:

 M-1 M-5 down

you see something like this:

  (ess-wait-for-process
   (get-process (or ess-local-process-name
ess-current-process-name)))


If not, there is something broken in your setup.

If you do see that code, please do

 C-x d return


and verify that ob-R.el is older than ob-R.elc. If it is not older delete
ob-R.elc and restart.

Let us know how it goes either way.
 
Chuck





Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 at /usr/local/share/emacs/site-lisp/org/)]

2014-10-07 Thread Charles Berry
Ista Zahn istazahn at gmail.com writes:

 
 
 
 On Oct 7, 2014 3:41 PM, Henrik Singmann henrik.singmann at
psychologie.uni-freiburg.de wrote:
 
  Dear all,
 
  Sorry to resurrect this thread but I still have the issue discussed 
  here. I get Error: could not find function .ess.eval when inside an 
  R code block with :session *R* but not without :session *R*.
 
[snip]
 
  Can anybody reproduce or solve?
 Yes, I can reproduce with emacs 24.3.1, org 8..2.3, and ess 14.09 on


org 8.2.3 ?? The last 8.2.3 release I see on git is 2013-11-15 05:58:32 
(GMT)

The ess 14 patch showed up on 2014-09-18 01:10:40 (GMT).


 Archlinux, but only if I don't start the R session first. If I do 'M-x
 R' to manually start an R process it works fine, but if there is no R
 process already running I get 'Error: could not find function
 .ess.eval'

Yes. (R) starts the session asynchronously, so in programmatic use
subsequent commands can jump the queue and confuse the process. 

This did not seem to matter before ess 14.

The 2014-09-18 01:10:40 (GMT) patch forces a wait for (R) to finish before
anymore commands are sent to the session.

So either update org-mode or downdate ess or replace
org-babel-R-initiate-session with the current version and recompile.

HTH,

Chuck




Re: [O] Error Embedding SQL Source from code block into R Source of Another (noweb)

2014-09-30 Thread Charles Berry
Eric Brown brown at fastmail.fm writes:

 
 Dear List:
 
 It is possible to embed SQL code as a string to be evaluated in R. I am
 interested in formatting the SQL code in its own source code block, with
 its own syntax highlighting and editing mode (C-c ').
 
 The first time I run the code, I am prompted for R starting directory,
 but I get an error:
 
 ---
 load ESSR: + + + Error: unexpected string constant in:
 source('~/.emacs.d/elpa/ess-20140913.1153/etc/ESSR/R/.load.R',
 local=TRUE) #define load.ESSR
 load.ESSR('
 ---
 
 and the console locks.  I can C-g to get out of it, and then
 re-evaluate, and the code prints what I expect -- the text of the SQL
 command.


[rest deleted]

Hmmm. Maybe the bug that was fixed by commit

 0fd29a5ee7d14c3695b22998196373b9a3637413

about two weeks back? Make sure ob-R.el is up to date and compiled (or
that ob-R.elc is deleted).


Anyway, your code works as expected for me - first time.

---

FWIW, I prefer to use :var headers to import strings, but it takes some
setup:


--8---cut here---start-8---

#+BEGIN_SRC emacs-lisp
  (defun grab-src (name)
(save-excursion
  (org-babel-goto-named-src-block name)
  (nth 1 (org-babel-get-src-block-info 'light
#+END_SRC

#+BEGIN_SRC R :var y=(grab-src sqlsource) :results output :exports both
  y
#+END_SRC

#+RESULTS:
: [1] select \n  * \nfrom \n  t \nlimit \n  10

--8---cut here---end---8---



HTH,

Chuck




Re: [O] [ob, bug?] org-sbe

2014-09-29 Thread Charles Berry
Rasmus rasmus at gmx.us writes:

 
 Hi,
 
 I used sbe a long time ago.  Apparently it has been renamed to
 org-spe.
 
 I was unable get org-spe working as a dumb currency converter, so I
 tried the example in the top of ob-table.el.  However, I'm also unable
 to get this example working, even starting from emacs -q. . .
 
 This is the suggested test in ob-table.el:
 
 #+begin_src emacs-lisp :results silent
   (defun fibbd (n) (if ( n 2) 1 (+ (fibbd (- n 1)) (fibbd (- n 2)
 #+end_src
 
 #+name: fibbd
 #+begin_src emacs-lisp :var n=2 :results silent
 (fibbd n)
 #+end_src
 
 | original | fibbd  |
 |--+|
 |0 | #ERROR |
 |1 | #ERROR |
 |2 | #ERROR |
 |3 | #ERROR |
 |4 | #ERROR |
 |5 | #ERROR |
 |6 | #ERROR |
 |7 | #ERROR |
 |8 | #ERROR |
 |9 | #ERROR |
 #+TBLFM: $2='(org-sbe 'fibbd (n $1))
 
 Did the syntax of org-sbe change or am just missing something obvious here?

unquote the fibbd or double quote it


--8---cut here---start-8---
| original | fibbd |
|--+---|
|0 | 1 |
|1 | 1 |
|2 | 2 |
|3 | 3 |
|4 | 5 |
|5 | 8 |
|6 |13 |
|7 |21 |
|8 |34 |
|9 |55 |
#+TBLFM: $2='(org-sbe fibbd (n $1))
--8---cut here---end---8---


or 

--8---cut here---start-8---
#+TBLFM: $2='(org-sbe fibbd (n $1))
--8---cut here---end---8---


HTH,

Chuck




Re: [O] line numbers in a code block?

2014-09-27 Thread Charles Berry
John Kitchin jkitchin at andrew.cmu.edu writes:

 
 Does anyone know a way to get dedicate line numbers in an org code
 block?
 
 I know how to get buffer code lines, but when we run a code block and
 there is an error, the error line number is relative to line 1 of the
 code block. Currently, we type C-c ' to get a code buffer, and navigate
 to the line. I would like to see code block numbers on the right hand
 side of the buffer, and only inside the code block. Any ideas?

You mean like

   (org-add-hook 'org-src-mode-hook 'linum-mode)

only with line numbers on the right side? (linum puts them on the left)

Or did you mean in the org-mode buffer itself? 

Maybe (just a guess) hack `linum-update-window' to reset `line' to 0 
whenever `(forward-line))'gives you a line that matches `#+begin_src'.


HTH,

Chuck




Re: [O] meaningfull names for org-src buffers

2014-09-25 Thread Charles Berry
Andreas Leha andreas.leha at med.uni-goettingen.de writes:

 
 Hi,
 
 Grant Rettke gcr at wisdomandwonder.com writes:
  On Thu, Sep 11, 2014 at 5:05 PM, Adriaan Sticker
  adriaan.sticker at gmail.com wrote:
  I was wondering if it's somehow possible to give named org src buffer the
  name they were give in their #+NAME tag? Now there are just called 
  something like:
  *Org Src test.org[ R ]*
 
  But if you have multiple org-src buffers opened at the same time, its 
  hard to find the correct one back.
 
  Excellent idea. I've got so many small source blocks that it is too
  difficult to make sense of
  keeping multiple source block edit buffers open and limit them to one
  at a time eg
 
  ,
  | (setq org-src-window-setup 'current-window)
  `
 
  How have you come upon your workflow of keeping multiple open and what
  are some of the pros and
  cons that you've found with it?
 
 I'd be interested in this as well.
 
 Regards,
 Andreas
 
 

Maybe I am answering the wrong question, but org-edit-src-code allows
you to specify the buffer name:


,[ C-h f org-edit-src-code RET ]
| org-edit-src-code is an interactive compiled Lisp function in
| `org-src.el'.
| 
| (org-edit-src-code optional CONTEXT CODE EDIT-BUFFER-NAME)
| 
| ...
`

So you can do something like this:

#+BEGIN_SRC emacs-lisp
  (defun org-edit-src-code-plus-name ()
(interactive)
(let* ((eop  (org-element-at-point))
   (name (or (org-element-property :name (org-element-context eop))
  unnamed))
   (lang (org-element-property :language eop))
   (buff-name (concat *Org Src  name [  lang  ] *)))
  (org-edit-src-code nil nil buff-name)))
#+END_SRC

which leads to a buffer named like *Org Src My-block[ R ] *, where 
'My-block' is the name of the src block.

HTH,

Chuck




Re: [O] Exporter dispatcher bug?

2014-09-24 Thread Charles Berry
Brady Trainor algebrat at uw.edu writes:

 
 
 Charles Millar millarc at verizon.net writes:
 
  Brady Trainor wrote:
  Charles Millar millarc at verizon.net writes:
 
  Today, using C-c C-e, the dispatcher shows only the LaTeX and
  Publisher options.
 
  What is the result C-h v org-export-backends?
 
  -- snip --
  Its value is (ascii html icalendar latex)
  -- snip --
 
  Charlie
 
 Looks normal! Wild guess, had to try :)


I think you want to check

(mapcar 'org-export-backend-name org-export--registered-backends)

to see what backends are actually available to the export dispatcher.

and  (mapcar 'org-export-backend-menu org-export--registered-backends)

to see what menu options should be there.

HTH,

Chuck




Re: [O] update on missing :parameters in code blocks

2014-09-21 Thread Charles Berry
John Kitchin jkitchin at andrew.cmu.edu writes:

 
 I did some more digging on the missing :parameters during export, and it
 seems that the src block itself is different during export than in the
 buffer.  Below illustrates what I mean. In the buffer, if I look at the
 contents of the code block using output from org-element-at-point, it
 looks as I expect, with the complete header. But, using the same method
 in the export, it is clear that the header args are not there.
 
 I have not figured out where they disappear yet.
 
[snip]

Instrument org-export-as. Then step thru it.

Before this line:
 
 (org-export-execute-babel-code)

the buffer copy ( my-buffer2, say ) will show the parameters/headers.

After that line is executed, they are gone.

You can work around this by `advicing' various babel functions and inserting
things you want to save as attributes, but it would be nice not to need
to do that.

HTH,

Chuck






Re: [O] header arguments, inheritance, and noweb expansion Was: «Macro» expansion in source blocks; code-sharing between blocks

2014-09-20 Thread Charles Berry
Andreas Kiermeier andreas.kiermeier at gmail.com writes:

 
 On 19 September 2014 20:29, Rainer M Krug Rainer at krugs.de wrote: 

[ snip ] 

 
 The alternative mentioned by Chuck Berry is the xtable function (in R) 
 (https://lists.gnu.org/archive/html/emacs-orgmode/2014-09/msg00519.html).
 I just tried it and am happy to share that it does created the whole
 output in one go, i.e. it does exactly what I need, including table 
 float, caption and label. Now I just got to sort out how to created the 
 tables without the use of tabular ...
 

I suggested xtable because that is what I often use.

But thinking a bit more, I decided to look at tables::tabular() and 
at Hmisc::latex(), which I think is what you used at first.

And it turns out that latex() has args for caption, label, where, and
loads of other things. See its help page. So, it looks like you have the 
control you need and the ability to use

  latex( tabular(...), caption = ..., label = ..., ...)

to good effect.

HTH,

Chuck




Re: [O] «Macro» expansion in source blocks; code-sharing between blocks

2014-09-19 Thread Charles Berry
Andreas Kiermeier andreas.kiermeier at gmail.com writes:


 
 My two blocks (with some code removed for simplicity) are as follow:
 
 #+NAME: tbl-refyear
 #+BEGIN_SRC R :results silent :exports none
   latex(tabular( code remove  ))
 #+END_SRC
 
 #+BEGIN_SRC latex :noweb yes
 \begin{table}[h]
 \label{tbl:refyear}
 \caption{Separation outcomes (death or any type of discharge) by
 reference year.}
 tbl-refyear()
 \end{table}
 #+END_SRC
 
 I've tried :cache yes as part of the tbl-refyear source block, but
 that didn't stop if from being run twice. Am I missing a suitable
 header argument?
 
 This is the only way I could find to wrap the latex table (which has
 some complex formatting and hence why I've used it over just producing
 a table) in a float with a caption (though I still can't properly
 reference the label when I export to a PDF file).
 
 Any thought would be greatly appreciated. TIA!
 

Why not use library(xtable) and do it all in R?

If you are not sure this is the right choice, I suggest you look at the
help page for print.xtable - you have a lot of control over caption,
label, positioning, etc.

HTH,

Chuck




Re: [O] [RFC] [PATCH] [babel] read description lists as lists of lists

2014-09-19 Thread Charles Berry
Aaron Ecay aaronecay at gmail.com writes:

 
 
 Hello all,
 
 The attached patch makes babel read description lists as lists of the
 following format: ((term description) ...).  The present default is
 to simply read in the text of each list item, yielding:
 (term :: description ...).
 
 Of course, it’s possible to interconvert between the two formats, but I
 think the greater structure of this proposal makes things easier for
 babel authors.  (Another way of thinking of the proposal is that it
 treats description lists like two-column tables.)
 
 What do people think?

With that change 

#+BEGIN_SRC R :var a=my-desc-list
a
#+END_SRC

returns a data.frame with one column of terms and one of descriptions!

Which, no doubt, is what you were thinking.

This will be handy for creating DESCRIPTION files for R packages.

I love it. 

FWIW, rgrep-ing org-babel-\(ref-resolve\)\|\(read-result\) and clicking
on the links, I didn't catch any obvious problem cases.

HTH,

Chuck





Re: [O] Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 at /usr/local/share/emacs/site-lisp/org/)]

2014-09-16 Thread Charles Berry
Rainer M Krug Rainer at krugs.de writes:

 
 Thanks - you came before me. I get the same error but managed to work 
 around.
 
 This is likely caused by the upgrade of ess, 

Likely.

But it may not be an ESS problem per se. 

M-x R starts a process that runs asynchronously. In interactive use there 
is no issue (barring something in .First() that slows the startup for
a very long time).

But, ...

If the  (rename-buffer ...) in org-babel-R-initiate-session
runs before all the setup that ESS performs in the process buffer is 
complete, chaos can result.

Not sure what the best way is to fix this.

A simple hack to temporarily solve the OP's problem is to force a pause 
before (rename-buffer ...) with (sleep-for 0.1) or something.

HTH,

Chuck




[O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 at /usr/local/share/emacs/site-lisp/org/)]

2014-09-16 Thread Charles Berry
Charles Berry ccberry at ucsd.edu writes:

 
 Rainer M Krug Rainer at krugs.de writes:
 
  
  Thanks - you came before me. I get the same error but managed to work 
  around.
  
  This is likely caused by the upgrade of ess, 
 
 Likely.
 
 But it may not be an ESS problem per se. 
 
 M-x R starts a process that runs asynchronously. In interactive use there 
 is no issue (barring something in .First() that slows the startup for
 a very long time).
 
 But, ...
 
 If the  (rename-buffer ...) in org-babel-R-initiate-session
 runs before all the setup that ESS performs in the process buffer is 
 complete, chaos can result.
 
 Not sure what the best way is to fix this.


OK. Looks like (ess-wait-for-process) fixes this. Here is a patch.

Chuck
==

From 89472012d80ce9ad4c8722f304c0d29327efa1fc Mon Sep 17 00:00:00 2001
From: chasberry ccbe...@ucsd.edu
Date: Tue, 16 Sep 2014 19:57:59 -0700
Subject: [PATCH] lisp/ob-R.el: use `ess-wait-for-process' to assure clean
 session startup

* lisp/ob-R.el (org-babel-R-initiate-session): Make sure that (R) has
finished before `rename-buffer' is run.

TINYCHANGE
---
 lisp/ob-R.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index 41b943c..7575acf 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -35,6 +35,8 @@
 (declare-function inferior-ess-send-input ext:ess-inf ())
 (declare-function ess-make-buffer-current ext:ess-inf ())
 (declare-function ess-eval-buffer ext:ess-inf (vis))
+(declare-function ess-wait-for-process ext:ess-inf 
+ (optional proc sec-prompt wait force-redisplay))
 (declare-function org-number-sequence org-compat (from optional to inc))
 (declare-function org-remove-if-not org (predicate seq))
 (declare-function org-every org (pred seq))
@@ -262,6 +264,7 @@ This function is called by `org-babel-execute-src-block'.
;; Session buffer exists, but with dead process
(set-buffer session))
  (require 'ess) (R)
+ (ess-wait-for-process)
  (rename-buffer
   (if (bufferp session)
   (buffer-name session)
-- 
1.8.5.2 (Apple Git-48)






Re: [O] Format output of org-babel-tangle for exported file

2014-09-03 Thread Charles Berry
Rainer M Krug Rainer at krugs.de writes:

 
 Hi
 
 I am calling (org-bable-tangle) in a code block in an org file and I
 would show the files resulting from the tangling in a nice format.
 
 But I do not manage. I have the following at the moment:
 
 --8---cut here---start-8---
 #+begin_src emacs-lisp 
 (replace-regexp-in-string [)\] 
  (replace-regexp-in-string [(] - 
   (replace-regexp-in-string   \n- 
(prin1-to-string (org-babel-tangle)
 #+end_src
 

[snip]

 Which is neither elegant nor short, and I am sure I could do this
 easier. Any suggestions?

Something like this? Possibly with `(reverse (org-babel-tangle))'

#+BEGIN_SRC emacs-lisp :results value
(mapconcat (lambda (x) (file-relative-name x ..)) (org-babel-tangle) \n)
#+END_SRC


HTH,

Chuck





Re: [O] Please help with a filter

2014-09-02 Thread Charles Berry
Rafael rvf0068 at gmail.com writes:

 
 
 I want that the result of exporting to markdown the following two blocks
 be identical:

Rafael,

You probably want a derived backend taking 'md as the parent. 

You want to tool up a src-block transcoder.

Look at org-html-src-block (which is what markdown uses) and create
org-md-sage-src-block (say) based on that.

The :language property in `info' - the communication channel - is a human 
language not a computer language. Confusingly, babel has an `info'
variable that has different contents.

Filters might be made to work, but it seems like more work than a
derived backend.

HTH,

Chuck






Re: [O] [babel, R] Commands are not copied in the iESS buffer upon evaluation

2014-09-01 Thread Charles Berry
Sebastien Vauban sva-news@... writes:

 
 Hi Aaron,
 
 Aaron Ecay wrote:
  2014ko abuztuak 29an, Sebastien Vauban-ek idatzi zuen:
 
  Does it have something to do with `ess-eval-visibly' not being respected
  (whose default is `t')?
 
  Indeed, babel’s R support let-binds this variable to nil when evaluating
  value-type results in a session.
 
 OK. Can we put it to `t' by default [1] or, at least, have Org Babel
 respect our ESS setting?

If you Google `ess-eval-visibly slow' you will get a bunch of hits that
show why people prefer `nil' and why that is a good default. 

But it may be OK to allow a user to override.

HTH,

Chuck




Re: [O] cannot execute org-mode code from the front page tutorial.

2014-08-16 Thread Charles Berry
Nick Dokos ndokos at gmail.com writes:

 
 tsd at tsdye.com (Thomas S. Dye) writes:
 
  Aloha Jenia,
 
  jenia.ivlev at gmail.com (jenia.ivlev) writes:
 
  Hello.
 
  I'm trying to go through the org-mode tutorial on its official page.
 

[discussion showing that (if (listp value)...) generates a data.frame 
deleted]

[delete patch turning a data.frame into a vector]

 And assuming this is correct, the worg page will need to be corrected
 too.


No patch is needed.

The point of the code in  org-babel-R-assign-elisp is to create a data.frame
when `value' is a list.

The patch adding `unlist(res)' turns it into an ordinary vector.

This will break almost all uses of :var in R scr blocks.

I don't think this example could have worked for a long while - turning
elisp lists into R data.frames has been a feature for a good while. 
Also, note the use of `sbe' vs `org-sbe' in the formula.

#+TBLFM: @2$1='(sbe R-mean (x tbl-example-data()))


Use `colMeans(x)' to fix the worg page.

HTH,

Chuck




Re: [O] #+begin_src R :results output drawer doesn't work.

2014-08-10 Thread Charles Berry
Feng Shu tumashu at gmail.com writes:

 
 
 #+begin_src R :results output drawer
 1
 2
 #+end_src
 
 #+RESULTS:
 : 2
 

I get:

#+RESULTS:
:RESULTS:
[1] 1
[1] 2
:END:

#+BEGIN_SRC emacs-lisp :results drawer
(org-version)
#+END_SRC

#+RESULTS:
:RESULTS:
8.3beta
:END:

HTH,

Chuck




Re: [O] R code block produces only partial output

2014-08-05 Thread Charles Berry
Eric Schulte schulte.eric at gmail.com writes:

 
 Andreas Kiermeier andreas.kiermeier at gmail.com writes:
 
  On 4 August 2014 21:23, Eric Schulte schulte.eric at gmail.com wrote:
  Why are you setting the output type to graphics when you are trying to

 
 Hi Andreas,
 
 I can't reproduce your problem.  I get the following from your minimal
 example when run in an Org-mode file, and from the command line.  They
 are identical.  Are you using the latest version of Org-mode?
 
 Best,
 Eric
 
[snip]
 
 [Previously saved workspace restored]
 
  x - rnorm(100)
  y - quantile(x, probs=seq(0,1,0.1))
  names(y) - 
as.character(c(0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1))
  y
   0  .1  .2  .3  .4  .5 
 -2.53624773 -1.30846042 -0.70659822 -0.43565010 -0.24318346 -0.01034625 
  .6  .7  .8  .9   1 
  0.24125644  0.49945059  0.92032314  1.36423669  2.83357915 
 
 
 
 


Eric,

As noted by Andreas and John this is a problem for session output.

org-babel-R-evaluate-session uses 

 (string-match ^\\([ ]*[+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\) line)

to find the start of R output in the session.

This does not match the `  0', but matches the ` .6' 
in the output you show above, so if that had been in a session, all the 
output up to and including the '.' before the '6' would be clipped
by the following

  (substring line (match-end 1))


as Andreas output showed. 

Deleting the \\. fixes Andreas case, but what are the circumstances 
requiring the  \\. ?

HTH,

Chuck




Re: [O] proposal to make C-c C-c not remove latex overlays

2014-07-31 Thread Charles Berry
Bastien bzg at gnu.org writes:

 
 Hi Nick,
 
 Nick Dokos ndokos at gmail.com writes:
 
  getting rid of just latex fragment undoing in
  org-ctrl-c-ctrl-c and toggling with C-c C-x C-l is probably the best
  solution.
 
 Agreed, this is the case now in master.


The docstring for `org-preview-latex-fragment' still says:

The images can be removed again with \\[org-ctrl-c-ctrl-c].

Maybe change that to \\[org-preview-latex-fragment]?

HTH,

Chuck




Re: [O] [patch] [babel] Patches to fix tangling and variable transfer of tables in R

2014-07-27 Thread Charles Berry
Rainer M Krug Rainer at krugs.de writes:

 
 Nicolas Goaziou mail at nicolasgoaziou.fr writes:
 
  Hello,
 
  Rainer M Krug Rainer at krugs.de writes:
 
[snip]
 
 Amended patches attached.


AFAICS, these patches are good to go. Can they be applied, please?

Chuck






Re: [O] Possible to use src block to generate org headlines for export?

2014-07-24 Thread Charles Berry
Nick Dokos ndokos at gmail.com writes:

 
 Charles Berry ccberry at ucsd.edu writes:
 
  Matt Lundin mdl at imapmail.org writes:
 
  [deleted]
[more deleted]

  Or wrap the results in a drawer when you type C-c C-c, but render them as 
  raw on export (which removes the drawer and replaces with raw results).
 
  Like so:
 
  #+header: :results (if (boundp 'backend) raw drawer) 
  #+BEGIN_SRC emacs-lisp :exports both 
 
  (format * headline\n1\n2\n5\n)
  #+END_SRC
 
 
 That's a very nice tip - one small weakness is that it'll do the wrong
 thing if you just happen to have a binding for backend outside of the
 export mechanism.
 

Fair enough. But getting assurance that an export process is really up and 
running looked tricky to me - what with anonymous backends and `info' being 
let-bound by babel. So this is what I came up with for a more robust test.
Hopefully, nobody will bind both `backend' and `org-export-current-backend'
to a common backend outside of doing an export...


#+BEGIN_SRC emacs-lisp 
  (defun org-export-if-exporting (export-val optional other-val)
If backend exists, is a backend, and is currently running
  return EXPORT-VAL otherwise return OTHER-VAL or \\.
(if
(and (boundp 'backend) 
 (equal (car (append backend nil)) 
'cl-struct-org-export-backend)
 (equal org-export-current-backend
(org-export-backend-name backend)))
export-val
  (or other-val )))

#+END_SRC

#+header: :results (org-export-if-exporting raw) 
#+BEGIN_SRC emacs-lisp :exports both 
(format * headline\n1\n2\n6\n)
#+END_SRC


Chuck




Re: [O] Possible to use src block to generate org headlines for export?

2014-07-23 Thread Charles Berry
Matt Lundin mdl at imapmail.org writes:

[deleted]

 Footnotes:
 
 [fn:1] If one really needs to see the headlines in the original org
 buffer, a hook can be used to remove the :RESULTS: drawer.
 
 --8---cut here---start-8---
 (defun my-remove-stray-results-drawer (backend)
   (when (eq backend 'html)
 (while (re-search-forward ^\\s-*:RESULTS:\\s-*\n nil t)
   (replace-match 
 
 (add-hook 'org-export-before-parsing-hook 'my-remove-results-drawer)
 --8---cut here---end---8---
 
 

Or wrap the results in a drawer when you type C-c C-c, but render them as 
raw on export (which removes the drawer and replaces with raw results).

Like so:


#+header: :results (if (boundp 'backend) raw drawer) 
#+BEGIN_SRC emacs-lisp :exports both 
(format * headline\n1\n2\n5\n)
#+END_SRC

HTH,

Chuck




Re: [O] How to show the complete syntax tree

2014-07-14 Thread Charles Berry
Shiyuan gshy2014 at gmail.com writes:

 
 Hi,     The command I can find in the manual to show the syntax tree is
(org-element-parse-buffer). However, when the structure is output to the
buffer, by using the commands C-u M-: (org-element-parse-buffer), it seems
that only the part up to a certain depth is printed. 

Yes, as Nick explained there are variables that control this.

My eyes sometimes like this approach to viewing lisp objects:

#+BEGIN_SRC emacs-lisp
(pp-to-string (org-element-parse-buffer))
#+END_SRC

HTH,

Chuck






Re: [O] passing the contents of a block as an escaped string

2014-06-24 Thread Charles Berry
Alan Schmitt alan.schmitt at polytechnique.org writes:

 
 Hello,
 
 I'm trying to write some filters from Pygments, and to record what I'm
 doing and make my life simpler, I'm doing it in an orgmode buffer. In
 that buffer, I have the code I want to highlight in a source block, and
 the python code for the Pygments extension in another block. I'm trying
 to find out how to pass the escaped code from the source to highlight to
 the python buffer.
 
 I tried using noweb, but the expansion is verbatim and python complains
 about the line breaks. So I'm wondering if there is a way to:
 - pass a source block as an escaped string to another source block, or
 - save a source block to a temporary file, and pass the file name to
 a second source block.
 


defun a function that formats your src block, then use it in a header

  :var x=(foo src-block-name)


or maybe wrap (foo ...) in a `format' call or `prin1-to-string' call.


An example is below.

===

Another alternative is to use this idiom (see 14.10 Noweb reference syntax)

   code-block-name(optional arguments)

where the code-block-name specifies a formatter (in elisp, say) and 
the optional argument is the name of the code block you want to format.

HTH,

Chuck


,
| #+NAME: prin-block
| #+BEGIN_SRC emacs-lisp :var a=abc 
|   (defun foo (blk) 
| (save-excursion
|   (org-babel-goto-named-src-block blk)
|   (nth 1 (org-babel-get-src-block-info 'light
| 
| #+END_SRC
| 
| #+NAME: weird-text
| #+BEGIN_SRC python
|   just some plain text;
| 
|   \\ a double slash
| 
|   escape eol \n
|   
|   OK??
| #+END_SRC
| 
| 
| #+BEGIN_SRC python :var a=(foo weird-text) :results output
| print(a);
| #+END_SRC
| 
| #+RESULTS:
| : just some plain text;
| : 
| : \\ a double slash
| : 
| : escape eol \n
| : 
| : OK??
| 
| #+header: :var a=(prin1-to-string (foo weird-text)) 
| #+BEGIN_SRC python :results output
| print(a);
| #+END_SRC
| 
| #+RESULTS:
| : just some plain text;
| : 
| :  a double slash
| : 
| : escape eol \\n
| : 
| : OK??
`









Re: [O] [Babel] [possible bug] Empty src block prevents other block to expand

2014-06-23 Thread Charles Berry
Nicolas Girard girard.nicolas at gmail.com writes:

 
 The empty src block at the beginning of the following file prevents
 capture-tmpl to expand when tangling.
 

I think the diagnosis is incorrect.

The empty source block has no effect.

Adding ':noweb yes' to `capture's header args fixes things.

org-version: 8.3-8-gce2359

Chuck


 

[snip]

 #+name: capture
 #+begin_src emacs-lisp :tangle no

Add `:noweb yes' to the previous line

   (C Capture entry 
   capture-tmpl)
 #+end_src
 
 #+begin_src emacs-lisp :noweb yes
   (add-to-list 'org-capture-templates '
   capture 'append)
 #+end_src
 ---8---
 
[snip]





Re: [O] [PATCH] -for review- Tangling with variable transfer of variables

2014-06-19 Thread Charles Berry
Aaron Ecay aaronecay at gmail.com writes:

 
 Hi Rainer,
 
 I have not tested the patch (I rarely use :var), but here are some
 comments from reading the patch.
 
[snip]
 
(header (if (or (eq (nth 1 value) 'hline) colnames-p)
TRUE FALSE))
(row-names (if rownames-p 1 NULL)))
(if (= max min)
  - (format %s - read.table(\%s\,
  + (format %s - read.table(textConnection('%s'),
 
 This will fail if ‘file’ contains an apostrophe character.  I guess you
 need to escape apostrophes in ‘file’.
 

There are a bunch of issues with the textConnection - the point Aaron
makes, the nasty name (try showConnections() to see), and close()-ing it.

I think you need something more like this:


 (header (if (or (eq (nth 1 value) 'hline) colnames-p)
  TRUE FALSE))
  (row-names (if rownames-p 1 NULL)))
  (if (= max min)
  (format 
%s - 
local({con.object - 
%S
con - textConnection(con.object)
res - read.table(con,
  header=%s,
  row.names=%s,
  sep=\\\t\,
  as.is=TRUE)
close(con)
res}) 
  name file header row-names)



Notes: %S handles Aaron's quoting issue.
   local() keeps unwanted objects out of user's way.
   This worked on a couple of simple tests

If you have `:session :results output' headers your session
transcript will have `file' dumped into it, which might be an annoyance.

HTH,

Chuck






Re: [O] navigation broken in recent maint

2014-06-18 Thread Charles Berry
Samuel Wales samologist at gmail.com writes:

 
 quick and dirty bug report.  recent org maint.
 
 1:
 
 jumping from magit (maint) to org using RET always goes
 to the wrong location now.
 
 i don't know that this is org's fault.  i have seen it
 happen once before, which is when i tried
 longlines-mode and similar modes.  i think it was only in org, but i
 am not sure.
 
 was there a change in org visibility?
 
 2:
 
 id links always go to the wrong location now.  they jump someplace
 near the link.
 
 dunno if 1 and 2 are related.  i'd guess not but they
 started in the same snapshot.
 
 can't do ecm at this time.
 

Here is one I've adapted from the 

  navigation broken - occur, org-babel-goto-named-src-block, etc fail 

thread:

   http://article.gmane.org/gmane.emacs.orgmode/87575

Before executing the src block in what follows the custom_id links work.
After executing the src block the links that are far from their target fail.

Anyone who wants to dig into this should see Nicolas Richard's reply at the 
end of that thread:

http://article.gmane.org/gmane.emacs.orgmode/87598

HTH,

Chuck

==


* headline A
  :PROPERTIES:
  :CUSTOM_ID: idA
  :END:

[[#idB]]

#+NAME: AAA
#+BEGIN_SRC x

#+END_SRC

#+NAME: filler
#+BEGIN_SRC emacs-lisp :results output
  (let ((i ?a))
(while ( i ?z)
  (princ (format * %s\n\n\n#+NAME: %s\n\n 
 (char-to-string i) 
 (char-to-string i)))
  (setq i (1+ i

#+END_SRC

[[#idA]]
[[#idB]]


#+RESULTS: filler

[[#idA]]
[[#idB]]



* headline B
  :PROPERTIES:
  :CUSTOM_ID: idB
  :END:

[[#idA]]
[[#idB]]

#+NAME: BBB
#+BEGIN_SRC x

#+END_SRC






Re: [O] inclusion of #+RESULTS in a source block

2014-06-16 Thread Charles Berry
Federico Beffa beffa at ieee.org writes:

 
 
 

   Suppose you want to use a program such as Sympy or Maxima to find
   the analytic solution of a complicated equation. After this you
   want to make use of that solution for numerical evaluation of
   various cases.  


See 

http://orgmode.org/manual/Noweb-reference-syntax.html#Noweb-reference-syntax

You want something like

#+BEGIN_SRC python :noweb yes
analytic-sol()
#+END_SRC


To use in more than one src-block  use the `:cache yes' header for 
`analytic-sol'

HTH,

Chuck




Re: [O] How do you capture the intent never to tangle or weave a headline or its children?

2014-06-15 Thread Charles Berry
Grant Rettke gcr at wisdomandwonder.com writes:

 
 Good evening,
 
 For both performance and cognitive reasons, sometimes I specifically
 never want to tangle or weave a headline or any of
 its children. I still value it though, so it belongs in that document,
 and it wouldn't make sense for it to be linked as an
 external document. For performance reasons, I suspect that it would
 speed up tangling, but I need to verify this.
 
 Thus far I just add something like this, so at least it is obvious to
 *me* what is my intent:
 
 # INTENT: never weave or tangle this headline or its children
   :PROPERTIES:
   :exports: none
   :tangle: no
   :END:
 

You want this:

http://orgmode.org/manual/Header-arguments-in-Org-mode-properties.html#Header-arguments-in-Org-mode-properties

i.e. :header-args: :exports none :tangle no

HTH,

Chuck




[O] navigation broken - occur, org-babel-goto-named-src-block, etc fail

2014-06-14 Thread Charles Berry


Start with emacs -q, then load today's org-mode.

Execute the source block in this file:

=== start of file

#+NAME: AAA
#+BEGIN_SRC x

#+END_SRC


#+BEGIN_SRC emacs-lisp :results raw output
  (let ((i ?a))
(while ( i ?z)
  (princ (format * %s\n\n\n#+NAME: %s\n\n 
 (char-to-string i) 
 (char-to-string i)))
  (setq i (1+ i

#+END_SRC


#+NAME: BBB
#+BEGIN_SRC x

#+END_SRC

=== end of file

Now try 

C-c C-v g AAA RET
C-c C-v g BBB RET
C-c C-v n

or 

M-x occur RET \+name RET

then try to click on each of the matches in the *Occur* buffer.
The first few work, then failure set in. Seems like local moves of
a few lines work, but longer jumps fail.

I've tried using edebug on org-reveal. When I step through by pressing
'n', occur works fine. When I skip stepping by pressing 'c', it often fails.


What gives?

Chuck

p.s.

Org-mode version 8.2.7 (release_8.2.7-1096-g23496c [...]
GNU Emacs 24.3.1 [...]










[O] [bug][babel] noweb gotcha

2014-06-10 Thread Charles Berry


The following 

,
| #+PROPERTY: tangle yes
| 
| #+NAME: print-abc
| #+BEGIN_SRC emacs-lisp
| (format 
| %s abc)
| #+END_SRC
| 
| #+NAME: print-def
| #+BEGIN_SRC emacs-lisp
| (concat
|  def )
| #+END_SRC
| 
| #+BEGIN_SRC emacs-lisp :noweb yes
| print-abc
| print-def
| #+END_SRC
`



tangles as 

,
| (format 
| %s abc)
| 
| (concat
|  def )
| 
| (format 
| %s abc)
| (concat
| )
`


Note that  def  disappeared from (concat ...).

FWIW, adding quotes inside the constant string in org-babel-noweb-wrap:


\\([^ \\t\n][^\]+?[^ \\t]\\|[^ \\t\n]\\)

fixes this instance.


HTH,

Chuck





[O] bug in exporter (org-babel-exp-process-buffer)

2014-06-09 Thread Charles Berry


The use of `org-confirm-babel-evaluate' as a function breaks inline src 
blocks just as was described in this thread from last year:

http://lists.gnu.org/archive/html/emacs-orgmode/2013-11/msg00669.html

I believe that the patch by Eric Schulte in 


===
commit 6a4dfd318296925b3b895ca6ab85e31309acf84d
Author: Eric Schulte schulte.e...@gmail.com
Date:   Sat Nov 23 12:24:34 2013 -0700


fixed export of inline src blocks

* lisp/ob-exp.el (org-babel-exp-non-block-elements): Fixed export of
  inline src blocks.
===

did the right thing back then, but the function to which it was applied was
removed later on,

I think org-babel-exp-process-buffer took over the work of the 
removed function.

I believe that Eric's patch or something like it would fix the current 
problem in org-babel-exp-process-buffer:

   (inline-src-block
-   (let* ((info (org-babel-parse-inline-src-block-match))
+   (let* ((head (match-beginning 0))
+  (info (append (org-babel-parse-inline-src-block-match)
+(list nil nil head)))
   (params (nth 2 info)))
  (setf (nth 1 info)

Can this be fixed, please?

Thanks,

Chuck





Re: [O] How to create non-inheritable properties?

2014-06-08 Thread Charles Berry
Thorsten Jolitz tjolitz at gmail.com writes:

 
 Grant Rettke gcr at wisdomandwonder.com writes:
 
  Hi,
 
  My org file has a lot of text in it. It really needs to be in the same
  file though, so it is a big file.
 
  When I org-babel-tangle, I would like to speed it up as it takes 8 minutes.
 
 8 minutes? wow ...
 

Just guessing at this, but ...

I suspect Grant's file has noweb chunks and that 
`org-babel-use-quick-and-dirty-noweb-expansion' is set to nil.

If the :noweb-ref feature is not used, setting that variable to t will
make a time difference of a couple of orders of magnitude.

HTH,

Chuck




Re: [O] Adding export option for babel language

2014-05-08 Thread Charles Berry
Ken Mankoff mankoff at gmail.com writes:

 
 
 I'd like to add support for PythonTeX to Org Babel 
 https://github.com/gpoore/pythontex
 
 The motivation is that PythonTeX is a better literate environment than
 just Org + Babel, because it can print results inline just like an
 interactive Python session, instead of all the code followed by all the
 results. 
 
 This is just a modification to the existing LaTeX export for python, it
 is not support for a new language. I'm new to Org development and seek
 advice how to begin approaching the solution.
 
 I'd like the python code blocks to behave just as they do now, but if I
 have set (setq org-latex-listings 'pythontex) instead of (setq
 org-latex-listings 'minted), then instead of wrapping python code blocks
 with:
 
 \begin{minted}[]{python}
 x+2
 print x
 \end{minted}
 
 It should wrap them with
 
 \begin{pyconsole}
 x+2
 print x
 \end{pyconsole}
 

A quick-and-dirty approach to do just that much would be to write an export
filter for `src-block' and maybe `inline-src-block', see

   (info (org) Advanced configuration)

   http://orgmode.org/worg/dev/org-export-reference.html#filter-system

and 

http://orgmode.org/worg/exporters/filter-markup.html


Also, `C-h f org--filter TAB' should give you a buffer of such filter
functions (and a couple of false positives) that you might browse.


HTH,

Chuck 




Re: [O] [BUG] [babel] in :eval never with :session

2014-05-07 Thread Charles Berry
Eric Schulte schulte.eric at gmail.com writes:

 
 Rainer M Krug Rainer at krugs.de writes:
 
  The error is back:
 
 
 You say back, was this error not present recently?  If so could you
 isolate the commit at which this error appeared?
 

The bug seems to be in the use of

(org-link-search heading) 

in org-babel-exp-in-export-file which is called in 
org-babel-exp-process-buffer. 

That search will find the first heading that is a match after 
(point-min). So it will mess up other header args, too.

It was there back in 8.0.7 and recent commits did not touch it AFAICS.

HTH,

Chuck

 Thanks,
 Eric
 
 
  When one header in a subtree which has the header argument
  :eval never
  has the same name as in a following subtree which should be evaluated on
  export, the second subtree is not exported. When the name of the header
  is changed, the subtree is exported as expected.
 
  --8---cut here---start-8---
  #+PROPERTY: exports both
  #+PROPERTY: session *tmp_R*
 
  * Some non-evaluated code
  :PROPERTIES:
  :eval:  never
  :END:
  ** This is the same header
  #+BEGIN_SRC R
  cat(\ntwo\n)
  #+END_SRC
 
  * Data Assessment Results
  ** This is the same header
  If the name of the header is changed, the subtree is evaluated on export.
  #+begin_src R
  cat(\nhere it is  at  at  at  at  at  at  at  at  at
 at  at  at  at  at  at  at  at  at  at  at  at 
at  at  at  at  at  at  at  at  at  at  at  at  at
 at  at  at  at  at  at \n)
  #+end_src
  --8---cut here---end---8---
   
  Org-mode version 8.2.6 (release_8.2.6-920-gc6d698  at 
/Users/rainerkrug/.emacs.d/org-mode/lisp/)
  GNU Emacs 24.3.1 (x86_64-apple-darwin13.0.0, Carbon Version 1.6.0 AppKit
1265) of 2014-02-13 on Rainers-MacBook-Pro-2.local
 
  Cheers,
 
  Rainer
 







Re: [O] [babel][PATCHES] ob-R patches for review

2014-05-07 Thread Charles Berry
Eric Schulte schulte.eric at gmail.com writes:

 
 Rainer M Krug Rainer at krugs.de writes:
 
  Hi
 
  Attached please find seven patches for review to implement the storing
  of org variables in their own environment and to make the org-issued R
  code look nicer in the R session.
 
  Thanks,
 
  Rainer
 
 Hi Rainer,
 
 Thanks for these patches.  I don't have the R experience to review or
 maintain them, but I'm happy to apply them.
 
 I missed some previous discussion in this thread.  Are these patches
 ready to be applied as is?



IMO, the patches hard coded behaviors that would better be customizable
and optional. 

Rainer and I had some back and forth about this -- see the thread.

Best,

Chuck





Re: [O] Export as ASCII whilst respecting current fill column

2014-05-01 Thread Charles Berry
Miguel Guedes miguel.a.guedes at gmail.com writes:

 
 Using org-mode version 7.93f, when exporting to ASCII it doesn't respect
 the current fill column. Can this be enforced?


Miguel,

Upgrade to current org-mode (version 8.2.6) before you do anything else.

Then modify `org-ascii-text-width' to suit your needs.

,
| 
| org-ascii-text-width is a variable defined in `ox-ascii.el'.
| Its value is 72
| 
|   Automatically becomes buffer-local when set.
| 
| Documentation:
| Maximum width of exported text.
| This number includes margin size, as set in
| `org-ascii-global-margin'.
| 
| You can customize this variable.
`

 
 Also, I've noticed that org doesn't remove verbatim tags (=verbatim=)
 but removes BEGIN_EXAMPLE blocks and presumably other BEGIN_xxx blocks;
 is this by design?
 
 


Same deal - upgrade. Then =xyz= becomes `xyz' on export.

HTH,

Chuck




Re: [O] How to load and use Github Flavored Markdown exporter?

2014-05-01 Thread Charles Berry
Grant Rettke gcr at wisdomandwonder.com writes:

 
 Hi,
 
 Org-mode version 8.2.6. Loaded from MELPA org-2014-04-28.
 
 The nice github flavored markdown package is in there ox-gfm.el.
 
 My goal is to use it to do a Markdown export of an org document
 instead of the vanilla exporter.
 
 In an attempt to do so, I ran at startup:
 
 
 (require 'ox-gfm)
 
 
 And did an org dispatch export for Markdown.
 
 Wondering if this is the correct approach?
 
 I don't have any expectations for how the file is generated; I just
 want to know that I am loading and using it correctly.
 

If, after loading ox-gfm, this:

C-c C-e g G


pops up a buffer, then you are on the right track. If the export menu has no 

[g] Export to Github Flavored Markdown

choices, then something is amiss.


C- C-e m char is the wrong path.

HTH,

Chuck






Re: [O] [babel][PATCHES] ob-R patches for review

2014-04-29 Thread Charles Berry
Rainer M Krug Rainer at krugs.de writes:

 
 Hi
 
 Attached please find seven patches for review to implement the storing
 of org variables in their own environment and to make the org-issued R
 code look nicer in the R session.


Rainer,


I have suggestions and a concern.

I suggest that you look at how ESS handles R objects and constructs
calls in elisp to be executed in an R session.

It uses a package and its NAMESPACE to provide that functionality and
store objects. That makes the elisp interface a lot cleaner and keeps
ESS variables out of the users way. The package is found at ESS/etc/ESSR/.

I also suggest that you introduce a customization variable to
allow a user to turn off the functionality you have created.

My concern is that you are injecting code into the R user session or
script that the user may not want. If I already have an R object named
'org' your code will break my code.

Further, all of this is hard coded, so I can't change the
variable/file names.

HTH,

Chuck







Re: [O] Organizing org-mode files: Tree view

2014-04-26 Thread Charles Berry
David Masterson dsmasterson at gmail.com writes:

 
 Dotan Cohen dotancohen at gmail.com writes:
 
  Hi all, I am a VIM user enchanted by the power of org-mode. Please
  excuse my apparent naivety!
 
  I am moving from Zim Wiki (excellent GUI program) to either Vimwiki
  (VIM plugin) or org-mode. I was surprised to see that org-mode has all
  the features of several apps that I use, including Task Warrior, Zim
  Wiki, and Tux Cards. However, one feature that is not clear to me is
  how to organize the various org-mode files. Surely I wouldn't leave
  that to the file system!
 
  Is there some Emacs plugin that could present the org-mode files in a
  tree-fashion, such as demonstrated on the left side of this Zim Wiki
  screenshot?
[snip]

  If there is a better way to organize the files, then I would love to
  know how the more experienced users do it.
 
  Thank you!
 
 I guess the answer(s) would be Dired (builtin to Emacs) or External
 Links in Org.
 

Which is pretty much what I use. But I think Dotan might want speedbar.

See http://www.emacswiki.org/emacs/SpeedBar

Just try it out, open a file -- perhaps a *.org file with multiple
headline levels -- and execute M-: (speedbar 1)

Browse emacswiki for other possibilities.

HTH,

Chuck




Re: [O] sharing my firsts, org babel tangle and init .org file

2014-04-19 Thread Charles Berry
Pete Ley peteley11235 at gmail.com writes:

 
 I've looked at the solution on worg and, though I didn't actually try to
 implement, it seems like tangling your init file every time you open
 Emacs is a little cumbersome. Please correct me if I'm wrong in this
 assumption. 


OK, here goes:

In `org-babel-load-file' the code following the comment

;; tangle if the org-mode file is newer than the elisp file

appears to only re-tangle the .el file iff it is older than the .org file

HTH,

Chuck




Re: [O] How do I chain babel blocks with arguments?

2014-04-16 Thread Charles Berry
Alan Schmitt alan.schmitt at polytechnique.org writes:

 
 Hello,
 
 I have several babel blocks that each work well, but I'm now trying to
 chain them to build some bigger functionality out of them. I'm having
 trouble finding out how to pass arguments between blocks. Here is
 a small example:
 
 --8---cut here---start-8---
 #+name: test1
 #+begin_src emacs-lisp :var x=foo
 x
 #+end_src
 
 #+name:test2
 #+begin_src emacs-lisp :var z=bar :var y=test1(x=z)
 y
 #+end_src
 
 #+call: test2(z=baz)
 --8---cut here---end---8---
 
 Unfortunately this does not work: the evaluation of block `test2' fails
 by telling me `z' does not exist.
 
 How can I execute block `test1' from block `test2' by passing an
 argument that is one from test2?

This is not pretty, but it works:

#+name:test2 
#+begin_src emacs-lisp :var z=bar
  (let ((y (org-sbe test1 (x (intern z)
y)
#+end_src


HTH,

Chuck





Re: [O] Fwd: Mac OS Alias file links

2014-04-14 Thread Charles Berry
Ken Mankoff mankoff at gmail.com writes:

 
 
 On 2014-04-14 at 12:26, Achim Gratz wrote:
  Ken Mankoff writes:
  Aliases are a type of links (ln on linux, shortcut on Windows
  alias on OS X (OS X of course also supports ln)). The difference
  between an OS X alias and ln is that if the target is moved, the OS
  X alias still points to it, and double-clicking on an alias (or
  issuing the open command in a terminal) will open the target,
  wherever it is.
 
[...]

 In my fantasy, the link wouldn't be to an alias file, it would *contain
 the alias* the way the BibDesk field does. Therefore C-o on an alias:
 link would require extra code: Decode the alias, then pass it off to the
 system.
 

The point of using an alias rather than a filename or the name of a 
symbolic link that points to the file is that it inherits the property
of Mac OS X aliases that moving the file does not break the alias ---
it still points to file.

For this to work as you fantasize, you would need to enable the Finder 
application to modify the part of the *.org file that encodes the alias 
when you change the location of the aliased file just as the Finder 
does to the alias when the location of the aliased file is modified in the 
Finder.

That is a heavy lift.

OTOH, writing an AppleScript to make an alias in a folder that is never 
moved, writing elisp to call that script and then make an org-mode link to 
the alias just created might work for you.

HTH,

Chuck




Re: [O] Add-on: Github Flavored Markdown exporter

2014-04-08 Thread Charles Berry
Lars Tveito larstvei at student.matnat.uio.no writes:

 
 Hi, thanks for checking it out!
 
 Thorsten Jolitz writes:
 
  Thorsten Jolitz tjolitz at gmail.com writes:
 
  Lars Tveito larstvei at student.matnat.uio.no writes:
 
  Hi!
 
  I have written an exporter for Github Flavored Markdown, which is a
  derived back-end from the Markdown (vanilla) exporter. It adds
  Github-style src-blocks, strike-through and table of contents.
[snip]

Nice!

 
 Getting it to work with source-blocks was the feature I missed the most
 from the vanilla markdown exporter. If you specify a language in the
 source-block it will be added to the exported version as well; a problem
 occurs if you specify a language not supported by Github. Emacs lisp is
 an example of this, so there is a alist `org-gfm-lang' which by default
 has the value:
 
 ((emacs-lisp . lisp) (elisp . lisp))
 
 So a source block like this:
 
 #+begin_src emacs-lisp
   (defun foo ()
 'foo)
 #+end_src
 
 exports to this:
 
 ```lisp
 (defun foo ()
   'foo)
 ```

In 

https://github.com/github/linguist/blob/master/lib/linguist/languages.yml

I see this:

,
| Emacs Lisp:
|   type: programming
|   lexer: Scheme
|   color: #c065db
|   aliases:
|   - elisp
|   - emacs
|   primary_extension: .el
|   filenames:
|   - .emacs
|   extensions:
|   - .emacs
`


so doesn't '#+BEGIN_SRC elisp' just work? 

And shouldn't '((emacs-lisp . elisp)) be the value of `org-gfm-lang'?

HTH,

Chuck






Re: [O] Help needed - export markdown is it supposed to pre-pend html?

2014-04-03 Thread Charles Berry
Rick DeNatale rick.denatale at gmail.com writes:

 
 Hi, I'm a fairly new org mode user.
 I'm trying to export to markdown and I can't understand the output:
 
 For example with the simple org mode buffer
 
 


Add:

#+OPTIONS: toc:nil

 
 * Top level headline
 ** Second level
 *** Third level
     Some text
 *** Third level
     More text
 * Another top level headline
 

[delete output with table-of-contents at top]

 
 Is this expected? or is there something wrong with my installation?
 

Yes. Use the line above to get rid of the table of contents.

Grep through the manual for '#+OPTIONS' to get up to speed.

HTH,

Chuck





Re: [O] Controlling example block export?

2014-04-01 Thread Charles Berry
Heikki Lehvaslaiho heikki.lehvaslaiho at gmail.com writes:

 
 
 
 I am using example blocks as inline notes where I paste snippets of 
 (pre-formatted) text. I'd like to  be able to control the exporting of 
 those block individually (per document would also be useful). I do not 
 seem to be able to find documentation about anything along those lines. 
 
 
 Here is a mock-up:
 
 
 #+BEGIN_EXAMPLE :exports none
 private notes...
 #+END_EXAMPLE
 
 

Advise or redefine the org-backend-example-block function to use
:switches to decide whether to skip an example block.

Something like this:

#+BEGIN_SRC emacs-lisp

  (defvar org-example-block-skip :skip
example block :switch to skip.)

  (defun org-latex-example-block (example-block contents info)
  Transcode an EXAMPLE-BLOCK element from Org to LaTeX.
CONTENTS is nil.  INFO is a plist holding contextual
information.
  (when (and (org-string-nw-p 
  (org-element-property :value example-block))
 (not (string= 
   org-example-block-skip 
   (org-element-property :switches example-block
(org-latex--wrap-label
 example-block
 (format \\begin{verbatim}\n%s\\end{verbatim}
 (org-export-format-code-default 
  example-block info)

#+END_SRC

 A bigger question is that while code blocks are well defined and well 
 documented, all other blocks are not. Is there somewhere a design 
 document the would give a logic of having different blocks and how they 
 are controlled? Maybe there is an other type of a block that does what I 
 want?
 
 
 The inline documentation in ox*.el files is too low level to be helpful.
 

See also org-element.el and 
http://orgmode.org/worg/dev/org-export-reference.html

Looking at what (org-element-at-point) returns often helps.

Special blocks are another possibility, but will require some customization.

HTH,

Chuck





Re: [O] Generate a table of contents without exporting

2014-04-01 Thread Charles Berry
RG Williams rgwills at gmail.com writes:

 
 Hi,
 I know you can generate a table of contents when exporting, but can you do
 it just within org? For context, I'm uploading an .org file to github and I
 don't need to export it to another format because github recognizes and
 displays it just fine. It's long so a ToC would be nice. Do I just have to
 write it myself?
 
 

AFAIK, you do have to write it yourself, but org-mode provides decent tools
for doing it. Here is an example. Run the src-block and a table of contents
will appear near the top. Change the content and rerun the src-block and
the t-o-c will change accordingly.

It doesn't deal with rules for omitting headlines like
COMMENT, :noexport:, etc, but if you are simply copying the .org file,
maybe it is good enough.


--8---cut here---start-8---
#+RESULTS: Table_of_Contents

* h
lower H
* i
lower I
* j
lower J
** 1
one
** 2
two

#+NAME: Table_of_Contents
#+BEGIN_SRC emacs-lisp :wrap example
  (mapconcat 'identity
   (org-element-map 
   (org-element-parse-buffer 'headline) 'headline 
 (lambda (hl) (let
  ((lev
(org-element-property :level hl)) 
   (htitle (org-element-property :title hl)))
(concat (make-string  lev ? ) -  htitle  \n)
#+END_SRC
--8---cut here---end---8---


HTH,

Chuck




Re: [O] Proposal to replace the prefix repetition with whitespace during expansion of noweb references

2014-03-29 Thread Charles Berry
Pontus Michael m.pontus at gmail.com writes:

 
 I would like to propose a change to the behavior of noweb expansion in 
 relation to prefix handling. 
[snip]


 I recommend to introduce a change that will replace the inserted prefix
 with whitespace of equal length.

[snip]


The behavior you desire can be obtained by using the 

 code-block-name(optional arguments)

idiom for noweb. For example, with a suitably crafted block called 
'my-noweb', this reference

my-noweb( (concat, foo, ) )

would expand just as you want. You can use the functions
org-babel-goto-named-src-block  and org-babel-get-src-block-info to achieve
this.

Multiple noweb references might be handled as well by delimiting the second
argument, e.g. foo,bar.

---

Revising the behavior of the existing code base might break code
that folks have written that depend on the current behavior.

HTH,

Chuck




Re: [O] Bug: [babel] #+PROPERTY: eval never-export disables interactive evaluation [8.2.5h (release_8.2.5h-806-gb1199e at /Users/rainerkrug/.emacs.d/org-mode/lisp/)]

2014-03-25 Thread Charles Berry
Rainer M Krug Rainer at krugs.de writes:

 
 
 The subject says it all - when I set 
 
 #+PROPERTY: eval never-export 
 
 the interactive evaluation of R code blocks is disabled. Message:
 
 Evaluation of this R code-block is disabled.
 
[rest deleted]

It works as advertised for me. I copy and pasted your PROPERTY line
and ran interactively and then exported. Oh yes, I did C-c C-c.

I am running 

Org-mode version 8.2.5h (release_8.2.5h-757-gc444e4 @ ...

I tried with and without :session with same results.

HTH,

Chuck




Re: [O] Out of Order Evaluation

2014-03-20 Thread Charles Berry
Andreas Leha andreas.leha at med.uni-goettingen.de writes:

 
 Hi Michael,
 
 Michael Weylandt michael.weylandt at gmail.com writes:
 
  Hi, 
 
  I want to put a summary of my analysis at the beginning of a document
  using results calculated at the end of the document. Is this possible?

[snip]

 
  Is this possible in a single pass? 


Not quite. The method suggested by Andreas computes the result twice. If
there is any randomness in the results (as in the example) you will get a 
different answer in the summary than when the block is later evaluated.

  I've played with #+NAME and
  block() but haven't gotten the out-of-order evaluation quite
  right.

You can use

#+results: the-mean

before 

#+NAME: the-mean
#+begin_src R
mean(x)
#+end_src

which is after 'theanalysis' block.

And if the format is not pleasing add a filter that reformats the result.


 
  Michael
 
 
 How about something along:
 
 --8---cut here---start-8---
 #+TITLE: Test
 #+AUTHOR: Michael Weylandt
 #+PROPERTY: header-args:R :session *__R__* :exports both
 
 * Summary
 The mean result was src_R[:exports results :var
analysisresults=theanalysis()]{mean(unlist(analysisresults))}
 
 * Analysis, 
 We do some complicated calculations: 
 
 #+name: theanalysis
 #+BEGIN_SRC R
 x - rnorm(5)
 #+END_SRC
 --8---cut here---end---8---


It might be better to mark all the blocks in the doc ':eval never'
and ':exports code' or ':exports none' and put blocks before the first 
headline that do all the calcs from noweb references, and put the #+results
lines (if you need them) wherever you want them in the doc. Like so:



--8---cut here---start-8---
#+TITLE: Test
#+AUTHOR: Michael Weylandt
#+PROPERTY: header-args:R :session *__R__* :exports both


#+NAME: master
#+BEGIN_SRC R :noweb yes :results silent :exports results
theanalysis
#+END_SRC

* Summary


The mean result was  src_R[:exports results]{mean(x)}

* Analysis, 
We do some complicated calculations: 

#+name: theanalysis
#+BEGIN_SRC R :eval never :exports code
x - rnorm(5)
#+END_SRC

--8---cut here---end---8---

IMO, needing ':exports results' for inline src blocks is a bug not a
feature. 

HTH,

Chuck





Re: [O] [BABEL] BUG Re: Omitting try/catch blocks from tangled R code?

2014-03-19 Thread Charles Berry
John Hendy jw.hendy at gmail.com writes:

[deleted]
 
  I think the default behavior should be reverted, as tangling and
  exporting are two different things. When I tangle, I want to see the
  code blocks as they are in the org document (with possible variables and
  expansions) but not to create files where I do not put it explicitly
  into a code block. These wrappers have nothing to do with the code, and
  are only there for the exported engine. So I would either revert to the
  original behavior, or, introduce a new header argument,
  e.g. :include-wrappers, which would, if set to t, include the export
  wrappers in the tangled file. This might be useful for debugging
  exporting of code block results, but not for general tangling.
 
 Thanks for chiming in. This was my gut reaction to the default
 behavior. I guess we're still only a sample size of 2, but
 intuitively, I would think that tangling would be a separate beast in
 most cases from exporting. Just to have it on the record, if I tangle,
 it's usually to take the code I've used in something like a Beamer
 presentation or document and combine it into a single .R file so
 someone can run it without needing Org-mode.

]deleted]

Sorry to be late to add my $0.02...

I never want the try/catch wrappers.

But noweb is indispensable.

I use noweb a lot to organize and collect blocks. In some cases, I export
them and in others I just tangle them.

I hope that the revised code will allow me to turn off try/catch wrapping
and still be able to use noweb when tangling or exporting.

Best,

Chuck




Re: [O] Octave/Matlab Code Export Issue?

2014-03-13 Thread Charles Berry
Phil Regier pregier at math.ku.edu writes:

 
 I'm having trouble with Octave export, and I am not quite sure where to look.
 
 In an Org file I have the following:
 
#+BEGIN_SRC octave
  a = [1;3;5;7;9]
  b = [2;4;6;8]
  ans=a;
#+END_SRC octave
 


Instead try this:

--8---cut here---start-8---
#+NAME: abc
#+BEGIN_SRC octave
  a = [1;3;5;7;9]
  b = [2;4;6;8]
  ans=a;
#+END_SRC
--8---cut here---end---8---

Note that the #+END_SRC line has no trailing language nor anything else:

14.1 Structure of code blocks
=

Live code blocks can be specified with a `src' block or inline.(1)  The
structure of a `src' block is

 #+NAME: name
 #+BEGIN_SRC language switches header arguments
   body
 #+END_SRC


HTH,

Chuck




Re: [O] [Patch] don't add indent for empty line when exiting, a code edit

2014-03-13 Thread Charles Berry
Bastien bzg at gnu.org writes:

 
 Hi Charles,
 
 Charles Berry ccberry at ucsd.edu writes:
 
  This seems to have broken org-edit-src-exit. 
 
  I cannot figure out what triggers it (hence no ECM), but I sometimes 
  get an
  'End of buffer' error from inside the while loop.
 
 I just pushed a fix.  Can you confirm you don't see the error anymore?
 


Time to failure seems longer. But now I get an infinite loop.

The error message is gone. C-g stops the loop, but attempting to exit via 
C-c ' re-indents the code and the loop starts again.

Chuck





Re: [O] [Patch] don't add indent for empty line when exiting, a code edit

2014-03-13 Thread Charles Berry
Bastien bzg at gnu.org writes:

 
 Charles Berry ccberry at ucsd.edu writes:
 
  Time to failure seems longer. But now I get an infinite loop.
 
 Er, sorry for the confusion; should be fixed again.
 

It is not. I am now back to getting the 'End of Buffer' msg

Chuck




Re: [O] [Patch] don't add indent for empty line when exiting, a code edit

2014-03-12 Thread Charles Berry
Bastien bzg at gnu.org writes:

 
 Hi Arun,
 
 Arun Persaud apersaud at lbl.gov writes:
 
  I tried to fix this in org. It seems to work over here, but my elisp as
  well as my understanding of org-mode is not perfect ;) Let me know if it
  needs more work.
 
 Applied, thanks!
 


Bastien,

This seems to have broken org-edit-src-exit. :-(

I cannot figure out what triggers it (hence no ECM), but I sometimes get an
'End of buffer' error from inside the while loop.

I cannot exit the src edit buffer until I revert org-edit-src-exit to its
old version.

HTH,

Chuck




Re: [O] Proposal/request for input: slidify export for html slides

2014-02-09 Thread Charles Berry
John Hendy jw.hendy at gmail.com writes:

 
 On Sat, Feb 8, 2014 at 11:18 AM, Charles Berry ccberry at ucsd.edu wrote:
 
[snip]

  But there is some effort and overhead involved, so only the most
  useful (IMO) have been mapped. Right now, `:noweb yes' will expand the
  reference(s) in place before export, and `:exports none' will not export
  the block. Maybe one day ...
 
 Understood, and no worries. I'm making progress. When you say expand
 references, I'm not sure I follow what that means. References =
 references to variables? So something like :var something=something?
 

'References' refers to noweb references. See

   http://orgmode.org/org.html#noweb 


  More a matter of what my workflow is (so the issue doesn't arise). I use
  the cache=TRUE chunk option on the knitr side to save the results of 
  long
  running computations. When I start work, I execute a src block that 
  loads
  knitr and knits the *.Rnw (or *.Rmd, etc), which has the side effect of
  loading the cached objects. Then I edit the *.org document. If I am
  working on R code, I run the code interactively either from the src edit
  buffer or I C-c C-c the src block. Its handy to leave the results in the
  *.org buffer for reference - they get stripped on export. Maybe I edit
  a figure caption (knitr option fig.cap=R character object), equations,
  or text. When I am ready to see the formatted doc, I export via ravel,
  knit, and view. The cached objects get rebuilt as needed.
 
 Ah. I think I follow this. If you knit the exported .org - Rmd file
 in the same R session that Org is using, if you change the .org and
 re-export to .Rmd, knitr is smart enough not to re-run the code? Is
 that what you mean? 

Almost. ox-ravel does not call knitr. The ravel backends advice 
`org-babel-exp-do-export' when a ravel backend runs so R code src blocks 
are not run, but are turned into chunks (for knitr, Sweave, or ...) and 
exported as such. 

When you want to actually process the resulting document, you have to call 
on knitr or some other R report generator to do the work.

 That also must imply that export to .Rmd doesn't
 execute any of the Org babel code, right (otherwise there would be no
 benefit to your workflow since you'd be waiting for Org anyway)?

Correct for R src blocks. But emacs-lisp and other languages are treated as 
under the parent backends.

 
 If that's the case, I think I could roll with that -- I'd just have
 :eval yes if exporting to .Rmd - knitr, and do a replace-string to
 :eval no if I was going to export to Beamer.
 

In R scr blocks, :eval is ignored by ravel and so need not change when 
ravel is run.

[snip]

 I'm a bit hung up on including non-code-generated images. I'm working
 through one of my presentations to convert to slidify (and may write
 up a Worg tutorial or just one on my blog to add to collective
 knowledge) but am not sure of the right universal Org syntax that
 will work with multiple backends. I'm most used to something like
 this:
 
 #+begin_center
 #+attr_backend :height {6cm, 400px, etc.}
 [[./path/to/image.png]]
 #+end_center
 
 That's not seeming to work with ox-ravel thus far. I'd love not to
 have to change the Org image syntax to straight markdown just for my
 occasional use of slidify.
 

It's not related to ox-ravel, which uses the same transcoders as the parent 
backends for everything except inline src and src blocks.

I'm not sure how to get what you seem to want.

Maybe use a custom link 

  http://orgmode.org/org.html#Adding-hyperlink-types

or ask about html/md links in a fresh thread?

HTH,

Chuck




Re: [O] Proposal/request for input: slidify export for html slides

2014-02-08 Thread Charles Berry
John Hendy jw.hendy at gmail.com writes:

 
 On Fri, Feb 7, 2014 at 11:38 PM, John Hendy jw.hendy at gmail.com wrote:
  On Fri, Feb 7, 2014 at 7:04 PM, Charles Berry ccberry at ucsd.edu wrote:
 
 [snip]
 
  I'll look into those. I just cloned your repo and loaded ox-ravel.
  Quite nice! It worked /pretty/ well out of the box. One issue is that
  it doesn't seem to obey :eval no for babel blocks. I exported to .Rmd
  successfully, but the presentation has a bunch of errors in the code
  blocks from trying to actually execute the code. The .Rmd doesn't have
  any instances of ```{r eval=F}; could this feature be added?
 
 Just kidding. Discovered #+attr_ravel and the proper knitr argument
 for code chunks, which worked as expected with:
 
 #+attr_ravel: eval=F
 #+begin_src R ...
 
 I still think it makes sense to allow :eval no. This seems more
 Org-ish since the ideology is to have one set of Org syntax where
 possible, which translates to any number of languages. [...]

In principal, it makes sense to map babel header args to knitr chunk 
options. At least when the headers arg and chunk option do about the
same thing.

But there is some effort and overhead involved, so only the most
useful (IMO) have been mapped. Right now, `:noweb yes' will expand the
reference(s) in place before export, and `:exports none' will not export
the block. Maybe one day ...

 I get that we
 have #+attr_latex for latex-only things, #+attr_html for html-only
 things, and so on, but I wouldn't consider :eval to fall into this
 category. Or perhaps I don't understand... would the idea be that I
 don't want to run it in *Org*, but I'd not want all my chunks disabled
 in the .Rmd?

More a matter of what my workflow is (so the issue doesn't arise). I use
the cache=TRUE chunk option on the knitr side to save the results of long
running computations. When I start work, I execute a src block that loads
knitr and knits the *.Rnw (or *.Rmd, etc), which has the side effect of 
loading the cached objects. Then I edit the *.org document. If I am 
working on R code, I run the code interactively either from the src edit
buffer or I C-c C-c the src block. Its handy to leave the results in the
*.org buffer for reference - they get stripped on export. Maybe I edit
a figure caption (knitr option fig.cap=R character object), equations,
or text. When I am ready to see the formatted doc, I export via ravel,
knit, and view. The cached objects get rebuilt as needed.

 
 My workflow might be odd in that I tend to futz with plot parameters
 once, get the desired image, and then set :eval no for the rest of my
 document work so I don't have to wait for plots on iterative exports.
 I try to put all my setup code (load packages, data
 reading/manipulation, etc.) in it's own block so that I can easily run
 that whenever I first open the document. From there I only need to
 re-run a plot block if necessary and I'll just temporarily change
 :eval no - yes and then back again after execution.
 

Not odd at all if it saves you time.

But if it takes long to rebuild the objects in that first src block, you
might want to try the cache=TRUE route.


Chuck

p.s. the weird fontification you noted one posting up in this thread seems
like something to raise with the slidify/knitr devs after checking the
*.Rmd to be sure there is no org/ravel induced problem.





Re: [O] Proposal/request for input: slidify export for html slides

2014-02-07 Thread Charles Berry
John Hendy jw.hendy at gmail.com writes:

 
 An interesting update on this. Aside from some image and code block
 stuff, the following works surprisingly well!
 - Export Org - markdown (md)
 - Start an R session and `setwd(/path/to/file.md)`
 - Run `library(slidify)` and `author(deck)
 - Copy the deck/assets folder into the parent directory
 - Copy the header code from the resultant deck/index.Rmd file into
 exported .md file
 - Add three hyphens before each heading (headings are # Slide title)
 - Save the file as file.Rmd (vs. file.md)
 - From the R session, do `setwd(../)` (running `author(deck)`
 changes the working directory to deck/
 - Run `slidify(file.Rmd)`
 
[much deleted]

John,

You can put the header code into an MD export block (and ignore index.Rmd).
You can add '#+MD: ---' keyword lines to mark new slides.

Then you export to my.Rmd directly (using ravel) and run slidify(my.Rmd).

Graphics 'just work', but you have to mind the spacing to be sure the slides
render nicely.

The file slidify-example.org at

   https://github.com/chasberry/orgmode-accessories/

produces a minimal slidify slideshow with code, computed results, and graphics.

And it has some notes on org -- slidify using the md-knitr backend from 
ox-ravel.

Ideally, a `md-slidify' backend would get written to automagically
produce the yaml header, separate slides based on headline levels, et 
cetera. But that is a low priority right now.


HTH,

Chuck






Re: [O] Proposal/request for input: slidify export for html slides

2014-02-07 Thread Charles Berry
John Hendy jw.hendy at gmail.com writes:

 
 On Fri, Feb 7, 2014 at 3:50 PM, Charles Berry ccberry at ucsd.edu wrote:
  John Hendy jw.hendy at gmail.com writes:
 
 
  An interesting update on this. Aside from some image and code block

[snip - how John turn org to Rmd to md]


 
  John,
 
  You can put the header code into an MD export block (and ignore 
  index.Rmd).
  You can add '#+MD: ---' keyword lines to mark new slides.
 
 
 Awesome! Hadn't thought of that, and sounds great.
 
  Then you export to my.Rmd directly (using ravel) and run 
  slidify(my.Rmd).
 
  Graphics 'just work', but you have to mind the spacing to be sure the 
  slides
  render nicely.
 
 
 Hmmm. Could you elaborate on this? I haven't experienced this with R +
 ggplot. The presentation I'm working on for tomorrow is on geo-spatial
 data with R and I generate a lot of maps. I find that something like
 this doesn't produce properly scaled images:
 
 #+header: :file .map.pdf
 #+begin_src R :results output graphics :exports results
 
 # install.packages(maps)
 library(maps)
 world - map_data(world)
 
 p - ggplot(world, aes(x = long, y = lat, group = group))
 p - p + geom_polygon(colour = white)
 p
 
 #+end_src
 
 I often get something squarish, which makes the map look really
 compressed (see attached). Thus, I seem to need both this (name,
 header)
 

This is a problem that results from rendering in a square rather than
something proportional to what Mercator used: 202cm x 124cm, I think.

slidify wants to have png files for images, so I think you are stuck
having to set up the size of the device as well as the displayed size
to get nice looking results.

 #+name: world-adj
 #+header: :file map-adj.pdf :width 9 :height 6
 #+begin_src R :results output graphics :exports results
 
 # code from above
 
 #+end_src
 
 and this (right height for latex)
 
 #+begin_center
 #+attr_latex: :height 6cm
 #+RESULTS: world-map
 [[file: world-adj.pdf]]
 #+end_center
 
 I guess in this example, the heights are the same, however sometimes
 this isn't the case as to use the right height for the slides can goof
 with how proportionally big the axis, label, and legend text is and it
 requires, in my opinion, wy more work to use the theme() arguments
 in ggplot2 to tailor them correctly vs. just playing with
 :width/:height options and then scaling the final image in the
 #+RESULTS section.
 
 I would love to avoid the above if you have more clarification on just
work :)

I wasn't thinking about the case you just demonstrated. I have to use
a line that gives out.width, out.height, fig.width, and fig.height, which
slidify ('knitr' under the hood) uses to render the png and the page as you
did to make something that looks like the Mercator map and still have
the text look OK. See http://yihui.name/knitr/options if the options
listed are not familiar. (knitr chunk options can be put in #+ATTR_RAVEL: 
lines for ravel exports to use them.)


[more deleted]

 
 One other question while we're at it... I noticed that
 #+begin/end_center produces this in the output .md file:
 
 div class=center
 ![nil](map.png)
 /div
 
 This doesn't export with slidify. [snip more details]

Right. IMO, using the knitr tools for dealing with such issues beats
wrestling with the babel and md exporter. i.e. fig.align=center handles
this. A good part of my motivation for ox-ravel is that I can deal with
fine tuning output from knitr more easily than I can w/ babel exports.


HTH,

Chuck






Re: [O] Name for part of Org mode buffer before first headline

2014-02-01 Thread Charles Berry
Thomas S. Dye tsd at tsdye.com writes:

 
 Aloha all,
 
 Is there a canonical name for the part of the Org mode buffer before the
 first headline?
 
 I checked the manual and probed my failure-prone memory off and on over
 the last few days, but didn't come up with anything.
 
 I'm looking for the Org mode equivalent of LaTeX's preamble.

Well, if you want a suggestion how 'bout

  ante matter

which (mixing Latin and English and punning with physics) is the stuff
before THE stuff.

Or just 'ante' - what you put down before you begin to play.

Chuck






Re: [O] Extract source code /with/ captions

2014-01-12 Thread Charles Berry
James Harkins jamshark70 at gmail.com writes:

 
 I'm working on a set of Beamer presentations with a bunch of source
 code blocks. I would like to collect all the blocks into one text file
 per presentation, but I also need the captions and ideally a numeric
 index.
 

[deleted]

 So, for instance, where the slideshow and handouts would have a code
 block identified like so:
 
 Listing 3: Compare geometric vs. band-limited waves, aurally.
 
 ... a student should be able to open up the corresponding code file and find:
 
 // Listing 3: Compare geometric vs. band-limited waves, aurally.
 

Can you make the 'caption' into a heading?

If so, then ':comments org' will include it in output when you tangle.

Or maybe ':comments link' or ':comments both' and some post-processing?

HTH,

Chuck




Re: [O] Exporting markdown specific string

2014-01-04 Thread Charles Berry
Bastien bzg at gnu.org writes:

 
 Hi Ista,
 
 Ista Zahn istazahn at gmail.com writes:
 
  I'm trying to figure out how to export a line (say foo) only when
  exporting to markdown.
 
 #+BEGIN_MD
 ...
 #+END_MD
 
 will do.
 
[snip]

No it won't. 

ox-md.el does not define a transcoder for keyword and falls back to its 
parent:

--8---cut here---start-8---
#+BEGIN_SRC emacs-lisp :exports both
(org-version)
#+END_SRC

#+RESULTS:
: 8.2.4

#+BEGIN_SRC emacs-lisp :exports both
(assoc 'keyword (org-export-get-all-transcoders 'md))
#+END_SRC

#+RESULTS:
: (keyword . org-html-keyword)
--8---cut here---end---8---

HTH,

Chuck





Re: [O] Exporting markdown specific string

2014-01-04 Thread Charles Berry
Charles Berry ccberry at ucsd.edu writes:

 
 Bastien bzg at gnu.org writes:
 
  
  Hi Ista,
  
  Ista Zahn istazahn at gmail.com writes:
  
   I'm trying to figure out how to export a line (say foo) only when
   exporting to markdown.
  
  #+BEGIN_MD
  ...
  #+END_MD
  
  will do.
  
 [snip]
 
 No it won't. 
 
 ox-md.el does not define a transcoder for keyword and falls back to its 
 parent:


OOPS!

I meant 'export-block'

--8---cut here---start-8---
#+BEGIN_SRC emacs-lisp :exports both
(assoc 'export-block (org-export-get-all-transcoders 'md))
#+END_SRC

#+RESULTS:
: (export-block . org-html-export-block)
--8---cut here---end---8---


Chuck







Re: [O] Exporting markdown specific string

2014-01-04 Thread Charles Berry
Bastien bzg at gnu.org writes:

 
 Charles Berry ccberry at ucsd.edu writes:
 
  No it won't. 
 
  ox-md.el does not define a transcoder for keyword and falls back to its 
  parent:
 
 Thanks.
 
 I just added this transcoder to the master branch.
 

Looking at org-md-export-block shouldn't it export HTML export blocks as 
well, since markdown allows literal html?

HTH,

Chuck




Re: [O] Exporting markdown specific string

2014-01-04 Thread Charles Berry
Nicolas Goaziou n.goaziou at gmail.com writes:

 
 Hello,
 
 Bastien bzg at gnu.org writes:
 
  Ista Zahn istazahn at gmail.com writes:
 
  I'm trying to figure out how to export a line (say foo) only when
  exporting to markdown.
 
  #+BEGIN_MD
  ...
  #+END_MD
 
  will do.
 
 I added #+begin_markdown...#+end_markdown too, as defined by the
 back-end.

Doesn't org-md-export-block want

 (org-export-with-backend 'html export-block contents info)

at its end?

Chuck




Re: [O] How to use org src functions in other major mode (markdow)?

2013-12-31 Thread Charles Berry
Shuguang Sun shuguang at gmail.com writes:


 Dear all,
 Is it possible to use org src functions in other major mode, e.g., 
 markddown-mode?
 In some extend markdown, source code can be put in to block, for example, 
 r-mode for R script```rx - 1:10```
 Is it possible to highlight the block as org-block #begion_src R? How 
 to run org-edit-src-code on such markdown blocks?
 Best Regards,
 Shuguang Sun
 


Shuguang,


I cannot tell if you want to move org-mode format to *.Rnd or vice versa.

If you work in org-mode, you can export to markdown. 

If you want to go from markdown to org-mode pandoc will do some of the work,
but the org-mode it produces needs further prettying up and the source code
blocks need work.

If you want to use org-mode documents to produce knitr markdown, you can
use ravel.

See https://github.com/chasberry/orgmode-accessories


Here is an example. With a file like this:

--8---cut here---start-8---

* header 1

#+NAME: markdown-block
#+BEGIN_SRC R
a - 1
b - 2
a+b
#+END_SRC

--8---cut here---end---8---


Ravel export will produce a  *.Rmd file like this:

--8---cut here---start-8---
div id=table-of-contents
h2Table of Contents/h2
div id=text-table-of-contents
ulb
lia href=#sec-11. header 1/a/li
/ul
/div
/div
# header 1

```{r markdown-block}
a - 1
b - 2
a+b
```
--8---cut here---end---8---


Which knitr will render as *.md like this:


--8---cut here---start-8---
div id=table-of-contents
h2Table of Contents/h2
div id=text-table-of-contents
ul
lia href=#sec-11. header 1/a/li
/ul
/div
/div
# header 1


```r
a - 1
b - 2
a + b
```

```
## [1] 3
```

--8---cut here---end---8---


HTH,

Chuck





Re: [O] re-export using same options

2013-12-23 Thread Charles Berry
Daniel Clemente n142857 at gmail.com writes:

 
   
 Can I re-export using the last settings? 
  
  C-u C-c C-e
 
   Thanks, that makes it faster, but you need to be in the same subtree. 

Not so.

Recent versions of org-mode use this variable to find the subtree:

org-export-dispatch-last-position is a variable defined in `ox.el'.
Its value is #marker at 219 in *scratch*

Documentation:
The position where the last export command was created using the dispatcher.
This marker will be used with `C-u C-c C-e' to make sure export repetition
uses the same subtree if the previous command was restricted to a subtree.

and it appears to update during edits so that same the subtree is found
in subsequent exports. This

 If the current buffer hasn't changed and subtree export 
 was activated, the command will affect that same subtree.

seems to say that buffer edits will break C-u C-c C-e, but 
that did not happen in the examples I tried.

 Is there something that also remembers which subtree was exported?
 


If you still think there is a problem, you should produce an ECM[1] to
demonstrate it.


[1] http://orgmode.org/worg/org-faq.html#ecm




Re: [O] re-export using same options

2013-12-22 Thread Charles Berry
Daniel Clemente n142857 at gmail.com writes:

 
 
   Hi, after exporting a subtree to HTML, I do some change and want to
export again. I find that I have to do a long
 process to get there:
 C-spaceC-c C-u   C-c C-e C-s h HC-u space
 
[snip]
 
   Can I re-export using the last settings? 

[snip]

C-u C-c C-e

See the manual

   (org) The export dispatcher




Re: [O] Error: (wrong-type-argument integer-or-marker-p nil)

2013-11-29 Thread Charles Berry
Sebastien Vauban sva-news@... writes:

 
 Hello Nicolas,
 
 Nicolas Goaziou wrote:
  Sebastien Vauban sva-news@... writes:
 
  When trying to convert a document which contains R graphics, I get the
error:
 
  Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
goto-char(nil)
(progn (goto-char link-end) (skip-chars-forward ))
(setq post-blank (progn (goto-char link-end) (skip-chars-forward  
)) end (point))
 
  Thank you for the report.
 
 Thank you for your prompt attitude, as always...
 
  Could you provide an ECM for it?
 
 Not easy, no, as it now disappeared after an update to the latest version
 of Org.
 
[rest deleted]

There was a problem with org-element-cache-* that Nicolas just fixed 
recently that was generating issues that seem to me could be causing
what you reported.

See

http://thread.gmane.org/gmane.emacs.orgmode/79160/focus=79377


If you do pursue this, you might try turning off the caching to see
if the problems you mention goes away. Or just do

  M-: (org-element-cache-reset) RET

before each export.

HTH,

Chuck




Re: [O] How do I specify the language for a :results code block

2013-11-29 Thread Charles Berry
Thomas S. Dye tsd at tsdye.com writes:

 
 Aloha Alan,
 
 Alan Schmitt alan.schmitt at polytechnique.org writes:
 
  Hello,
 
  I'm trying to write a block in some language (right now shell, but it
  will probably be something different) whose output is an org source
  block is some language (here coq). I keep looking at the documentation
  and I cannot see how to specify the language. If I try something like:
[example-deleted]

 
  How can I have a block with #+BEGIN_SRC coq instead?
[snip]
 
 I think this can be accomplished by chaining:
 
[example-deleted]

The problem I see is that the :var x=y() idiom can hand an object to the
src block that is hard to parse and execute -- depending on the language.

If the object is create code in one language and run it in another, it
is sometimes easier to insert results using noweb abc() calls. 

A simple example: generate code in sh that is run in emacs-lisp

#+name: make-elisp
#+BEGIN_SRC sh :exports none :var fun=+
echo ( $fun 1 2)
#+END_SRC

#+BEGIN_SRC emacs-lisp :noweb yes :exports results
make-elisp()
#+END_SRC

#+RESULTS:
: 3

#+BEGIN_SRC emacs-lisp :noweb yes :exports results
make-elisp(-)
#+END_SRC

#+RESULTS:
: -1

#+BEGIN_SRC emacs-lisp :noweb yes :exports results
make-elisp(list)
#+END_SRC

#+RESULTS:
| 1 | 2 |

HTH,

Chuck




Re: [O] [BUG] org-confirm-babel-evaluate breaks inline src blocks

2013-11-23 Thread Charles Berry
Eric Schulte schulte.eric at gmail.com writes:

 
 Charles Berry ccberry at ucsd.edu writes:
 
  Eric Schulte schulte.eric at gmail.com writes:
 
  
  Charles Berry ccberry at ucsd.edu writes:
  
  

[snip]

 Indeed the fix was to set this element of info to point to the front of
 the inline src block.  I imagine that you probably don't have the
 patched version of the relevant function loaded.  Please try M-x
 describe-function on org-babel-get-src-block-info, then jump to the
 definition of said function where you should see the following code
 which now sets the location of the inline src block head into the last
 element of the info list.
 
   ;; inline source block
   (when (org-babel-get-inline-src-block-matches)
   (setq head (match-beginning 0))
   (setq info (org-babel-parse-inline-src-block-match
 


That _is_ what I had loaded, but ...

org-babel-get-src-block-info is *not* *called* for inline src blocks.

org-babel-exp-non-block-elements doesn't call org-babel-get-src-block-info.
Instead, it has this

 (let* ((info (org-babel-parse-inline-src-block-match))

for inline src blocks.

So changing org-babel-get-src-block-infodoes not fix the inline src block
issue.

===

Juat to be  sure that I understood what was happening, I instrumented
org-babel-get-src-block-info and ran the ECM I posted at the start of this 
thread. 

org-babel-get-src-block-info got called twice for the first src block, then 
I got prompted 

Evaluate this emacs-lisp code block on your system? 

If I  answer 'n' (skip the block redefining org-confirm-babel-evaluate, 
then I get prompted for the inline src block _without_ 
org-babel-get-src-block-info being called again.

If I answer 'y' (redefine org-confirm-babel-evaluate as a lambda form),
I get the error message.

org-babel-exp-results: Wrong type argument: integer-or-marker-p, nil

HTH,

Chuck




Re: [O] [BUG] org-confirm-babel-evaluate breaks inline src blocks

2013-11-23 Thread Charles Berry
Eric Schulte schulte.eric at gmail.com writes:

 

[delete long discussion of bug]

 
 I've just pushed up another fix which should fix this for export too.
 

And it works!

Thanks for the fix and for enabling this useful capability!

Chuck








[O] [bug] [babel] repeated exports w/ inline src blocks yield different results

2013-11-23 Thread Charles Berry

Consider this code:

,
| * test
| 
| #+NAME: block2
| #+BEGIN_SRC emacs-lisp :exports both
| (setf not-yet-bound-a t )
| #+END_SRC
| 
| src_emacs-lisp{(+ 1 1)}
| 
| end of buffer
| 
`
 
Upon export via 

 C-c C-e C-b t A y y 

 yields:
,
| 1 test
| ==
| 
|   ,
|   | (setf not-yet-bound-a t )
|   `
| 
|   ,
|   | t
|   `
| 
|   `2'
| 
|   end of buffer
| 
`

just as one would hope.

But trying it again, 

 C-c C-e C-b t A y y 

gives
,
| 1 test
| ==
| 
|   ,
|   | (setf not-yet-bound-a t )
|   `
|   #+END_SRC
| 
|   ,
|   | t
|   `
| 
|   `2'
| 
|   end of buffer
| 
`

and you see the extra '#+END_SRC' line.

And if you keep repeating those keystrokes, the second result again appears.

However, sometimes a minor change and then an erasure (perhaps 'a a C-x u')
followed by the export keystrokes yields the correct result.

There are some other forms of misbehavior: if  I change the header arg
in the src block to  :exports results, then the first export is correct,
but the second export skips execution of the src block and writes the code
in the export as if ':exports code' had been given. 

But again 'a a C-x u' seems to clear whatever condition causes the 
misbehavior.

Remove the src_emacs-lisp{...} and clear with 'a a C-x u' and
everything works fine again through multiple exports. I tagged the 
subject line '[babel]' because of that.


Chuck




Re: [O] [BUG] org-confirm-babel-evaluate breaks inline src blocks

2013-11-22 Thread Charles Berry
Eric Schulte schulte.eric at gmail.com writes:

 
 Charles Berry ccberry at ucsd.edu writes:
 
[snip]
 
 Thanks for pointing this out, I've just pushed up a fix.
 

AFAICS, it is still broken.

I did a git pull, downloaded the patches, applied them, compiled
ob-core.el. I am still getting 

org-babel-exp-results: Wrong type argument: integer-or-marker-p, nil


I suspect that 

   (,head   (nth 6 ,info))
...
  (goto-char ,head)

in the org-babel-check-confirm-evaluate macro is the source of the message.

(nth 6 info) is nil for inline src blocks.

HTH,

Chuck




[O] [BUG] org-confirm-babel-evaluate breaks inline src blocks

2013-11-16 Thread Charles Berry

Following this thread:

http://thread.gmane.org/gmane.emacs.orgmode/77572/focus=77648

I found that setting org-confirm-babel-evaluate to a lambda form
BREAKS inline src blocks.


Here is an ECM:

# 

#+BEGIN_SRC emacs-lisp
(setf org-confirm-babel-evaluate
  (lambda (rest args)
(message info: %S (org-babel-get-src-block-info 'light))
nil))
#+END_SRC

#+RESULTS:

 src_R{1+1}

# 





Re: [O] org babel before excute hook

2013-10-11 Thread Charles Berry
John Kitchin jkitchin at andrew.cmu.edu writes:

 
 
 
 I have a related kind of problem. When preparing notes 
 for a class, I may end up with 70 code blocks in an org file, many of 
 which create graphics. I am always worried about accidentally using the 
 same filename and overwriting a graphic from an earlier block. A unique,
  but reproducible filename would be sufficient for my needs.
 

Header arg values can be elisp calls. You can use `make-temp-file'.

So every time this block is executed, a new file is created and the 
file link is added to the results.

#+BEGIN_SRC R :results output append :file (make-temp-file temp)
cat(date(),\n)
#+END_SRC

#+RESULTS:
[[file:/var/folders/kb/2hchpbyj7lb6z76l0q73w_fhgn/T/temp302IjV]]
[[file:/var/folders/kb/2hchpbyj7lb6z76l0q73w_fhgn/T/temp3028Lu]]

See `temporary-file-directory', too, if you want to use this, as the
default may not be what you intend.


You might want to use this:

#+BEGIN_SRC emacs-lisp
  (defun local-tfile (file) 
(let ((temporary-file-directory .))
  (make-temp-file file)))
#+END_SRC

Then the files go in the local directory when this is executed:

#+BEGIN_SRC R :file (local-tfile tfile) :results output append 
cat(date(),\n)
#+END_SRC

You might not want `append' in this case.


HTH,

Chuck

[rest deleted]






Re: [O] LaTeX export with Code

2013-10-07 Thread Charles Berry
Sam Flint swflint at flintfam.org writes:

 
 I regularly use org-mode for LP, and would like to be able to export the
 name of a code chunk as a caption in LaTeX.  I have looked at the
 manual, and don't see any way of doing this, are there?


Yes. Quite a few.

If you want is the src block name to be used as the caption, 
you can put this line:

#+CAPTION: use-name-as-caption

before the named src block

and execute this code before you export:

#+BEGIN_SRC emacs-lisp 
  (defun org-export-use-name-as-caption 
  (text optional back-end info)
  Use the block name as the caption.
  (replace-regexp-in-string 
   label{\\([^}]*\\)}\\(use-name-as-caption\\)
   label{\\1}\\1
   text))
  
  (add-to-list 'org-export-filter-src-block-functions 
   'org-export-use-name-as-caption) 
#+END_SRC


Then when you export this

#+CAPTION: use-name-as-caption
#+NAME: y-plus-z-becomes-x
#+BEGIN_SRC R
x - y+z
#+END_SRC

the result is 


\begin{figure}[H]
\begin{verbatim}
x - y+z
\end{verbatim}\caption{\label{y-plus-z-becomes-x}y-plus-z-becomes-x}

\end{figure}

HTH,

Chuck







Re: [O] input data for babel blocks

2013-10-01 Thread Charles Berry
Alan Schmitt alan.schmitt at polytechnique.org writes:

 
 Hi Charles,
 
 ccberry at ucsd.edu writes:
 
  Lacking that, another alternative to the approach you have crafted is to
  use elisp src blocks to set up the commands needed to create the 
  objects,
  and then place the results of executing the elisp src block in the src
  block of your favored language using noweb, for example
 
  #+BEGIN_SRC mylang :noweb yes
elisp-conversion-to-mylang(arg1,arg2)
  #+END_SRC
   
  might convert 'arg2' to an object of the desired type named 'arg1' in a 
  'mylang' src block.
 
 This looks like a very powerful approach, but it's a bit beyond my
 understanding of babel (which is limited) and noweb (whose existence I
 just discovered after reading http://orgmode.org/manual/noweb.html).
 

Sorry if it was a bit obtuse. The examples given by others seem to have 
helped. And I will give one more.

[deleted]

 If you have an example that uses different languages, I'd love to look
 at it. I'll then try to write an example for ocaml.
 


Here is what I use for LaTeX thru elisp to R:



* Quote Blocks 

quote-blks takes two args:

- blk :: a string of comma separated src block names
- sep :: an optional separator for use when there is more than one
 block

I usually save it in a file and load it in with  
(org-babel-lob-ingest file). But you can copy and paste and the example 
below will still work.

#+name: quote-blks
#+BEGIN_SRC emacs-lisp :var blk=abc :var sep=\\n\
(save-excursion
  (replace-regexp-in-string \\ 
   (mapconcat
(lambda (x) 
  (org-babel-goto-named-src-block x)
  (format %S (cadr  (org-babel-get-src-block-info  t
(split-string blk , t)
sep)
   t t))
  
#+END_SRC


* example of use


The LaTeX here can be editted via C-c ' 
(i.e. org-edit-special -- org-edit-src-code).

#+name: lstuff
#+BEGIN_SRC latex :eval never :exports none
Here is a \backslash. And an unmatched quote: '.
#+END_SRC


Here is an example using it on the above block.

The cat statement prints a formatted version.  The str statement shows
what R sees (but the outer quotes are not part of the string).

#+BEGIN_SRC R :noweb yes :results output
some.latex - 
quote-blks(lstuff)
cat(some.latex,\n)
str(some.latex)
#+END_SRC

#+RESULTS:
: Here is a \backslash. And an unmatched quote: '. 
:  chr Here is a \\backslash. And an unmatched quote: '.

HTH,

Chuck




Re: [O] input data for babel blocks

2013-09-30 Thread Charles Berry
Alan Schmitt alan.schmitt at polytechnique.org writes:

 
 Hello,
 
 In my quest for analyzing my data in org mode tables, I'm trying to see
 if I can use my favorite language (i.e., ocaml). I'm thus looking at how

[discussion of revising org-babel-variable-assignments:lang deleted]

 
 I have the following questions for the list:
 - can I always assume that tables are passed as lists of lists?
 - would the patch above be a useful way to deal with this?
 - is there a way to specify the :var parsing in a code block or in the table?

Alan,

Nice description of a problem that has vexed me, too.

It would be nice to have more flexibility in passing objects to src blocks
in ones favored language via the :var header arg.

Lacking that, another alternative to the approach you have crafted is to
use elisp src blocks to set up the commands needed to create the objects,
and then place the results of executing the elisp src block in the src
block of your favored language using noweb, for example

#+BEGIN_SRC mylang :noweb yes
  elisp-conversion-to-mylang(arg1,arg2)
#+END_SRC
 
might convert 'arg2' to an object of the desired type named 'arg1' in a 
'mylang' src block.

FWIW, my own usage of this approach is to write LaTeX code including 
backslashes and unmatched quotes, then convert the code to a valid R
character string for labelling figures (which undoubled backslashes and 
unmatched quotes would invalidate).

HTH,

Chuck






Re: [O] LaTeX export: images subplots

2013-09-11 Thread Charles Berry
Martin Leduc mart_00 at hotmail.com writes:

 


 Hi all,

 I am using org-mode to write a report with several figures. I would
 like to group some images into a same figure, let say a 2x2 panel. I
 know that I can directly embed latex code in my org file, for
 example by using the subfloats (from the latex subfig package).
 However, I would prefer to use an org-based solution of inserting
 the image links in order to keep the convenient way of previewing
 images right into the buffer with C-c C-x C-v.

 The only solution I found is by using tables such as:
 
 #+CAPTION: Insert caption here.
 #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
 | [[pathtoimage]] | [[pathtoimage]] |
 | [[pathtoimage]] | [[pathtoimage]] |
 

 where the size of the images is controled by p{} and C-cxv is
 working.  However, in the exported TeX file, it is a table, not a
 figure. Is there a cleaner way to make image panels that would
 preserve the figure environment in the exported TeX file ?


I think you are close.

Use 

#+BEGIN_SRC org :exports none
#+name: imtable
insert-your-table-here
#+END_SRC


This gives you the images in a form you can view and a way to access the
links so you can export them in a different form.

For example,

#+BEGIN_SRC emacs-lisp :var a=imtable :exports results :results raw
  (mapconcat (lambda(y) 
   (mapconcat 
(lambda(x) (org-export-string-as x 'latex t)) y )) a )
#+END_SRC

exports as 

\includegraphics[width=.9\linewidth]{img3070YH.png}
\includegraphics[width=.9\linewidth]img307BjN.png}
\includegraphics[width=.9\linewidth]img307OtT.png}
\includegraphics[width=.9\linewidth]img307b3Z.png}

when the elements in the table are the image paths img*.png as shown.


HTH,

Chuck




Re: [O] Help proofreading ORG-NEWS for Org 8.1

2013-09-06 Thread Charles Berry
Bastien bzg at gnu.org writes:

 
 Hi all,
 
 I have prepared the changelogs for Org 8.1, see the first
 section in this file:
 
   http://orgmode.org/cgit.cgi/org-mode.git/plain/etc/ORG-NEWS
 
 I have not documented changes in the contrib/ directory, as
 ORG-NEWS is meant to go into the Emacs trunk.
 
 Please let me know if I missed some important changes or if
 some descriptions need some rephrasing/details.


Should the changes in the arguments of org-export-to-file/buffer 
or the move to make the (plist-get info :back-end) return a struct
count as 'Incompatible changes'? Or at least be highlighted somewhere as old
code may be (and - in my case - was) broken by them.

HTH,

Chuck




Re: [O] Superscript before character

2013-09-06 Thread Charles Berry
Roger Mason rmason at mun.ca writes:

 
 Hello,
 
 I'd like to create a superscript that preceeds a letter.  I tried 
 ^1Fred, ^1 Fred, ^{1}Fred and ^{1} Fred, to no avail.
 
 Can this be done in org (8.0.3)?  If so how?
[snip]

\nbsp{}^{1}Fred

exports to ~$^{\text{1}}$Fred in latex and nbsp;sup1/supFred in html

HTH,

Chuck

 






Re: [O] asynchronous code evaluation

2013-09-04 Thread Charles Berry
Johannes Rainer johannes.rainer at gmail.com writes:

 
 
 hi all!
 
 I have some pretty calculation intense R code in a code block and when I 
 execute the code (C-c C-c) my emacs freezes and waits for the code to 
 finish. Is there a way to evaluate the code asynchronously, so that I 
 could edit the file (obviously not the code block itself) while the code 
 is being evaluated?
 
 thanks, jo


Try this:

C-c ' in the R src block. 

Then use C-c C-c (ess-eval-region-or-function-or-paragraph-and-step) to 
execute the long running code from the ESS edit buffer.

You may need to select the region if there are several paragraphs, or 
delete any blank lines.

==

Another alternative is to use ravel. 

  https://github.com/chasberry/orgmode-accessories

Create a knitr or Sweave doc from the org doc or a suitable subtree of the 
computationally intensive parts. 

Then you can knit() the doc from the R session and switch back to
the buffer you want to edit. Also, you might want to turn on caching in the
knitr doc to enable a quick restart when you log in again.







Re: [O] macro expansion in source code

2013-08-29 Thread Charles Berry
Johannes Rainer johannes.rainer at gmail.com writes:

 
 
 hi,
 I was just wondering if there is a way to use macro expansion also in 
 source code blocks or headers. I tried this, but the macro was never 
 expanded, but rather the {{{image_width}}} was exported. could the 
 expansion be done by calling the macro expansion before export 
 (e.g. using a hook)?
 
 something like this:

[snip]

I think the answer is no. But you can accomplish much the same thing with
properties and/or noweb references. Like this

* header
  :PROPERTIES:
  :image_width: 16
  :END:

#+NAME: imwide
#+HEADER: :var iw=(org-entry-get (point) image_width)
#+BEGIN_SRC R :results value
iw
#+END_SRC

#+RESULTS: imwide
: 16


#+BEGIN_SRC R :noweb yes :results output
image.width - 
  imwide()
image.width
#+END_SRC

#+RESULTS:
: [1] 16






Re: [O] Filters not working

2013-08-09 Thread Charles Berry
Thomas S. Dye tsd at tsdye.com writes:

 
 Aloha all,
 
 After an upgrade from 8.0.3 this morning I'm unable to export a large
 writing project that has kept me from reading the ML regularly for the
 last few months. It seems that filters that used to work, no longer do
 so. For example,
 
   #+name: tsd-parencites
   #+BEGIN_SRC emacs-lisp 
   (defun tsd-latex-filter-parencites (text backend info)
 Replace parencites placeholders in Beamer/LaTeX export.
 (when (memq backend '(beamer latex))
   (replace-regexp-in-string π \\parencites text nil t)))
   (add-to-list 'org-export-filter-plain-text-functions
'tsd-latex-filter-parencites)
   #+END_SRC
 
 now lets pi slip through into the LaTeX output, giving this error:
 
 ERROR: Package inputenc Error: Unicode char \u8:π not set up for use with
LaTeX.
 
 My question, is whether this filter is obviously broken given recent
 changes to Org-mode?  Any pointers greatly appreciated.
 

Did you upgrade as in 'git pull'? If not, I cannot help.

If so,

This bit of org-mode:

,
| * headline
| 
| 
| #+BEGIN_SRC emacs-lisp :eval yes :exports both
|   (defun test-filter-final (text back-end info)
| What is back-end?
| (concat type-of back-end:  
| (format %S (type-of back-end))
| \nname of back-end: 
| (symbol-name (org-export-backend-name back-end
|   
|   (add-to-list 'org-export-filter-final-output-functions 'test-filter-final)
| #+END_SRC
`

will export via 

C-c C-e l L y

as 

,
| type-of back-end: vector
| name of back-end: latex
`

Take a look at (defstruct (org-export-backend... in ox.el


HTH,






Re: [O] Filters not working

2013-08-09 Thread Charles Berry
Thomas S. Dye tsd at tsdye.com writes:

 
 Charles Berry ccberry at ucsd.edu writes:
 

[filter to demo extracting back-end name deleted]

 
  ,
  | type-of back-end: vector
  | name of back-end: latex
  `
 
 Yes, it does.
 
 
  Take a look at (defstruct (org-export-backend... in ox.el
 
 OK, I had a look at org-export-backend, but not sure what I'm looking
 for in particular.  
 
 I did note that you don't test back-end directly, but instead look at
 org-export-backend-name. Perhaps this is what Nicolas means by Filters
 defined here shouldn't make a back-end test, as it may prevent back-ends
 derived from this one to behave properly?

That comment was in the context of back-end specific filters and aimed at
back-end developers. You are adding to 
org-export-filter-plain-text-functions, which is for users. So, go ahead
and test.


 
 However, changing my filter so it uses org-export-backend-name doesn't
 seem to change anything.
 
 Or, was I supposed to learn something else from ox.el?
 

The changes introduced in commit

  cea0434c4f7f7f1fc1547e6790b96a76bc217e15
  ox: Change back-ends internal representation to structures

necessitate extracting the name of the back-end from a vector.

So, this bit of code 

 (memq backend '(beamer latex)) 

will never return t, because backend is a vector.

Probably what you want is 

 (memq (org-export-backend-name backend) '(latex beamer))


HTH,





Re: [O] Help with new exporter

2013-07-10 Thread Charles Berry
John Rakestraw lists at johnrakestraw.com writes:

 
 Apologies for responding to myself, but I realized after writing the 
 message below that if I use sed to remove the lines with the word 
 label and all of the empty brackets (i.e., =[]= and ={}= ) in the tex 
 file, then I'm very, very close to what I need. I assume I could write a 
 function and then call it in the publishing routine?
 
 --John

One way to implement this is to define one or more filters.

:filter-final-output might do it for the unwanted brackets.
Maybe :filter-special-block is what you want for the unwanted label lines,
which I guess are created in special block handling

See 

http://orgmode.org/worg/exporters/filter-markup.html 

for some tips as well as the section headed

;;; The Filter System

in ox.el.

[rest deleted]




  1   2   >