Re: [O] [0][babel][R] Undesired conversion of integers to floats in R code block output

2012-02-18 Thread Daniel Drake

On 02/18/2012 08:23 AM, Eric Schulte wrote:

Daniel Drake  writes:


Hi All,

I'm using R in org-mode/babel to analyze data from a psychological
study.  The subjects in this study are identified by nine digit integers
(e.g., 987654321) that I treat as strings (or factors) in my R data
frames.

Tables output by an R code block that contain these subject IDs are
not formatted properly: the subject IDs seem to be treated as numbers
and a decimal point and a trailing zero are appended.  For example,
what should be
|   subj.id |
|---|
| 987654321 |
becomes
| subj.id |
| 987654321.0 |
(I've included real, self-contained code below.)

When I write the data frames directly to a file from within the R code
block (using a write.table function call that mimics the one in
ob-R.el), the integer IDs are preserved; but when code from ob-R.el
writes them out, the values get reformated as floats.

I've noticed that eight digit integers are not modified in the same
way, which makes me wonder if there is a 'digits' threshold I could
modify to prevent this from happening.

I've pretty much ruled out the possibility that this transformation
occurs in R; however I'm not proficient enough in elisp to follow the
operations that happen after the data frame is written to a file in
the org-babel-R-write-object-command.

Any pointers to help me figure this out would be very appreciated!
(I've seen this thread:
http://comments.gmane.org/gmane.emacs.orgmode/31373, but do not know
if the conversion to calc has been made already or if it is the source
of the problem.)



Hi Dan,

When I launch Emacs without any personal configuration (emacs -Q),
evaluate ob-R.el to add R support, and then execute your code blocks I
get the following behavior.





I would recommend installing the latest version of Org-mode from source
as that tends to fix many problems, and will at least ensure that we are
both working from the same code base moving forward.  See
http://orgmode.org/worg/org-faq.html#Keeping-current

Best,



Hi Eric,
First of all, thanks for your reply.

Just to be safe, I nuked my org-mode directory and re-cloned from the 
git repository: I'm now at release_7.8.03.386.g2239d (I was at 
release_7.8.03-351-g47eb3 previously).  Is there a more recent version? 
 I also removed the org directory that came with the packaged version 
of emacs, just in case.


I start emacs with the following options:
$ emacs -Q -eval '(setq load-path (cons 
"~/share/emacs/site-lisp/org-mode/lisp" load-path))' -eval "(require 
'ob-R)" test.org


I get the same behavior as before.  I was a little puzzled when I saw 
this happen, as I've been working on this study for over a year in org 
and it's the first time I've seen this behavior.  I went back and tried 
previous versions (e.g., 7.4), and now I see the same thing.


I wonder if Arch (a rolling release linux distribution that tries to be 
close to the leading edge) has updated an underlying library that 
impacts the babel code in some odd way.  (Granted, I don't see how this 
could be, as the emacs environment seems pretty well insulated from the 
underlying OS; PEBKAC just as likely.)


In any event, since you can't reproduce the behavior (thanks again for 
trying), I don't expect it's anything you can fix.  Maybe it will show 
up in other distributions as they update to more current versions.  In 
the mean time, I'll try to improve my elisp skills and figure out where 
the extraneous formatting occurs.


Best,
Dan

- GNU Emacs 23.4.1 (i686-pc-linux-gnu, GTK+ Version 2.24.9) of 
2012-02-01 on shirley.hoetzel.info

- Org-mode version 7.8.03 (release_7.8.03.386.g2239d)




Re: [O] get all todo items as lisp list

2012-02-18 Thread Jambunathan K

> Hi,
>
> Given a todo list in an org file, is there already a function, that
> converts this list to an elisp list, that contains at least heading,
> deadline and properties?

Create the following interactive function. This functions exports Org
file to a *pretty* lisp file.

--8<---cut here---start->8---
(defun org-export-as-lisp ()
  (interactive)
  (or (featurep 'pp) (require 'pp))
  (let ((out-file
 (concat (file-name-sans-extension (buffer-file-name)) ".el")))
(pp-display-expression (org-element-parse-buffer) "*Org Data*")
(with-current-buffer "*Org Data*"
  (write-file out-file nil
--8<---cut here---end--->8---



I am attaching sample todo.org and and the todo.el file created by the
above command.




* TODO todo-test
  DEADLINE: <2012-04-19 Thu 13:33>
   :PROPERTIES:
   :notify:   notify-test
   :END:
* TODO todo-test2
  DEADLINE: <2012-05-20 Sun 16:66>
   :PROPERTIES:
   :notify:   notify-test2
   :END:


todo.el
Description: todo.el



> Example output:
> ((file "test.org" heading "TODO todo-test" deadline (111 222 333)
>properties (notify notify-test))
>  (file "test.org" heading "TODO todo-test2" deadline (123 456 789)
>properties (notify notify-test2)))
>
> Or are there functions, that could help me, to do it myself?
> (I've tried with `org-agenda-get-day-entries', but without success...)
>
> TIA for any help!

-- 


Re: [O] A manuscript on "reproducible research" introducing org-mode

2012-02-18 Thread Rasmus
t...@tsdye.com (Thomas S. Dye) writes:

> I just ran across this article on reproducible research that some of you
> might find interesting.
>
> http://journal.r-project.org/archive/2011-2/RJournal_2011-2_Lundholm.pdf

On reproducible research, are you guys aware of the relatively recent
project Knitr?  Basically, it is a new Sweave which integrate (i)
Sweave, (ii) TiKZDevice, (iii) cacheSweave, and (iv) code highlight into
one very well-functioning package. 

It kind of works with Org, but not ideally¹.  It might be nice to
integrate it closer with Babel-R, as it just-worksᵀᴹ.

–Rasmus

Footnotes: 
¹  http://yihui.name/knitr/demo/org/

-- 
Enought with the bla bla!




Re: [O] get all todo items as lisp list

2012-02-18 Thread Eric Abrahamsen
On Sun, Feb 19 2012, Peter Münster wrote:

> Hi,
>
> Given a todo list in an org file, is there already a function, that
> converts this list to an elisp list, that contains at least heading,
> deadline and properties?
>
> Example input:
> * TODO todo-test
>   DEADLINE: <2012-04-19 Thu 13:33>
>:PROPERTIES:
>:notify:   notify-test
>:END:
> * TODO todo-test2
>   DEADLINE: <2012-05-20 Sun 16:66>
>:PROPERTIES:
>:notify:   notify-test2
>:END:
>
> Example output:
> ((file "test.org" heading "TODO todo-test" deadline (111 222 333)
>properties (notify notify-test))
>  (file "test.org" heading "TODO todo-test2" deadline (123 456 789)
>properties (notify notify-test2)))
>
> Or are there functions, that could help me, to do it myself?
> (I've tried with `org-agenda-get-day-entries', but without success...)

Hi,

If you load org-element.el from contrib/, I think the function
`org-element-parse-buffer' does what you want (and probably a whole lot
more).

Eric

-- 
GNU Emacs 24.0.93.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-02-16 on pellet
Org-mode version 7.8.03 (release_7.8.03.362.g1cc2)




Re: [O] anyway to create link to a line number in a file

2012-02-18 Thread Nick Dokos
Nick Dokos  wrote:

> Not To Miss  wrote:
> 
> > I looked that section carefully and the whole manual briefly. I
> > haven't found anything yet. That's why I am asking on the mailing list
> > to see if anyone has some workaround.
> > 
> > On Sat, Feb 18, 2012 at 9:03 AM, Sean O'Halpin  
> > wrote:
> > > On Fri, Feb 17, 2012 at 4:54 PM, Not To Miss  
> > > wrote:
> > >> Hi all,
> > >>
> > >> I am reading a long text file and want to write down my notes with
> > >> org-mode. I extremely would like to put the line numbers down along
> > >> with my notes. Although there is a way to store a link for text search
> > >> for the current line, I haven't found a way to create a link to a line
> > >> number in the current buffer. Is there anyway to do that? Thanks
> > >
> > > Take a look at org-capture: http://orgmode.org/manual/Capture.html
> 

> The problem is to make sure org-store-link will actually store the line
> number (along with everything else) so that then org-insert-link can
> insert the link in the proper format. I don't think there is a function
> to do that out of the box for line numbers, but you can easily (for some
> value of "easily") write your own. Look in
> 
> (info "(org)Adding hyperlink types")
> 
> for some hints. Briefly, you write a function that checks whether it
> wants to deal with the link or not, and you add it to
> org-store-link-functions. I don't have the time to try it out right now,
> but I believe this should work for what you want.
> 

Following up on this, the following seems to work, although you probably
want to tweak the criterion of when you want *this* function to take
care of links - this particular implementation only applies the line
number treatment to links generated in the file named
"/path/to/the.file.txt" and only that file:

--8<---cut here---start->8---
(defun org-file-lineno-store-link()
  (when (string-equal (buffer-file-name) "/path/to/the.file.txt")
(let* ((link (format "file:%s::%d" (buffer-file-name) 
(line-number-at-pos
  (org-store-link-props
   :type "file"
   :link link

(add-hook 'org-store-link-functions 'org-file-lineno-store-link)
--8<---cut here---end--->8---

Nick




Re: [O] Updating the Babel section of Worg

2012-02-18 Thread Eric Schulte
t...@tsdye.com (Thomas S. Dye) writes:

> Hi Eric,
>
> I pushed a draft of the revised LaTeX language section to Worg
> (http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html).
>
> Please take a look and edit as necessary.  Too often I understand
> these things partially!
>

Everything looks great to me.  Thanks for the contribution!

>
> If Andreas Leha is reading this it would be good to take a look at my
> description of the ImageMagick facility.  I tried to stick closely to
> the sources, but might have strayed.
>
> All the best,
> Tom
>
> Eric Schulte  writes:
>
>> t...@tsdye.com (Thomas S. Dye) writes:
>>
>>> Hi Eric,
>>>
>>> I've attached a first draft of a template for review and revision.  It
>>> is heavily influenced by John Hendy's terrific gnuplot page.  I
>>> believe it incorporates the points in your outline.  Feel free to
>>> edit as appropriate.
>>>
>>
>> Looks great to me.  I made a small change, and I've just pushed it up to
>> worg and linked to it from the languages page.  We can continue to
>> improve this template as needed on worg although I think it is already
>> in very good shape and ready for use.
>>
>> Thanks,
>>
>>>
>>> All the best,
>>> Tom
>>>
>>>
>>>
>>>
>>> Eric Schulte  writes:
>>>
 Hi Tom,

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

> Hi Eric,
>
> Yes, this is overdue.  I think your plan is a good one.
>
> Perhaps a few of the individual use cases could be moved to FIXME,
> instead?  I'm thinking here of Feiming Chen's R setup and some of my
> contributions when I was experimenting writing LaTeX inside source
> code blocks.  The authors could resurrect these as they see fit.
>

 I don't know what FIXME is, but if there is a way to keep the page in
 the worg git repository but remove it from the exported HTML then that
 sounds ideal.

>
> Hopefully, others will contribute use examples.  My sense from reading
> the list is there are many interesting ones.
>
> I'd like it if Org mode users designed a template for the language
> specific pages.  Currently, these seem to me a mixed bag and it would be
> good to regularize them.

 The below is a modified version of a template which can be found in a
 couple of the existing language tutorials, I think it serves as a good
 starting point.

 - Install and Setup
   - Instillation and configuration of software (e.g., the language itself)
   - Configuration of Emacs (e.g., activate language, set command path)
 - Examples
   - Common ways to use the language in an Org-mode document
 - Special cases
   - are there any language-specific header arguments
   - does the language support session evaluation
   - does the language support all result types
   - is the language different from most babel languages
 (e.g., C is compiled before execution, ditaa returns files, etc...)

> It would also be nice to have one for each of the supported languages.
> There are 11 language specific pages now, which leaves quite a few
> languages under-documented.

 (length org-babel-load-languages) ;; => 27

 ls org-contrib/babel/languages/ob-doc-*|wc -l # => 11

 It looks like we have at least 16 more to go before we hit full language
 coverage.  Perhaps we should use the empty cells in the "documentation"
 column in the languages table at [1] as a sign up space for volunteers
 who would be willing to write a brief tutorial demonstrating usage of
 Org-mode with their favorite language.

 Moving forward this is likely something we could request of the
 contributors of new languages.

 Also, once the template above is finalized it should be posted on worg
 and linked to through the languages page.

>
> I'll be happy to work on this as I can.
>

 Great, I don't anticipate having time to put towards this, although I'll
 be happy to help troubleshoot where I can.

 Cheers,

>
> All the best,
> Tom
>
>
> Eric Schulte  writes:
>
>> Thanks for raising this point.  The bulk of the content in the Babel
>> portion of worg is fairly old, predating the syntax standardization
>> efforts this fall.  I've just pushed some minor updates to the main
>> babel pages, but updating the language-specific tutorials and the
>> individual use cases will be a much larger effort.
>>
>> I'm not sure how to proceed.  One option would be to go through and add
>> a [uses deprecated syntax] tag to the top of each such page, which could
>> be removed after the page has been checked and possibly updated to
>> ensure consistency with the latest syntax.
>>
>> Given that the Babel syntax will not be changing significantly moving
>> forward now would be a good time to do such a review.  Ideally this
>> could be comp

Re: [O] Bug: [Babel] sqlite if: End of file during parsing

2012-02-18 Thread Eric Schulte
Philip Rooke  writes:

> Eric Schulte  writes:
>
>> Does the following work with the addition of ":results scalar"?
>
> Yes, there is no error although the format of the result is different to
> the one database line query or the equivalent shell command.  This is
> what happens for me:
>
> #+begin_src sqlite :db ob-bug.db :results output scalar
>   select f_name || " " || l_name from person;
> #+end_src
>
> #+results:
> : "Joe Bloggs"
> : "Fred Smith"
>

Hi Phil,

Thanks for the detailed reproduction information in your original email,
it made this issue much easier to solve.  I've just pushed up a fix,
please let me know if the problem continues.

Best,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] [PATCH] Avoid lisp error with (org-deadline nil "+1d")

2012-02-18 Thread Peter Münster
On Thu, Nov 24 2011, Nick Dokos wrote:

> Are they free variable warnings? If so, you now know how to fix them:
> go wild :-)

All right, done so... ;)

-- 
   Peter




[O] [PATCH] Avoid some warnings about `assignment to free variable'

2012-02-18 Thread Peter Münster

* lisp/org.el, lisp/org-pcomplete.el: Add some `defvars' to avoid
  warnings about `assignment to free variable'.

TINYCHANGE
---
 lisp/org-pcomplete.el |5 +
 lisp/org.el   |2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el
index c475bcc..7a4dc0d 100644
--- a/lisp/org-pcomplete.el
+++ b/lisp/org-pcomplete.el
@@ -50,6 +50,9 @@
   :tag "Org"
   :group 'org)
 
+(defvar org-drawer-regexp)
+(defvar org-property-re)
+
 (defun org-thing-at-point ()
   "Examine the thing at point and let the caller know what it is.
 The return value is a string naming the thing at point."
@@ -247,6 +250,8 @@ This needs more work, to handle headings with lots of 
spaces in them."
 lst))
(substring pcomplete-stub 1)))
 
+(defvar org-drawers)
+
 (defun pcomplete/org-mode/drawer ()
   "Complete a drawer name."
   (let ((spc (save-excursion
diff --git a/lisp/org.el b/lisp/org.el
index a81f7fc..45d4b6a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12778,6 +12778,7 @@ ACTION can be `set', `up', `down', or a character."
 
  Tags
 
+(defvar tags-list)
 (defvar org-agenda-archives-mode)
 (defvar org-map-continue-from nil
   "Position from where mapping should continue.
@@ -14957,6 +14958,7 @@ So these are more for recording a certain time/date."
 (defvar org-ans2) ; dynamically scoped parameter
 
 (defvar org-plain-time-of-day-regexp) ; defined below
+(defvar org-read-date-inactive)
 
 (defvar org-overriding-default-time nil) ; dynamically scoped
 (defvar org-read-date-overlay nil)
-- 
1.7.3.4




Re: [O] Temp files from testing are permanent...

2012-02-18 Thread Achim Gratz
Eric Schulte  writes:
> It will be up to the authors of individual tests to remove tangled and
> exported files.  Ideally we can patch each test to clean up after
> itself.  Perhaps we should provide a test macro which accepts a list of
> file names and optionally removes them if the test exists successfully.
> e.g.,
>
> (org-test-with-cleanup '("exported.html" "tangled.sh" etc...)
>   ...test body...)

Currently those files would have inpredictable names AFAICS, which would
defeat that purpose.  I'm not sure where to do this, but it occurs to me
that it would be easier if those files only had a unique prefix that
didn't change for each invocation of the test suite (a timestamp would
be OK, so it is easier to see which files you're looking at).  If the
files always had the same name, you would have to make sure that there
was no collision, either with existing files or results from earlier
tests, so that would be no good.  If it is easier to always have the
same names for the files, one could just make the test directory name
unique.  I think it is useful for debugging to be able to keep a few
generation of tests around.

> Even if the above is implemented this sounds like a good safeguard.

Safeguards are in place in my Makefile fork.


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

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs




Re: [O] android mobile org question on capture

2012-02-18 Thread Renato
On Sat, 18 Feb 2012 13:28:17 -0500
Matthew Jones  wrote:

> Hi Renato, I'm the maintainer of MobileOrg for Android.

Hi,

> Regarding #1 this seems like an org-mode thing and I'm not too sure...
> usually I just look at these and file them manually, but this could
> get untenable if you have a lot of content

uh yeah, having used it for a few days I realised it's no big fuss as I
thought it would be

> on #2  I think we have it solved here:
> https://github.com/matburt/mobileorg-android/issues/168
> and it will be available in the next version (0.8.4+)

great!!

> Thanks :)

thanks to you, again ;)

cheers,
renato



Re: [O] android mobile org question on capture

2012-02-18 Thread Matthew Jones
Hi Renato, I'm the maintainer of MobileOrg for Android.

Regarding #1 this seems like an org-mode thing and I'm not too sure...
usually I just look at these and file them manually, but this could get
untenable if you have a lot of content

on #2  I think we have it solved here:
https://github.com/matburt/mobileorg-android/issues/168
and it will be available in the next version (0.8.4+)

Thanks :)

On Fri, Feb 17, 2012 at 9:24 AM, Renato  wrote:

> Hi, I have finally set up mobile org on my android phone, with calendar
> sync, and like it very much.
>
> Regarding the capture functionality, is it (or will it be) possible to:
>
> 1) define wich file and under which header the TODOs get written to. I
> have a notes.org file with Todo section where I store all my generic
> TODOs... alternativly I guess I could set up an automated refile when
> calling org-mobile-pull
>
> 2) define SCHEDULED and DEADLINE for the note. This would also be handy
> because captured notes would appear right away in my android
> calendar, without having to get to my pc, org-mobile-pull, add a
> deadline, refile, and finally org-mobile-push.
>
> I just upgraded from 0.8.0 to 0.8.3
>
> cheers and a big thank you to who is writing this software,
> renato
>
>


Re: [O] A manuscript on "reproducible research" introducing org-mode

2012-02-18 Thread Thomas S. Dye
Samuel Wales  writes:

> As a followup to my last comment, this explains how Stapel
> fooled almost everybody and kept raw data hidden:
>
>   
> http://chronicle.com/blogs/percolator/the-fraud-who-fooled-almost-everyone/27917
>
> And NYT "Fraud Case Seen as a Red Flag for Psychology
> Research" which has a raw data take:
>
>   
> http://www.nytimes.com/2011/11/03/health/research/noted-dutch-psychologist-stapel-accused-of-research-fraud.html
>
> Thanks for the videos, Stephen, I will check them out.
>
> I have been running across scads of fraud stories and interesting
> studies on conflict of interest, reliability of research results, etc.
>  It's all over the place, just scattered and nobody pays much
> attention, perhaps not wanting to believe it.
>
> Reproducible research aims directly at this stuff.  Chapeau!
>
> Samuel
I just ran across this article on reproducible research that some of you
might find interesting.

http://journal.r-project.org/archive/2011-2/RJournal_2011-2_Lundholm.pdf

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com



[O] Displaying or linking to definitions of terms?

2012-02-18 Thread jeremiah . dodds
I've done a fair amount of reading (and-rereading) the manual, and
searching around, but my search skills are failing me and org-mode is
flexible enough that I figure that someone has either done this, or
there's something that makes it unnecessary that I don't know of.

I'd like to be able to write a definition of a term, and then be able to
jump to that definition, or see that definition in some way in buffers
where the term occurs. Preferably on a "file can specify a file with
term definitions" or a global scale, but even per-file period would be
awesome.

I imagine something like a block. In pseudo-org-code:

#+begin_definition :term elegant
pleasingly graceful and stylish in appearance or manner; pleasingly
ingenious and simple.
#+end_definition

If there's a way for me to acheive the goal of "find the definition for
this term" in a "this is already idiomatic-org" type of way, I'd love to
hear it.

If anyone has done something similar, I'd love to hear about it.

If not, I'd love to implement it, and would be immensely grateful for
any high-level pointers to entry-points for implementation, whether
functions or code files or whatnot.

Thanks for your time, and for all the collective effort put into this
amazingly useful peice of software.



Re: [O] Temp files from testing are permanent...

2012-02-18 Thread Eric Schulte
Achim Gratz  writes:

> Olaf Meeuwissen  writes:
>> Successful tests can clean up after themselves but failed tests should
>> not so you can debug.  The decision to remove these files should be left
>> to whoever runs the test suite.  That implies that even successful tests
>> don't really have to bother cleaning up after themselves.
>
> As hinted at in another post yesterday, I did browse the test suite code
> briefly.  The tests try to clean up after themselves, sort-of

Sorry to come late to this discussion.  The tests should clean up all
temporary files and buffers left during their execution.  There has been
some work on this in the last month or two so hopefully the situation
has improved.

> — the trouble is that they leave tangled files and results produced
> during suceesful tests.
>

It will be up to the authors of individual tests to remove tangled and
exported files.  Ideally we can patch each test to clean up after
itself.  Perhaps we should provide a test macro which accepts a list of
file names and optionally removes them if the test exists successfully.
e.g.,

(org-test-with-cleanup '("exported.html" "tangled.sh" etc...)
  ...test body...)

>
>> If you use `make check` to run the test suite, you can easily set TMPDIR
>> via the TESTS_ENVIRONMENT Makefile variable (assuming that that variable
>> is taken into account when making unique file names).  Something like
>
> Yes, that's about the same conclusion I also reached.  Not sure when
> I'll have time to implement and test it.
>

Even if the above is implemented this sounds like a good safeguard.

Thanks,

>
>
> Regards,
> Achim.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



[O] get all todo items as lisp list

2012-02-18 Thread Peter Münster
Hi,

Given a todo list in an org file, is there already a function, that
converts this list to an elisp list, that contains at least heading,
deadline and properties?

Example input:
--8<---cut here---start->8---
* TODO todo-test
  DEADLINE: <2012-04-19 Thu 13:33>
   :PROPERTIES:
   :notify:   notify-test
   :END:
* TODO todo-test2
  DEADLINE: <2012-05-20 Sun 16:66>
   :PROPERTIES:
   :notify:   notify-test2
   :END:
--8<---cut here---end--->8---

Example output:
--8<---cut here---start->8---
((file "test.org" heading "TODO todo-test" deadline (111 222 333)
   properties (notify notify-test))
 (file "test.org" heading "TODO todo-test2" deadline (123 456 789)
   properties (notify notify-test2)))
--8<---cut here---end--->8---

Or are there functions, that could help me, to do it myself?
(I've tried with `org-agenda-get-day-entries', but without success...)

TIA for any help!
-- 
   Peter




Re: [O] Babel add comma in front of my '*'

2012-02-18 Thread Eric Schulte
Daniel Dehennin  writes:

> Eric Schulte  writes:
>
>
> [...]
>
>> Yes,
>>
>> Org-mode does the above to protect the rest of the file from the
>> possible Org-mode syntax in the code block.  However if you then use
>> this text (e.g., through tangling or reference from another code block)
>> the comma will be automatically removed, so it shouldn't cause you any
>> problems.
>
> What about removing it during org-edit-special?
>
> My use is to org-edit-special the block, and use that overlay by
> cut&past and so on.
>
> Regards.

I've just pushed up a fix so that commas will be stripped when
org-edit-special is used.

Best,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] [PATCH] org-capture, removing whitespace from new captures

2012-02-18 Thread David Maus
At Sat, 18 Feb 2012 18:19:49 +0100,
Bastien wrote:
>
> Hi David and Paul,
>
> David Maus  writes:
>
> > Instead of adding the :whitespace-cleanup property to the template
> > definition (what requires you to specify e.g. whitespace-cleanup in
> > every single template) why not define a new hook that is run before
> > the finalization starts? I.e. with capture buffer current and still
> > narrowed.
>
> Yes, I think this is more general, feel free to commit this.
>
> Thanks to you and to Paul for his neat suggestion!

And... done.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de

pgpEgAWNlmHwq.pgp
Description: PGP signature


Re: [O] anyway to create link to a line number in a file

2012-02-18 Thread Nick Dokos
Not To Miss  wrote:

> I looked that section carefully and the whole manual briefly. I
> haven't found anything yet. That's why I am asking on the mailing list
> to see if anyone has some workaround.
> 
> On Sat, Feb 18, 2012 at 9:03 AM, Sean O'Halpin  wrote:
> > On Fri, Feb 17, 2012 at 4:54 PM, Not To Miss  wrote:
> >> Hi all,
> >>
> >> I am reading a long text file and want to write down my notes with
> >> org-mode. I extremely would like to put the line numbers down along
> >> with my notes. Although there is a way to store a link for text search
> >> for the current line, I haven't found a way to create a link to a line
> >> number in the current buffer. Is there anyway to do that? Thanks
> >
> > Take a look at org-capture: http://orgmode.org/manual/Capture.html

*Following* a link with a line number is no problem: org does that out
of the box with a link like

[[file:foo.txt::NNN][desc]]

That is actually documented: (info "(org) External links")

The problem is to make sure org-store-link will actually store the line
number (along with everything else) so that then org-insert-link can
insert the link in the proper format. I don't think there is a function
to do that out of the box for line numbers, but you can easily (for some
value of "easily") write your own. Look in

(info "(org)Adding hyperlink types")

for some hints. Briefly, you write a function that checks whether it
wants to deal with the link or not, and you add it to
org-store-link-functions. I don't have the time to try it out right now,
but I believe this should work for what you want.

Nick






Re: [O] anyway to create link to a line number in a file

2012-02-18 Thread Not To Miss
Sorry, I didn't make it more clear. I want to create a link to a
specific line automatically, just as the command "C-c l"
(org-store-link) to automatically create a link to the text of current
line. Sometimes line number is more important for me to record.

On Sat, Feb 18, 2012 at 12:11 PM, Eric Schulte  wrote:
> Not To Miss  writes:
>
>> I looked that section carefully and the whole manual briefly. I
>> haven't found anything yet. That's why I am asking on the mailing list
>> to see if anyone has some workaround.
>>
>
> [[file:filename.txt::6]] jumps to line 6 of filename.txt for me.  I
> don't know if this is documented... if not a documentation patch would
> be appreciated.
>
> Best,
>
>>
>> On Sat, Feb 18, 2012 at 9:03 AM, Sean O'Halpin  
>> wrote:
>>> On Fri, Feb 17, 2012 at 4:54 PM, Not To Miss  wrote:
 Hi all,

 I am reading a long text file and want to write down my notes with
 org-mode. I extremely would like to put the line numbers down along
 with my notes. Although there is a way to store a link for text search
 for the current line, I haven't found a way to create a link to a line
 number in the current buffer. Is there anyway to do that? Thanks
>>>
>>> Take a look at org-capture: http://orgmode.org/manual/Capture.html
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte/



-- 
Best,
Zhenjiang



Re: [O] [PATCH] manual: fix references to Calc manual

2012-02-18 Thread Bastien
Michael Brand  writes:

> * doc/org.texi: Decapitalize file name in references to Calc manual.
>
> On a case sensitive file system the references from the HTML Org
> manual (e. g. the link href="Calc.html#Embedded-Mode" or
> href="../Calc/Embedded-Mode.html#Embedded-Mode") to the HTML Calc
> manual (e. g. the file calc.html or calc/Embedded-Mode.html) do not
> match.
>
> The info browser did not suffer from this doc bug in org.texi,
> it seems to be case-insensitive regarding link target file name.

Applied, thanks!

-- 
 Bastien



Re: [O] [PATCH] org-capture, removing whitespace from new captures

2012-02-18 Thread Bastien
Hi David and Paul,

David Maus  writes:

> Instead of adding the :whitespace-cleanup property to the template
> definition (what requires you to specify e.g. whitespace-cleanup in
> every single template) why not define a new hook that is run before
> the finalization starts? I.e. with capture buffer current and still
> narrowed.

Yes, I think this is more general, feel free to commit this.

Thanks to you and to Paul for his neat suggestion!

Best,

-- 
 Bastien



[O] Tangle only code block body

2012-02-18 Thread Ista Zahn
Hi all,

Is there a way to tangle just the body of code blocks, without any header 
argurments? For example when I tangle this file

# begin example #

* test
#+name: testplot
#+begin_src R :results output graphics :file tmp.png :tangle tmp.R
  plot(1:10)
#+end_src

# end example #

I get

png(filename="tmp.png")
plot(1:10)
dev.off()

but I want just

plot(1:10)


I've tried removing the %flag setting in org-babel-exp-code-template but it 
didn't seem to have any effect. 

Thanks for any pointers,

Ista





Re: [O] anyway to create link to a line number in a file

2012-02-18 Thread Eric Schulte
Not To Miss  writes:

> I looked that section carefully and the whole manual briefly. I
> haven't found anything yet. That's why I am asking on the mailing list
> to see if anyone has some workaround.
>

[[file:filename.txt::6]] jumps to line 6 of filename.txt for me.  I
don't know if this is documented... if not a documentation patch would
be appreciated.

Best,

>
> On Sat, Feb 18, 2012 at 9:03 AM, Sean O'Halpin  wrote:
>> On Fri, Feb 17, 2012 at 4:54 PM, Not To Miss  wrote:
>>> Hi all,
>>>
>>> I am reading a long text file and want to write down my notes with
>>> org-mode. I extremely would like to put the line numbers down along
>>> with my notes. Although there is a way to store a link for text search
>>> for the current line, I haven't found a way to create a link to a line
>>> number in the current buffer. Is there anyway to do that? Thanks
>>
>> Take a look at org-capture: http://orgmode.org/manual/Capture.html

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] anyway to create link to a line number in a file

2012-02-18 Thread Not To Miss
I looked that section carefully and the whole manual briefly. I
haven't found anything yet. That's why I am asking on the mailing list
to see if anyone has some workaround.

On Sat, Feb 18, 2012 at 9:03 AM, Sean O'Halpin  wrote:
> On Fri, Feb 17, 2012 at 4:54 PM, Not To Miss  wrote:
>> Hi all,
>>
>> I am reading a long text file and want to write down my notes with
>> org-mode. I extremely would like to put the line numbers down along
>> with my notes. Although there is a way to store a link for text search
>> for the current line, I haven't found a way to create a link to a line
>> number in the current buffer. Is there anyway to do that? Thanks
>
> Take a look at org-capture: http://orgmode.org/manual/Capture.html



-- 
Best,
Zhenjiang



Re: [O] sqlite3 in org-babel

2012-02-18 Thread Eric Schulte
Daniel Clemente  writes:

>> Have you tried using a sqlite code block?  See ob-sqlite.el
>
>   I didn't notice there were both ob-sql and ob-sqlite. It would be
>   useful to mention sqlite inside ob-sql.

Done.

>   
>   Perhaps they should be united?
>

I believe there were reasons for keeping them separate.  I'd rather not
combine them without a full overview of both code files.

>
>
>   I still prefer ob-sql for sqlite because it lets me pass the
> parameter ":init /dev/null". That makes it NOT load my ~/.sqliterc
> (where I have a very verbose ".tables"). ob-sqlite does not have
> ":init" and therefore always stuffs that output into the results.
>

>From looking at the man page of sqlite, it seems you can do the same
with ob-sqlite.  Simply pass "--init /dev/null" to the sqlite command.
This could be done e.g. with something like

  (org-babel-sqlite3-command "sqlite3 --init /dev/null")

Best,

>
>
>
>> 
>> Daniel Clemente  writes:
>> 
>> > Hi,
>> >org-babel works well with sqlite3 if you add this (which I propose for 
>> > inclusion):
>> >
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Babel add comma in front of my '*'

2012-02-18 Thread Daniel Dehennin
Eric Schulte  writes:


[...]

> Yes,
>
> Org-mode does the above to protect the rest of the file from the
> possible Org-mode syntax in the code block.  However if you then use
> this text (e.g., through tangling or reference from another code block)
> the comma will be automatically removed, so it shouldn't cause you any
> problems.

What about removing it during org-edit-special?

My use is to org-edit-special the block, and use that overlay by
cut&past and so on.

Regards.
-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1


pgpeb8wKTRyZE.pgp
Description: PGP signature


Re: [O] [0][babel][R] Undesired conversion of integers to floats in R code block output

2012-02-18 Thread Eric Schulte
Daniel Drake  writes:

> Hi All,
>
> I'm using R in org-mode/babel to analyze data from a psychological
> study.  The subjects in this study are identified by nine digit integers
> (e.g., 987654321) that I treat as strings (or factors) in my R data
> frames.
>
> Tables output by an R code block that contain these subject IDs are
> not formatted properly: the subject IDs seem to be treated as numbers
> and a decimal point and a trailing zero are appended.  For example,
> what should be
> |   subj.id |
> |---|
> | 987654321 |
> becomes
> | subj.id |
> | 987654321.0 |
> (I've included real, self-contained code below.)
>
> When I write the data frames directly to a file from within the R code
> block (using a write.table function call that mimics the one in
> ob-R.el), the integer IDs are preserved; but when code from ob-R.el
> writes them out, the values get reformated as floats.
>
> I've noticed that eight digit integers are not modified in the same
> way, which makes me wonder if there is a 'digits' threshold I could
> modify to prevent this from happening.
>
> I've pretty much ruled out the possibility that this transformation
> occurs in R; however I'm not proficient enough in elisp to follow the
> operations that happen after the data frame is written to a file in
> the org-babel-R-write-object-command.
>
> Any pointers to help me figure this out would be very appreciated!
> (I've seen this thread:
> http://comments.gmane.org/gmane.emacs.orgmode/31373, but do not know
> if the conversion to calc has been made already or if it is the source
> of the problem.)
>

Hi Dan,

When I launch Emacs without any personal configuration (emacs -Q),
evaluate ob-R.el to add R support, and then execute your code blocks I
get the following behavior.

* Test
** table as generated by org-mode/babel
#+name: make
#+begin_src R  :results value  :colnames yes
  temp <- data.frame('A'=c('987654321'),'B'=c('98765432'))
  ## -- this call mimics the one in ob-R.el
  write.table(temp,file='test_r.tsv',sep='\t',na='nil',row.names=FALSE,col.names=TRUE,quote=FALSE)
  temp
#+end_src

#+RESULTS: make
| A |B |
|---+--|
| 987654321 | 98765432 |

** table as generated by R directly
#+name: read
#+begin_src sh  :results output
   cat test_r.tsv
#+end_src

#+RESULTS: read
: A	B
: 987654321	98765432

I would recommend installing the latest version of Org-mode from source
as that tends to fix many problems, and will at least ensure that we are
both working from the same code base moving forward.  See
http://orgmode.org/worg/org-faq.html#Keeping-current

Best,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/


Re: [O] [PATCH] Fix old Babel syntax in library-of-babel.org

2012-02-18 Thread Eric Schulte
Applied, Thanks

"Sebastien Vauban"  writes:

> From 3569c16e1d4270e6004441d8cdcc92801b3a01cd Mon Sep 17 00:00:00 2001
> From: Sebastien Vauban 
> Date: Thu, 16 Feb 2012 15:50:17 +0100
> Subject: [PATCH] Fix old Babel syntax
>
> ---
>  contrib/babel/library-of-babel.org |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/contrib/babel/library-of-babel.org 
> b/contrib/babel/library-of-babel.org
> index ecad0fe..0098e72 100644
> --- a/contrib/babel/library-of-babel.org
> +++ b/contrib/babel/library-of-babel.org
> @@ -143,7 +143,7 @@ normal document.
>  #+end_src
>  
>  example usage
> -: #+source: fibs
> +: #+name: fibs
>  : #+begin_src emacs-lisp :var n=8
>  :   (flet ((fib (m) (if (< m 2) 1 (+ (fib (- m 1)) (fib (- m 2))
>  : (mapcar (lambda (el) (list el (fib el))) (number-sequence 0 (- n 1
> -- 
> 1.7.5.1
>
>
> Best regards,
>   Seb

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



[O] [PATCH] manual: fix references to Calc manual

2012-02-18 Thread Michael Brand
* doc/org.texi: Decapitalize file name in references to Calc manual.

On a case sensitive file system the references from the HTML Org
manual (e. g. the link href="Calc.html#Embedded-Mode" or
href="../Calc/Embedded-Mode.html#Embedded-Mode") to the HTML Calc
manual (e. g. the file calc.html or calc/Embedded-Mode.html) do not
match.

The info browser did not suffer from this doc bug in org.texi,
it seems to be case-insensitive regarding link target file name.

Michael
From d4bbda362fe1efc3dd36e5612f9749d91db27e08 Mon Sep 17 00:00:00 2001
From: Michael Brand 
Date: Sat, 18 Feb 2012 17:03:36 +0100
Subject: [PATCH] manual: fix references to Calc manual

* doc/org.texi: Decapitalize file name in references to Calc manual.

On a case sensitive file system the references from the HTML Org
manual (e. g. the link href="Calc.html#Embedded-Mode" or
href="../Calc/Embedded-Mode.html#Embedded-Mode") to the HTML Calc
manual (e. g. the file calc.html or calc/Embedded-Mode.html) do not
match.
---
 doc/org.texi |   13 +++--
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 4bc912c..7a727c5 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -1967,13 +1967,7 @@ @section The Orgstruct minor mode
 
 Org comes with a fast and intuitive table editor.  Spreadsheet-like
 calculations are supported using the Emacs @file{calc} package
-@ifinfo
-(@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
-@end ifinfo
-@ifnotinfo
-(see the Emacs Calculator manual for more information about the Emacs
-calculator).
-@end ifnotinfo
+(@pxref{Top, Calc, , calc, Gnu Emacs Calculator Manual}).
 
 @menu
 * Built-in table editor::   Simple tables
@@ -2533,9 +2527,8 @@ @subsection Formula syntax for Calc
 non-standard convention that @samp{/} has lower precedence than
 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.}  Before
 evaluation by @code{calc-eval} (@pxref{Calling Calc from
-Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
+Your Programs, calc-eval, Calling Calc from Your Lisp Programs, calc, GNU
 Emacs Calc Manual}),
-@c FIXME:  The link to the Calc manual in HTML does not work.
 variable substitution takes place according to the rules described above.
 @cindex vectors, in table calculations
 The range vectors can be directly fed into the Calc vector functions
@@ -14897,7 +14890,7 @@ @subsection Packages that Org cooperates with
 been installed properly.  As of Emacs 22, Calc is part of the Emacs
 distribution.  Another possibility for interaction between the two
 packages is using Calc for embedded calculations.  @xref{Embedded Mode,
-, Embedded Mode, Calc, GNU Emacs Calc Manual}.
+, Embedded Mode, calc, GNU Emacs Calc Manual}.
 @item @file{constants.el} by Carsten Dominik
 @cindex @file{constants.el}
 @cindex Dominik, Carsten
-- 
1.7.4.2



Re: [O] [PATCH] org-capture, removing whitespace from new captures

2012-02-18 Thread David Maus
Hi Bastien,
Hi Paul,

At Sat, 29 Oct 2011 14:08:52 +0200,
Bastien wrote:
>
> Hi Paul,
>
> Paul  writes:
>
> > In fact adding whitespace-cleanup to org-capture-before-finalize-hook
> > was what I tried first, but it didn't do what I wanted.  This hook is
> > called _after_ the buffer is widened - making whitespace-cleanup
> > operate on the _entire_ buffer, not just the newly added capture.
> >
> > I believe the patch is still required - I should have explained
> > org-capture-before-finalize-hook's behaviour more explicitly in my
> > original submission.
>
> I'm willing to apply this patch -- could you provide it with a
> well-formatted ChangeLog entry?

Instead of adding the :whitespace-cleanup property to the template
definition (what requires you to specify e.g. whitespace-cleanup in
every single template) why not define a new hook that is run before
the finalization starts? I.e. with capture buffer current and still
narrowed.

See attached patch that such a hook called
`org-capture-prepare-finalize-hook'.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de
From f737fbdc6ed1d45d8629eb1347e8c8d828f77e32 Mon Sep 17 00:00:00 2001
From: David Maus 
Date: Sat, 18 Feb 2012 16:41:30 +0100
Subject: [PATCH] New hook: Run before the finalization process starts

* org-capture.el (org-capture-prepare-finalize-hook): New hook. Run
before the finalization process starts.
(org-capture-finalize): Run new hook.
---
 lisp/org-capture.el |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d77415b..e3bd9f7 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -347,6 +347,13 @@ widened to the entire buffer."
   :version "24.1"
   :type 'hook)
 
+(defcustom org-capture-prepare-finalize-hook nil
+  "Hook that is run before the finalization starts.
+The capture buffer is current and still narrowed."
+  :group 'org-capture
+  :version "24.1"
+  :type 'hook)
+
 ;;; The property list for keeping information about the capture process
 
 (defvar org-capture-plist nil
@@ -530,6 +537,8 @@ captured item after finalizing."
   (buffer-base-buffer (current-buffer)))
 (error "This does not seem to be a capture buffer for Org-mode"))
 
+  (run-hooks 'org-capture-prepare-finalize-hook)
+
   ;; Did we start the clock in this capture buffer?
   (when (and org-capture-clock-was-started
 org-clock-marker (marker-buffer org-clock-marker)
-- 
1.7.2.5



pgpnFSAWSudo2.pgp
Description: PGP signature


Re: [O] How to activate pre.src in org-babel html output? Can only get class=example

2012-02-18 Thread Eric Schulte
Hi Giovanni,

When I export the following code block

,
| #+begin_src emacs-lisp :exports both
|   :foo
| #+end_src
`

it generates the following HTML.

,
| :foo
| 
| 
| 
| 
| :foo
| 
`

My guess is that during export you get a message along the lines of
"htmlize is required for export".  Try explicitly loading htmlize.el (in
the contrib/lisp directory of org) and then re-exporting and you should
get the desired output.

Best,

Giovanni Moretti  writes:

> Using org-babel, I'm wanting to output Python fragments along with the 
> resultant 
> output to HTML.
>
> That bit's easy, and the following works as expected:
>
> #+options: toc:nil num:nil
> * Using Python interactively
> Any commands typed into the console executed immediately.
>
> #+begin_src python :results output :exports both
> print 355/113
>
> print 17/2
> print 17/2.0
> #+end_src python
>
> However, although I find references to various styling mechanisms (e.g 
> *pre.src*) in the orgmode documentation, I can't find any way to get any more 
> CSS selectors on both the src and output blocks. The only one that ever 
> appears 
> is "example" as shown here:
>
> print 355/113
> print 17/2
> print 17/2.0
> 
> 
>3
>8
>8.5
> 
> 
>
> If I can find out how to make "pre.src" appear (hopefully only on the source 
> block) , then I can change the background colours or fonts to make the output 
> visibly distinct from the source code.
>
> The full HTML output I get is at 
> http://dl.dropbox.com/u/2671560/org-py-babel.html contains lots of CSS 
> selectors, and I can easily include my my own using #+STYLE lines, but I need 
> some way to differentiate the two blocks.
>
> I'm using Emacs 23.1.50.1 and the lastest orgmode  commit 
> b5082974c83a3a4838db86025edce857b11e5847 (Fri Feb 3 15:18:05 2012 +0100)
>
> Any tips?
>
> Thanks
> Giovanni

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Babel add comma in front of my '*'

2012-02-18 Thread Eric Schulte
Daniel Dehennin  writes:

> Hello,
>
> I tryed to babelize an iptables-save file and file to restore it.
>
> Babel put a comma in front of my '*', in the following, the '*mangle'
> became ',*mangle':
>
> #+begin_src text
> # Generated by iptables-save v1.4.4 on Wed Feb 15 10:16:05 2012
> ,*mangle
> :PREROUTING ACCEPT [0:0]
> :INPUT ACCEPT [0:0]
> :FORWARD ACCEPT [0:0]
> :OUTPUT ACCEPT [0:0]
> :POSTROUTING ACCEPT [0:0]
> COMMIT
> #+end_src
>
> Regards.

Yes,

Org-mode does the above to protect the rest of the file from the
possible Org-mode syntax in the code block.  However if you then use
this text (e.g., through tangling or reference from another code block)
the comma will be automatically removed, so it shouldn't cause you any
problems.

Best,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Incomplete syntax highlight for C++ code

2012-02-18 Thread Eric Schulte
Hi Zhiqiu,

First, I would look at the actual text of the exported html code
example.  It likely contains css code specifying how to fontify many
elements of the code block (e.g., on my system your example exports to
the following html [1]).  You can then add css to your org-mode file
specifying what colors to use for each code class.

Also, see the `org-export-htmlize-output-type' variable.

Best,

Zhiqiu Kong  writes:

> Hi,
>
> I am a new org-mode user and am trying to take notes with it. As I put
> source code into my codes a lot, I love the integration with htmlize pretty
> much.  However, I found the syntax highlight on exported html file is not
> as what I see in Emacs. To be more specific, only comments and string
> literals are colored, which is shown in http://img.ly/dXTK. And here is
> what is looks like in Emacs: http://img.ly/dXU6.
>
> Actually, what I expected is the keywords such as int, return should at
> least be colored, which is as introduced by emacs-fu (
> http://emacs-fu.blogspot.com/2009/05/writing-and-blogging-with-org-mode.html
> ).
>
> I checked out the latest org-mode (Org-mode version 7.8.03
> (release_7.8.03.336.gdf0a9) ) and htmlize (for git repository), but the
> problem remains. Moreover, here is my project setting:
>
> (setq org-publish-project-alist
>   '(("note-org"
>  :base-directory "~/Docs/notes/org/"
>  :publishing-directory "~/Docs/notes/html/"
>  :htmlized-source t
>  :base-extension "org"
>  :sub-superscript nil
>  :recursive t
>  :publishing-function org-publish-org-to-html
>  ;; :org-export-htmlize-output-type "css"
>  :html-extension "html"
>  :auto-index t
>  :index-filename "index.org"
>  :index-title "My Notes"
>  :link-home "index.html"
>  ;; :section-numbers nil
>  :style " href=\"css/worg.css\"
> type=\"text/css\"/>")
> ("note-static"
>  :base-directory "~/Docs/notes/org/"
>  :publishing-directory "~/Docs/notes/html/"
>  :recursive t
>  :base-extension
> "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|swf\\|zip\\|gz\\|txt\\|el"
>  :publishing-function org-publish-attachment)
> ("My Notes"
>  :components ("note-org" "note-static")
>  :auto-sitemap t
>  :auto-index t
>  )))
>
> Any suggestion on how to debug and fix this problem? Or this is normal?
> Thanks a lot!!
>
>
> Thanks,
> -Zhiqiu


Footnotes: 
[1]  int main(){
  std::cout << "hello" << std::endl;
}



-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Setting multiple variables for code blocks in one property drawer

2012-02-18 Thread Eric Schulte
Viktor Rosenfeld  writes:

> Hi Eric,
>
> thanks for your input. I just pulled the latest code from git and while
> my original example works, the following does not:
>
> :PROPERTIES:
> :var: foo=1
> :var+: bar=2 
> :var+: baz=3
> :END:
>
> #+BEGIN_SRC sh
> echo foo: $foo
> echo bar: $bar
> echo baz: $baz
> #+END_SRC
>

Thanks for reporting, I've just pushed up a fix for this bug.

>
> There also appears to be a difference between quoted and unquoted
> values and commatas. E.g. the following works
>
> :PROPERTIES:
> :var: foo=1
> :var+: bar="2", baz=3
> :END:
>
> #+BEGIN_SRC sh
> echo foo: $foo
> echo bar: $bar
> echo baz: $baz
> #+END_SRC
>
> If I remove the quotes around 2 I get the following error: 
>
>   ad-Orig-error: reference '2,' not found in this buffer
>
> On the other hand, the following version does not produce an error, but
> the value of $baz is not set.
>
> :PROPERTIES:
> :var: foo=1
> :var+: bar="2",
> :var+: baz=3
> :END:
>
> #+BEGIN_SRC sh
> echo foo: $foo
> echo bar: $bar
> echo baz: $baz
> #+END_SRC
>

Yes, the comma results in the 2 not being parsed as a number, which
means that it will then try to be understood by Babel (which thinks
first of a reference unless the value is wrapped in quotes indicating it
is a string).  The moral is to not give references purely numerical
names.

Best,

>
> Cheers,
> Viktor
>
> Eric Schulte wrote:
>
>> Viktor Rosenfeld  writes:
>> 
>> > Hi,
>> >
>> > after following the discussion about the new BABEL syntax I was under
>> > the impression that the following should work to set two variables in
>> > one PROPERTIES drawer:
>> >
>> > :PROPERTIES:
>> > :var: foo=1
>> > :var+: bar=2
>> > :END:
>> >
>> > However, the definition of bar is ignored. It turns out that there can
>> > only be one :var: or :var+: entry in a drawer and the latter can only be
>> > used to append to inherited entries, but not to those defined in the
>> > same drawer. Is this the intended behavior? How would I define multiple
>> > variables in a drawer (except for putting them all on one line)?
>> >
>> > Thanks,
>> > Viktor
>> >
>> 
>> You are correct, I believe this is a bug.  I've just pushed up a fix, so
>> your example above should now work as expected.
>> 
>> Thanks,
>> 
>> -- 
>> Eric Schulte
>> http://cs.unm.edu/~eschulte/
>> 
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] requesting help debugging tangle on windows

2012-02-18 Thread Eric Schulte
Unfortunately I don't have access to a windows machine for testing of
tangle behavior.  Before we delve deeper, could you confirm two things.

1. It sounds as though you are not using the latest version of Org-mode
   from git.  Please upgrade to the latest -- which should also get you
   the latest ob-clojure.el so you don't have to evaluate the snippet
   posted below.  There are instructions for keeping current with org
   development at http://orgmode.org/worg/org-faq.html#Keeping-current.

2. Try to reproduce the problem using "emacs -Q" which will launch emacs
   without any personal configuration.  That way we can see if this
   windows issue is someone related to your config, or is general.

Thanks,

Andrew Cheng  writes:

> Tangle works in my linux environment but doesn't quite work in my windows
> environment. Here's my org file. It defines a code snippet named "block"
> and then has a tangle section that refers to "block". Tangle results in a
> file with two blank lines in my windows environment.
>
> #+name: block
> #+begin_src clojure :results silent
> (+ 2 3)
> #+end_src
>
> #+begin_src clojure :tangle ../src/tmp.clj :results silent :exports none
> :noweb yes
> <>
> #+end_src
>
> But --- If my tangle section has regular code in it instead of referring to
> other named <> then the resulting file after tangle has the code
> you'd expect.
>
> Below is my org setup. The *Messages* buffer doesn't contain any
> interesting error messages. What can I do to find out what's going on?
>
> I did evaluate the following snippet to get C-c C-c to properly evaluate a
> clojure code block successfully on my machine. It didn't affect the issue
> of tangling. Just thought I'd mention it to be thorough. The snippet is
> from Eric Schulte. I thought that by deleting my elpa org folder and
> starting emacs again I'd get the latest (with his fix) but I discovered
> that I still needed to run this snippet to get C-c C-c to work.
>
> Thanks in advance for any help!
>
> (defun org-babel-execute:clojure (body params)
>  "Execute a block of Clojure code with Babel."
>  (require 'slime)
>  (with-temp-buffer
>(insert (org-babel-expand-body:clojure body params))
>((lambda (result)
>   (let ((result-params (cdr (assoc :result-params params
> (if (or (member "scalar" result-params)
> (member "verbatim" result-params))
> result
>   (condition-case nil (org-babel-script-escape result)
> (error result)
> (slime-eval
>  `(swank:eval-and-grab-output
>,(buffer-substring-no-properties (point-min) (point-max)))
>  (cdr (assoc :package params))
>
> Emacs  : GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
>  of 2011-09-03 on SHAN-PC
> Package: Org-mode version 7.7
>
> current state:
> ==
> (setq
>  org-export-blocks '((src org-babel-exp-src-block nil) (comment
> org-export-blocks-format-comment t)
>  (ditaa org-export-blocks-format-ditaa nil) (dot
> org-export-blocks-format-dot nil))
>  org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
> org-babel-execute-safely-maybe)
>  org-export-preprocess-before-selecting-backend-code-hook
> '(org-beamer-select-beamer-code)
>  org-tab-first-hook '(org-hide-block-toggle-maybe
> org-src-native-tab-command-maybe
>   org-babel-hide-result-toggle-maybe)
>  org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
> org-cycle-show-empty-lines
>   org-optimize-window-after-visibility-change)
>  org-agenda-before-write-hook '(org-agenda-add-entry-text)
>  org-speed-command-hook '(org-speed-command-default-hook
> org-babel-speed-command-hook)
>  org-babel-pre-tangle-hook '(save-buffer)
>  org-occur-hook '(org-first-headline-recenter)
>  org-export-interblocks '((lob org-babel-exp-lob-one-liners) (src
> org-babel-exp-inline-src-blocks))
>  org-metaup-hook '(org-babel-load-in-session-maybe)
>  org-confirm-elisp-link-function 'yes-or-no-p
>  org-export-latex-format-toc-function 'org-export-latex-format-toc-default
>  org-export-preprocess-before-normalizing-links-hook
> '(org-remove-file-link-modifiers)
>  org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
>  org-export-first-hook '(org-beamer-initialize-open-trackers)
>  org-mode-hook '(#[nil "\300\301\302\303\304$\207"
>[org-add-hook change-major-mode-hook org-show-block-all
> append local] 5]
>  #[nil "\300\301\302\303\304$\207"
>[org-add-hook change-major-mode-hook
> org-babel-show-result-all append local] 5]
>  org-babel-result-hide-spec org-babel-hide-all-hashes)
>  org-from-is-user-regexp nil
>  org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
> org-beamer-auto-fragile-frames
>org-beamer-place-default-actions-for-lists)
>  org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
>  org-metadown-hook '(org-babel-pop-to-session-m

Re: [O] bug / regression: C-x C-s is broken in org-edit-special

2012-02-18 Thread Eric Schulte
Thanks for posting this workaround.

I've just pushed up a change which rebinds this key in org-src-mode.  I
don't know why the binding was ever removed in the first place.

Best,

Leo Alekseyev  writes:

> In case anyone is curious, C-x C-s functionality in org-edit-special
> can be easily restored via
>
>   (define-key org-src-mode-map "\C-x\C-s" 'org-edit-src-save)
>
>
> On Thu, Feb 9, 2012 at 4:49 PM, Leo Alekseyev  wrote:
>> Previously, C-x C-s in an org-edit-special buffer (invoked via C-')
>> would save the underlying org buffer (provided (setq
>> org-src-window-setup (quote current-window)) was set; it was buggy
>> with other settings, see
>> http://thread.gmane.org/gmane.emacs.orgmode/50979 for discussion).
>> Currently, C-x C-s prompts to save the temporary source edit buffer in
>> a new file, which is almost certainly not what the user intends.  I
>> hope someone can look into this, C-x C-s shouldn't be broken in any
>> context.
>>
>> This broke some time between commit
>> fc93b6f34071703d5a154a51540f3f4e3f15b8a2 (Jan. 18) and this week,
>> _possibly_ as a result of the change ensuring that buffer-file-name is
>> nil in temporary org-src buffers.  Buffer-file-name not being nil in a
>> temp buffer is incorrect behavior, but in this context having C-x C-s
>> not working is a much worse behavior, so perhaps that change ought to
>> be reverted if it's the culprit.
>>
>> --Leo
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Freemind export and import question/suggestion (newlines problem)

2012-02-18 Thread Johnny
Johnny  writes:

> Hi,
>
> I am trying out the excellent freemind exporter/importer and am running
> into issues with long node names and newlines. 
>
> 1) Exporting org to freemind (node name length limitation?)
> In org-mode, none of the headlines can contain newlines, so occasionaly
> they get a bit long. This is not a (big) issue in org, but when exorting to
> freemind, I would like to limit the names to a maximum length, as the
> mindmap display in freemind need reasonably short node names to give a
> clear overview. It would be great to be able to do this with the
> exporter by setting a variable / giving a prefix number.
>
> 2) Importing freemind to org (remove newlines?)
> For now, I have manually split some lines in freemind to get a good
> mindmap, but then the issue is that when re-importing to org, the
> headlines are including the newline, hence the org-mode headings are
> broken. This may be easily done by replacing all newlines in the node
> name when importing, but being Lisp challenged I cannot find where in
> org-freemind.el this replacement should be done.
>
> 3) Importing freemind to org (centered nodes)
> I noticed also that nodes in freemind that were centered broke the org
> import fairly bad by splitting the node name over several lines with
> blank lines in between. And none of the textual lines were actually
> displayed as a headline. I don't really have an issue with this, as I
> can do without changing from the default alignment in freeming, but
> thought I'd include it in this writeup.
>
> If anyone has an idea of how to solve this or could point me in the
> right direction that would be great!
>

Of course, right after posting I found the setting in freemind to limit
node length [1]. The solution for now is to avoid using newlines altogether in 
the
node names. This means all node levels will have the same length, but
this is ok for me. 

Sorry for the noise!

Footnotes: 
[1] Under 'Tools -> Preferences' under the tab 'Defaults' there's a 'Max
Node Width' that can be set.

-- 
Johnny



Re: [O] anyway to create link to a line number in a file

2012-02-18 Thread Sean O'Halpin
On Fri, Feb 17, 2012 at 4:54 PM, Not To Miss  wrote:
> Hi all,
>
> I am reading a long text file and want to write down my notes with
> org-mode. I extremely would like to put the line numbers down along
> with my notes. Although there is a way to store a link for text search
> for the current line, I haven't found a way to create a link to a line
> number in the current buffer. Is there anyway to do that? Thanks

Take a look at org-capture: http://orgmode.org/manual/Capture.html



[O] worg wrong link?

2012-02-18 Thread Rustom Mody
In http://orgmode.org/worg/org-tutorials/non-beamer-presentations.html#sec-3
the 'here' (emacs code available here under Code and usage for
org-export-as-s5) points to
http://gitweb.adaptive.cs.unm.edu/org-S5.git/blob_plain/HEAD:/org-export-as-s5.el
(where theres nothing about emacs/org mode)

Should probably point here https://github.com/eschulte/org-S5??


Re: [O] using variables in org text

2012-02-18 Thread Rainer M Krug
On 16 February 2012 17:05, Thomas S. Dye  wrote:
> Rainer M Krug  writes:
>
>> Hi
>>
>> I have defined a variable as follow
>>
>> #+property: var  DC="/home/rkrug/tmp/CLUSTER"
>>
>> and I am using this path quite often in source blocks (works nicely as
>> expected) but also in org directly, e.g.
>>
>> * DC path is $DC$
>>   The DC path $DC$ is pointing to a directory.
>>
>> Is it possible to use the variable DC in the text as well, so that
>> $DC$ is replaced with the value of the variable DC as defined above?
>> In other words: how can I tell org that on export, $DC$ stands for the
>> value of the variable DC?
>>
>> Cheers,
>>
>> Rainer
>>
>> PS: I know that $...$ is for LaTeX math mode
> Aloha Rainer,
>
> Here is a way that works for me.
>
> * Krug
>
> How to have a variable show up in text.
>
> #+name: printDC
> #+BEGIN_SRC emacs-lisp :results silent raw :exports none
> (print DC)
> #+END_SRC
>
> In the text call_printDC() is shown.


Great idea - I will try it as soon as I am back at work.

Cheers,

Rainer

>
> hth,
> Tom
>
> --
> Thomas S. Dye
> http://www.tsdye.com



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      rai...@krugs.de

Skype:      RMkrug



Re: [O] Bug: Remote state change of repeating TODO fails with calendar open [7.8.03]

2012-02-18 Thread David Maus
Hi Thomas,

At Fri, 17 Feb 2012 14:28:39 +0100,
Thomas Morgan wrote:
>
> Changing a repeating TODO's state to DONE remotely from the
> agenda fails to change the date when the calendar is open in
> another window.
>
> The reason is that `org-recenter-calendar' selects the agenda
> window after doing its work, also making the agenda the current
> buffer, but caller `org-auto-repeat-maybe' expects the current
> buffer to be the Org file that contains the TODO item.
>
> Here's how to reproduce it:
>
> Run `emacs -Q -l setup.el'.
> Type `M-x calendar'.
> Type `M-x org-agenda', then `a' for weekly agenda.
> Move point to first TODO.
> Press `t' to try to change TODO state to DONE.
>
> The result is that `Note stored' appears in the echo area but
> there is no change in the agenda view or in the scheduled date
> in `test-case.org'.

Thanks for the report and the detailed analysis. I pushed a fix for
this problem, could you pull and check if the problem is fixed for
you?

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de

pgpCnXKGZRebK.pgp
Description: PGP signature


Re: [O] Limit todo window

2012-02-18 Thread Richard Riley
Nick Dokos  writes:

> Richard Riley  wrote:
>
>> 
>> Whats the best way to limit the window that agendas use to show open
>> todo items? e.g when I do C-c a a I dont want to see TODOs set for a
>> years time - generally I might only want things in the current week or
>> so. is there something built and instantly configurable to achieve this?
>> 
>> 
>
> org-agenda-span - also make sure to get rid of any settings of
> the obsolete variable org-agenda-ndays. The default is week however,
> so unless you've customized something, you should not see a year's
> worth of TODOS (I shudder at the thought...)
>
> Nick
>

Hi Nick,

I was being dense. I wasnt seeing the TODOs per se, but the creation of
them! (I tag all items with a created date so they appear in a journal
and I easily track creation of all org items). So yes, the span is the
correct variable that I had previously thought not working...

cheers

r.




[O] Bug: [patch] Fixes behavior of org-agenda-tree-to-indirect-buffer [7.8.02 (release_7.7.796.gc512)]

2012-02-18 Thread Dave Abrahams


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.


This function was misbehaving in a number of ways.  The enclosed patch
represents the changes necessary to make it work properly, accumulated
over several weeks of testing.  Sorry if the description is a bit vague.

>From c5128d1666e5fbe29a2fdfd6ee51622f05c42e9b Mon Sep 17 00:00:00 2001
From: Dave Abrahams 
Date: Fri, 17 Feb 2012 22:44:13 -1000
Subject: [PATCH] Fix behavior of org-agenda-tree-to-indirect-buffer

---
 lisp/org-agenda.el |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 780794e..0c32b48 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7202,16 +7202,19 @@ use the dedicated frame)."
   (if (and current-prefix-arg (listp current-prefix-arg))
   (org-agenda-do-tree-to-indirect-buffer)
 (let ((agenda-window (selected-window))
-  (indirect-window (get-buffer-window org-last-indirect-buffer)))
+	  (indirect-window 
+	   (and org-last-indirect-buffer
+		(get-buffer-window org-last-indirect-buffer
   (save-window-excursion (org-agenda-do-tree-to-indirect-buffer))
   (unwind-protect
-  (progn
-(unless indirect-window
+	  (progn
+(unless (and indirect-window (window-live-p indirect-window))
   (setq indirect-window (split-window agenda-window)))
 (select-window indirect-window)
 (switch-to-buffer org-last-indirect-buffer :norecord)
+	(org-set-visibility-according-to-property)
 (fit-window-to-buffer indirect-window))
-(select-window agenda-window)
+	(select-window agenda-window)
 
 (defun org-agenda-do-tree-to-indirect-buffer ()
   "Same as `org-agenda-tree-to-indirect-buffer' without saving window."
-- 
1.7.5.4



Emacs  : GNU Emacs 24.0.92.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2011-12-22 on bob.porkrind.org
Package: Org-mode version 7.8.02 (release_7.7.796.gc512)
-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com