Re: [O] Styling HTML output

2011-08-26 Thread Ken.Williams

On 8/26/11 4:01 AM, Bastien b...@altern.org wrote:

Cool - it deserves to be put on Worg org-hacks.org!


Good idea, here's a patch (I hope attachments work on this list?) that
adds it.

--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




0001-Add-an-entry-for-code-output-styling-in-HTML-CSS.patch
Description: 0001-Add-an-entry-for-code-output-styling-in-HTML-CSS.patch


Re: [O] Styling HTML output

2011-08-26 Thread Ken.Williams

On 8/26/11 2:26 PM, Nick Dokos nicholas.do...@hp.com wrote:

Two things:

o application/octet-stream is not the right MIME type for the
 attachment.[...]

o Presumaby the following should say pre class=src src-perl:[...]



Thanks, I think this update is better.  Unfortunately I don't think my
mailer (stupid Outlook) can change the attachments, so I'll inline it here.



From c3fd3627d6f912fe1108eff1fc2893ff6c4631bb Mon Sep 17 00:00:00 2001
From: Ken Williams ken.willi...@thomsonreuters.com
Date: Fri, 26 Aug 2011 13:45:44 -0500
Subject: [PATCH] Add an entry for code-output styling in HTML/CSS.

---
 org-hacks.org |   28 
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/org-hacks.org b/org-hacks.org
index 6c926a0..754d1a8 100644
--- a/org-hacks.org
+++ b/org-hacks.org
@@ -1618,6 +1618,34 @@ workaround, one can use the following:
   ,#+LATEX: }
 #+end_src
 
+*** Styling code sections with CSS
+
+Code sections (marked with =#+begin_src= and =#+end_src=) are exported
+to HTML using =pre= tags, and assigned CSS classes by their content
+type.  For example, Perl content will have an opening tag like
+=pre class=src src-perl=.  You can use those classes to add styling
+to the output, such as here where a small language tag is added at the
+top of each kind of code box:
+
+#+begin_src lisp
+(setq org-export-html-style
+ style type=\text/css\
+!--/*--![CDATA[/*!--*/
+  .src { background-color: #F5FFF5; position: relative;
overflow: visible; }
+  .src:before  { position: absolute; top: -15px; background:
#ff; padding: 1px; border: 1px solid #00; font-size: small; }
+  .src-sh:before   { content: 'sh'; }
+  .src-bash:before { content: 'sh'; }
+  .src-R:before{ content: 'R'; }
+  .src-perl:before { content: 'Perl'; }
+  .src-sql:before  { content: 'SQL'; }
+  .example { background-color: #FFF5F5; }
+/*]]*/--
+ /style)
+#+end_src
+
+Additionally, we use color to distinguish code output (the =.example=
+class) from input (all the =.src-*= classes).
+
 * Hacking Org: Working with Org-mode and other Emacs Packages.
 ** org-remember-anything
 
-- 
1.7.5






--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com







0001-Add-an-entry-for-code-output-styling-in-HTML-CSS.patch
Description: 0001-Add-an-entry-for-code-output-styling-in-HTML-CSS.patch


[O] Styling HTML output

2011-08-25 Thread Ken.Williams
I wanted to share some CSS code that I've found useful for exported HTML 
documents.  It adds a little R or sh or Perl (etc.) label to the top of a 
source block.

(setq org-export-html-style
style type=\text/css\
!--/*--![CDATA[/*!--*/
  .src { background-color: #F5FFF5; position: relative; 
overflow: visible; }
  .src:before  { position: absolute; top: -15px; background: #ff; 
padding: 1px; border: 1px solid #00; font-size: small; }
  .src-sh:before   { content: 'sh'; }
  .src-bash:before { content: 'sh'; }
  .src-R:before{ content: 'R'; }
  .src-perl:before { content: 'Perl'; }
  .src-sql:before  { content: 'SQL'; }
  .example { background-color: #FFF5F5; }
/*]]*/--
/style)

I got help on Stack Overflow to figure that out:  
http://stackoverflow.com/questions/7192054/create-box-with-title-legend-in-css .

I stick that in my .emacs file and I get output with nice little labels.  
Hopefully someone else will find it useful too.

--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com



[O] Folding code sections in HTML export?

2011-08-11 Thread Ken.Williams
Has anyone developed a way to use a collapsable-div section in HTML export of 
code sections?  What I'd love is for all code sections to export their content 
into the HTML, but sections with :exports none or :exports results to have 
the code initially collapsed, while sections with :exports code or :exports 
both to have it initially expanded.

Any precedent?

--
Ken Williams
Senior Research Scientist

Thomson Reuters

http://labs.thomsonreuters.com



[O] Crashing bug in spreadsheet

2011-07-22 Thread Ken.Williams
Hi,  I had the following text in a table, and hit tab in the
bottom-right cell:

| Who | Amt |
|-+-|
| A   |   36.70 |
| A   |  679.96 |
| B   |  192.31 |
| B   | 2500.03 |
| B   |   74.47 |
| C   |   26.64 |
| D   |   82.00 |
|-+-|
| | :=vsum(@II..@III)   |



This caused CPU usage to peg to 100%, and Emacs to hang until killed.
Probably because of the invalid reference, I guess.

I'm using a fairly recent snapshot of org-mode 7.6, and Aquamacs 2.2 on OS
X Snow Leopard.


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




Re: [O] Crashing bug in spreadsheet

2011-07-22 Thread Ken.Williams


On 7/22/11 4:35 PM, Juan Pechiar j...@pechiar.com wrote:

Hi,

'@II..@III' means all rows between the second and third h-lines. In
your case, this is the same vsum(), so you get a circular reference.

Try @I..@II instead


Yeah, I get that, but I was hoping a circular reference (or alternatively
a seemingly invalid reference, since I have no third h-line) would cause
an error rather than force me to kill Emacs.

--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com





[O] 7.6 Parsing error with footnotes?

2011-07-18 Thread Ken.Williams
Hi, 

I noticed a problem in a great-big-huge org-mode file of mine after I
upgraded to version 7.6, and I whittled it down to the following org-mode
file:

-
#+TITLE: My title here
#+AUTHOR:Ken Williams

#+BEGIN_SRC R
[1] 173
#+END_SRC

#+begin_example
: [1] 12151
#+end_example

#+begin_example
[1] 8935
#+end_example
-


When I do C-c C-e b to export to HTML, I get the error:

-

ad-Orig-error: unbalanced begin/end_src blocks with #(#+BEGIN_SRC R
 0 13 (fontified t font-lock-fontified t) 13 14 (fontified t
font-lock-fontified t))
-



If I remove any of those [1] thingies, an export will complete without
error (this is true for both this small sample, and my original big file).

I *suspect* that the problem might be an overzealous footnote-finder,
because I also (after the 7.6 upgrade) have a bunch of number
DEFINITION NOT FOUND errors appearing at the bottom of my exported HTML
file now.

Anyone able to reproduce this?

(yes, I know [1] 173 isn't valid R code.  Still the export probably
shouldn't bomb out though.)

--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




Re: [O] 7.6 Parsing error with footnotes?

2011-07-18 Thread Ken.Williams


On 7/18/11 12:35 PM, Nicolas Goaziou n.goaz...@gmail.com wrote:

This has been fixed since 7.6 release. footone-finder was indeed
overzealous back then.


Great, thanks for your help.  I've upgraded to the latest snapshot  the
problem goes away.

--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




[O] Don't ask, don't run

2011-07-08 Thread Ken.Williams
Hi,

I know from the manual that I can set 'org-confirm-babel-evaluate' to t,
or nil, or a function, to control whether I'm asked permission to run a
code block.

However, that only gives me two choices - ask the user, or pretend the
user said yes.  Sometimes I'd like to pretend the user said no,
without asking.

Specifically, I'd like to always manually control when code blocks are
executed.  When exporting, I don't want them executed (and I don't want to
be asked about my dozens of blocks each time).  When hitting C-c C-c
manually, I just want it to run (and I don't want to be asked whether I'm
sure).

Is there a similar variable, or perhaps an export option, that will give
me this kind of workflow?

Thanks.

--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




[O] Executing debug-enabled code hangs

2011-06-07 Thread Ken.Williams
Hi,

I use org-mode a lot with BEGIN_SRC R sections that I execute manually
with C-c C-c in an *R* session buffer.  Sometimes I go to that session
buffer and execute some code manually, and occasionally I turn on
debugging for a function with debug(func).

If I then go back to my org-mode buffer and execute that function again,
Emacs hangs.  I can't get back to the *R* session in order to step through
the function or disable debugging, so I have to force-quit Emacs.  I know,
I should remember to turn off debugging for those functions, but sometimes
I forget, and the consequence is that I lose the whole session.

Known problem?

This is on:

 * OS X 10.6.6
 * Aquamacs 2.2, which is based on GNU Emacs 23.3.1
 * Org-mode 7.5
 * ess version 5.13

I do have a big huge thread stack trace that Aquamacs generated, if that
would be helpful.

Thanks.

--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




Re: [O] Executing debug-enabled code hangs

2011-06-07 Thread Ken.Williams




On 6/7/11 12:04 PM, Nick Dokos nicholas.do...@hp.com wrote:

ken.willi...@thomsonreuters.com wrote:

I do have a big huge thread stack trace that Aquamacs generated, if that
 would be helpful.


It wouldn't hurt.

OK, here it is:


In GNU Emacs 23.3.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
of 2011-03-18 on braeburn.aquamacs.org - Aquamacs Distribution 2.2
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--with-ns' '--without-x' 'CC=gcc'
'CFLAGS=-O3 -fno-tree-pre -falign-loops -arch i386' 'LDFLAGS=-O3
-fno-tree-pre -falign-loops -arch i386''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t


Command line: (/Applications/Aquamacs.app/Contents/MacOS/Aquamacs)

PATH:
/bin:/etc:/usr/bin:/usr/etc:/usr/sbin:/sbin:/Users/u0048513/bin:/usr/local/
bin:/Users/u0048513/p4/tools/FileTools:/Users/u0048513/p4/tools/perforce:/u
sr/local/git/bin:/usr/local/mysql/bin:/usr/local/texlive/2009/bin/universal
-darwin:/Users/u0048513/Downloads/hadoop-0.20.2/bin:.:/usr/bin:/bin:/usr/sb
in:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin:/usr
/texbin:/usr/local/texlive/2010/bin:/usr/local/texlive/2009/bin:/usr/local/
teTeX/bin/powerpc-apple-darwin-current:/usr/local/teTeX/bin/i386-apple-darw
in-current

exec-path: (/bin /etc /usr/bin /usr/etc /usr/sbin /sbin
/Users/u0048513/bin /usr/local/bin /Users/u0048513/p4/tools/FileTools
/Users/u0048513/p4/tools/perforce /usr/local/git/bin /usr/local/mysql/bin
/usr/local/texlive/2009/bin/universal-darwin
/Users/u0048513/Downloads/hadoop-0.20.2/bin . /usr/bin /bin /usr/sbin
/sbin /usr/local/bin /usr/X11/bin /opt/local/bin /usr/local/git/bin
/Applications/Aquamacs.app/Contents/MacOS/bin /usr/texbin
/usr/local/texlive/2010/bin /usr/local/texlive/2009/bin
/usr/local/teTeX/bin/powerpc-apple-darwin-current
/usr/local/teTeX/bin/i386-apple-darwin-current)

Process: Aquamacs [83471]
Path:/Applications/Aquamacs.app/Contents/MacOS/Aquamacs
Identifier:  Aquamacs
Version: ??? (???)
Code Type:   X86 (Native)
Parent Process:  launchd [232]

Date/Time:   2011-06-06 13:12:43.405 -0500
OS Version:  Mac OS X 10.6.6 (10J567)
Report Version:  6

Interval Since Last Report:  858988 sec
Crashes Since Last Report:   1
Per-App Crashes Since Last Report:   1
Anonymous UUID:  CEF6C8A4-C36D-45C4-9EE6-1C1E031C20AF

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x, 0x
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
abort() called

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib   0x909a2176 __kill + 10
1   libSystem.B.dylib   0x909a2168 kill$UNIX2003 + 32
2   org.gnu.Aquamacs0x000b7173 fatal_error_signal + 307
3   libSystem.B.dylib   0x909a746b _sigtramp + 43
4   libSystem.B.dylib   0x909a2176 __kill + 10
5   libSystem.B.dylib   0x909a2168 kill$UNIX2003 + 32
6   libSystem.B.dylib   0x90a3489d raise + 26
7   libSystem.B.dylib   0x90a4a9bc abort + 93
8   org.gnu.Aquamacs0x000208ba check_message_stack + 42
9   org.gnu.Aquamacs0x000b674c shut_down_emacs + 204
10  org.gnu.Aquamacs0x000b71bf fatal_error_signal + 383
11  libSystem.B.dylib   0x909a746b _sigtramp + 43
12  ??? 00 0 + 0
13  ??? 0x307ef055 0 + 813625429

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib   0x90967982 kevent + 10
1   libSystem.B.dylib   0x9096809c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib   0x90967559 _dispatch_queue_invoke + 163
3   libSystem.B.dylib   0x909672fe _dispatch_worker_thread2 +
240
4   libSystem.B.dylib   0x90966d81 _pthread_wqthread + 390
5   libSystem.B.dylib   0x90966bc6 start_wqthread + 30

Thread 2:
0   libSystem.B.dylib   0x909410fa mach_msg_trap + 10
1   libSystem.B.dylib   0x90941867 mach_msg + 68
2   ...MultitouchSupport.framework  0x93fc7f57 mt_DequeueDataFromDriver +
489
3   ...MultitouchSupport.framework  0x93fc801f
mt_DequeueMultitouchDataFromDriverThreadEntry + 176
4   libSystem.B.dylib   0x9096e85d _pthread_start + 345
5   libSystem.B.dylib   0x9096e6e2 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x  ebx: 0x000b704e  ecx: 0xbfffd4ac  edx: 0x909a2176
  edi: 0x0006  esi: 

Re: [O] Options for HTML PDF export

2011-05-20 Thread Ken.Williams
Sebastien Vauban wxhgmqzgwmuf@... writes:

 Ken.Williams@... wrote:
  [...]
  I'm wondering about best practices (though I hate that term) for
managing
  the export to both HTML  PDF.
 
 Just by curiosity, what don't use like that term?

I'm not sure - I just hear it used a lot as sort of a trump card when
someone wants to impress someone else with how great their methods are, or
if they want to squash someone else's non-compliant tool usage.

In this case though, I'm perfectly willing to be impressed with someone's
method. =)


 I've no time to customize it to your particular needs, but here's
something
 you can update to map it to your needs:
 
 #+begin_src org
 #+BABEL: :results (if (and (boundp 'backend) (eq backend 'latex))
latex file)
 #+end_src

Thanks Seb, I'll try working with that.  I haven't ever done any Lisp
stuff in org-mode, so I may be a little bit lost here, but I'll experiment
a bit.

Is there somewhere in the orgmode manual that talks about where Lisp can
be embedded in documents for interpolation like this? I hadn't seen that
kind of thing before.


 
 Please post your solution for the sake of further sharing...

Definitely will if I find something useful!



--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




[O] Options for HTML PDF export

2011-05-18 Thread Ken.Williams
Hi,

I use the Babel features of org-mode to do a sort of literate-programming 
thing.  I have lots of R code that generates graphics which get included into 
an exported HTML or PDF (via LaTeX) document.

I'm wondering about best practices (though I hate that term) for managing the 
export to both HTML  PDF.  For the HTML I generate the graphics files as PNG, 
but for PDF the PNG format doesn't embed very well, so I need to generate PDF 
or EPS or somesuch.  But then I have to change the :file filename.png to 
:file filename.pdf, which is quite cumbersome to do every time I want to 
export.

Is there some way people have for dealing with this situation?  Some options 
setting maybe?

Thanks.

--
Ken Williams
Senior Research Scientist

Thomson Reuters

http://labs.thomsonreuters.com



Re: [O] Options for HTML PDF export

2011-05-18 Thread Ken.Williams


On 5/18/11 4:19 PM, Nick Dokos nicholas.do...@hp.com wrote:

ken.willi...@thomsonreuters.com wrote:

 I'm wondering about best practices (though I hate that term) for
 managing the export to both HTML  PDF.  For the HTML I generate the
 graphics files as PNG, but for PDF the PNG format doesn't embed very
 well, 

What is the problem with PNG exactly? I've never had any problems
incorporating them into a PDF. It is a bitmap format, so it will not
suffer extreme changes in magnification without some ugliness of course,
but other than that I don't know of any problems.

That is exactly the problem =).  It does include itself into the document,
it just doesn't look very nice.  Since these are data-based graphics
coming from R, their lines should be nice  crisp, but they end up looking
pretty fuzzy.


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




[O] Spurious source-code output?

2011-05-05 Thread Ken.Williams
Hi,

I've got the following source-code section in a sample org-mode document:

#+BEGIN_SRC R :exports output :results graphics :file t.png
plot(1:10, 1:10)
#+END_SRC

My intention is to show just the figure, not the source code, when I export to 
HTML.  But when I do 'C-c C-c' to evaluate the code (which produces a 
#+results: section as expected) and then 'C-c C-e b' to produce the HTML, I'm 
getting both the source code and the plot in the output.

I must be misunderstanding the BEGIN_SRC parameters?  Could anyone correct me?

I'm using Org-mode 7.5 with Aquamacs 2.2 (GNU Emacs 23.3.1).  Thanks.

--
Ken Williams
Senior Research Scientist

Thomson Reuters

http://labs.thomsonreuters.com



Re: [O] Spurious source-code output?

2011-05-05 Thread Ken.Williams


On 5/5/11 10:37 AM, Nick Dokos nicholas.do...@hp.com wrote:

ken.willi...@thomsonreuters.com wrote:

 Hi,
 
 I've got the following source-code section in a sample org-mode
document:
 
 #+BEGIN_SRC R :exports output :results graphics :file t.png
 plot(1:10, 1:10)
 #+END_SRC
 

Try ``:exports results'' - the Org manual says:
[...]


Ack, I even looked at that very section of the manual just moments before
I posted.  Thanks for the help.


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




Re: [O] [babel] Trouble with :cache yes

2011-03-23 Thread Ken.Williams




On 3/23/11 1:46 AM, Rainer M Krug r.m.k...@gmail.com wrote:


When exporting to a pdf, I get the following matrix in the pdf:

  [,1][,2] [,3]  [,4]
[1,] 0.5626863 0.8397120 0.9886886 0.2233873
[2,] 0.8697064 0.1101432 0.1372992 0.4114674
[3,] 0.3548678 0.5658843 0.1608864 0.5809167

And it is different after each export. So it seems that the code block
*is* actually evaluated, despite of the cached info.

Rainer


Yes, that's exactly the behavior I'm seeing too.  Caching seems to have no
effect on HTML export, no matter whether the block already has a
#+results section or not.

 -Ken




Re: [O] [babel] Trouble with :cache yes

2011-03-23 Thread Ken.Williams

On 3/23/11 12:28 PM, Eric Schulte schulte.e...@gmail.com wrote:

Thanks for pointing this out, your example doesn't work for me either.
I tracked this down to a problem of not finding the cached results of
named code blocks.  I've just pushed up a simple fix for this issue, so
caching should now work as expected.

Thanks Eric.  In my case I'm seeing the [mis]behavior even when the code
block has no name - will your fix cover that case too?

 -Ken




Re: [O] [babel] Trouble with :cache yes

2011-03-23 Thread Ken.Williams

On 3/23/11 12:54 PM, Williams, Ken (TR Corp Tech)
ken.willi...@thomsonreuters.com wrote:


On 3/23/11 12:28 PM, Eric Schulte schulte.e...@gmail.com wrote:

Thanks for pointing this out, your example doesn't work for me either.
I tracked this down to a problem of not finding the cached results of
named code blocks.  I've just pushed up a simple fix for this issue, so
caching should now work as expected.

Thanks Eric.  In my case I'm seeing the [mis]behavior even when the code
block has no name - will your fix cover that case too?

Actually, I just realized I'm mistaken.  If I manually evaluate a
(non-named) block, *then* export the entire document, I indeed get the
cached results in the export, as expected.

However, if I change the code of a :cached block somewhere in my document
(or its MD5 is otherwise invalidated) and re-export the document without
first doing C-c C-c, the export will neither use the cache (which is good)
nor save the results back to the cache (which is bad), so the export is
now out of sync with the original.  It would be great if the results in
exports could be cached in the same way they would be cached when manually
evaluating blocks.

Or perhaps, is there some command to evaluate all blocks in a document
that need to be re-evaluated, and save the results back to the buffer?  I
could do that every time before exporting, maybe.


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




Re: [O] [babel] Trouble with :cache yes

2011-03-23 Thread Ken.Williams


On 3/23/11 1:16 PM, Eric Schulte schulte.e...@gmail.com wrote:

ken.willi...@thomsonreuters.com writes:
Or perhaps, is there some command to evaluate all blocks in a document
 that need to be re-evaluated, and save the results back to the buffer?
I
 could do that every time before exporting, maybe.


Fortunately there is such a function, org-babel-execute-buffer, bound to
C-c C-v b, try C-c C-v h in an Org-mode buffer to see all code block
specific key bindings.


So I tried doing that, and unfortunately it looks like I'm going to have
to restructure my document a bit if I want to use it.  I'd been using
#+begin_src blocks in two different ways - some blocks are just code
listings that I don't really intend to run, whereas some blocks are live
code that I want to execute when exporting the document - these latter
have Babel-style arguments like :exports both or :results output and
the like.

Of course, C-c C-v b will treat *all* of the blocks like live code
blocks, so I'm looking for some way to shut off Babel processing of many
of the blocks and just treat them as styled code listings.  Is there some
flag to do that, or should I switch from #+BEGIN_SRC sh to
#+BEGIN_EXAMPLE sh or something?  Does BEGIN_EXAMPLE know about
different languages of code?



--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




Re: [O] [babel] Trouble with :cache yes

2011-03-23 Thread Ken.Williams




On 3/23/11 5:00 PM, Erik Iverson er...@ccbr.umn.edu wrote:

Try :eval never

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

Don't know if that will work, but it sounds promising.

Perfect!  Thanks everyone for the help.


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




[O] [babel] Trouble with :cache yes

2011-03-22 Thread Ken.Williams
Hi,

I'm having some trouble getting :cache yes to behave the way I think
it's supposed to.  As a test, I have a simple example containing just a
title and one source block:

#+source: testcache
#+begin_src R :cache yes :exports both :results output
dat -  matrix(runif(12), 3, 4)
print(dat)
#+end_src


If I export this document to HTML (C-c C-e b), Emacs asks me Evaluate
this R code block (testcache) on your system?  If I say 'y' it
re-evaluates, if I say 'n' it doesn't, so it doesn't seem like there's any
role that caching gets to play here.

In addition, when I export the document as above, the results are not
saved in the original org-mode buffer, so whatever #+results block is
there (or not there) from doing C-c C-c is neither used nor overwritten -
and therefore the exported document contains different results than the
source document.

The behavior I expected (please let me know if my expectation is
incorrect) was for the result of the computation to be cached in the Emacs
buffer when I do the first export, and for that saved result to be
included in the exported content for subsequent exports, until either the
code/inputs change or I delete the results block.

My configuration is:

Emacs  : GNU Emacs 23.2.50.1 (i386-apple-darwin9.8.0, NS
apple-appkit-949.54)
 of 2010-08-18 on braeburn.aquamacs.org - Aquamacs Distribution 2.1
Package: Org-mode version 7.5

Thanks!


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




[O] [babel] Emitting both text graphics output

2011-03-22 Thread Ken.Williams
Hi,

Suppose I have a source block like the following, which both 'print's some
text output and 'plot's to a graphics device:

--
#+begin_src R :file tp.png :exports both :results output graphics
dat -  matrix(runif(12), 6, 2)
print(dat)
plot(dat)
#+end_src
--



I can't seem to get the print() output to display, either by exporting to
HTML or by simple evaluation of the code block.

'C-c C-c' results in the following 'results' section:

--
#+results:
[[file:tp.png]]
--



And 'C-c C-e b' results in HTML output like this:

--
pre class=src src-Rdat span style=color: #008b8b;lt;-/span
matrix(runif(12), 6, 2)
print(dat)
plot(dat)
/pre
p
img src=tp.png  alt=tp.png /
/p

--



Neither of those have the actual printed matrix output, which would be
something like this:

--
#+begin_src R :exports both :results output
dat -  matrix(runif(12), 6, 2)
print(dat)
#+end_src

#+results:
:   [,1]  [,2]
: [1,] 0.3675202 0.1995134
: [2,] 0.9221087 0.1225686
: [3,] 0.6534830 0.6986238
: [4,] 0.3523151 0.1299406
: [5,] 0.7207582 0.5494278
: [6,] 0.3665547 0.6328452
--




Any clues?  Thanks.



--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




Re: [O] How to escape characters in tables

2011-03-07 Thread Ken.Williams

From:  Camille persson camille.pers...@gmail.com
 2011/3/4  ken.willi...@thomsonreuters.com
 [...] here's a test case that shows my intent:
 
   | foo | =m/foo\vert{}foodfight/= |
 
 The \vert{} seems not to work inside a =...= construction.  Furthermore,
 the =...= construction is problematic there because it conflicts with
the
 start-of-formula syntax.


 =...= is used for code so it is printed as it written
 You may use \texttt{}
 | foo | \texttt{m\/foo\vert{}foodfight\/} |


Unfortunately that doesn't work when exporting to HTML though, I assume
it's for LaTeX export only?


I'd suggest there are 3 things that need to be addressed/fixed in org-mode.

First, the table-parser should respect =...= sections and skip over them,
just like a C preprocessor respects double-quoted string sections.

Second, there should be a way to indicate verbatim sections that doesn't
conflict with formula syntax.

Finally, there should be a way (e.g. \x{...}) to stick in a character by
ASCII/Unicode number.  This would help with several issues when a literal
character is intended but it conflicts with a markup character.


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




Re: [O] How to escape characters in tables

2011-03-04 Thread Ken.Williams




On 3/3/11 9:07 PM, Suvayu Ali fatkasuvayu+li...@gmail.com wrote:

On Wed, 2 Mar 2011 09:25:57 -0600
ken.willi...@thomsonreuters.com wrote:

 The issue is that I've got tables whose cells contain the '|'
 character (it's a table of regular expressions), and I can't seem to
 figure out how to escape it so that it doesn't mean a delimiter
 between cells.  Anyone have advice or a pointer to the docs I can't
 seem to find?
 

I don't think you can.

I'm making slight progress, actually.

On StackOverflow 
(http://stackoverflow.com/questions/5144862/escape-pipe-character-in-org-mo
de), it was suggested to use the \vert{} character escape, which does
work.  

However, since this is code (a regular expression), I want it to appear
monospaced, so I'm not out of the woods yet - here's a test case that
shows my intent:

  | foo | =m/foo\vert{}foodfight/= |

The \vert{} seems not to work inside a =...= construction.  Furthermore,
the =...= construction is problematic there because it conflicts with the
start-of-formula syntax.


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com




[O] How to escape characters in tables

2011-03-03 Thread Ken.Williams
I posted a question on Stack Overflow a few days ago, I'm wondering whether 
someone might want to take a look:

  http://stackoverflow.com/questions/5144862/escape-pipe-character-in-org-mode

The issue is that I've got tables whose cells contain the '|' character (it's a 
table of regular expressions), and I can't seem to figure out how to escape it 
so that it doesn't mean a delimiter between cells.  Anyone have advice or a 
pointer to the docs I can't seem to find?

Thanks.

--
Ken Williams
Senior Research Scientist

Thomson Reuters

http://labs.thomsonreuters.com

--
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [O] How to escape characters in tables

2011-03-03 Thread Ken.Williams

On 3/3/11 9:57 AM, Eric S Fraga e.fr...@ucl.ac.uk wrote:

ken.willi...@thomsonreuters.com writes:

... I've got tables whose cells contain the '|'
 character (it's a table of regular expressions), and I can't seem to
 figure out how to escape it so that it doesn't mean a delimiter
 between cells.  Anyone have advice or a pointer to the docs I can't
 seem to find?

I guess it all depends on what you want to do with the resulting
document.  You could always insert a character that looks like the '|'
character, such as the unicode LIGHT VERTICAL BAR (0x2758) character,
'❘', and I'm sure there are others that could be used... org should
ignore this character as a table delimiter.


Thanks Eric.  That's not a great solution in this case, because in order
to work in a regex it needs to be the character '|', 0x7C.

Is there some way to put in characters by ASCII code maybe?


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com

-- 
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode