[O] Formal description of Org files

2011-04-15 Thread Carsten Dominik
Hi,

I have a question.

At FOSDEM, someone asked me if there was a formal description of the structure 
of Org files, in some language that would be the input for a parser (or parser 
generator?) so that Org file could be easily parsed.

Unfortunately I did not catch the name of the format description language that 
could be
used for something, not did I catch the name of the person who talked to me.

Can anyone help out here?  Let me know what language to use, and maybe help 
work on such a formal description?  I think it would be useful to have

- Carsten


Re: [O] Recurring events with ranges broken

2011-04-15 Thread Philipp M.
On 15 April 2011 05:04, Matt Lundin m...@imapmail.org wrote:

 Philipp M. bootsare...@googlemail.com writes:

  It would be the proper way to set up timetables for a semester.
  The workaround I use is mentioned in the FAQ http://orgmode.org/worg/
  org-faq.html#org-diary-class
  Unfortunately the FAQ doesn't state that putting the time in the
  heading is the only way to get the time into the agenda and that all
  other attempts you might expect to do what you want break silently.

 The following works fine for me here:

 * My classes
 %%(org-diary-class 2 20 2011 5 30 2011 4) 9:00am-10:00am Emacs 101


This works fine for the agenda but still fails to be exported properly as an
iCalendar, which is my main problem.

Regards,
Philipp


Re: [O] Recurring events with ranges broken

2011-04-15 Thread Carsten Dominik

On Apr 15, 2011, at 12:07 PM, Philipp M. wrote:

 On 15 April 2011 05:04, Matt Lundin m...@imapmail.org wrote:
 Philipp M. bootsare...@googlemail.com writes:
 
  It would be the proper way to set up timetables for a semester.
  The workaround I use is mentioned in the FAQ http://orgmode.org/worg/
  org-faq.html#org-diary-class
  Unfortunately the FAQ doesn't state that putting the time in the
  heading is the only way to get the time into the agenda and that all
  other attempts you might expect to do what you want break silently.
 
 The following works fine for me here:
 
 * My classes
 %%(org-diary-class 2 20 2011 5 30 2011 4) 9:00am-10:00am Emacs 101
 
 
 This works fine for the agenda but still fails to be exported properly as an 
 iCalendar, which is my main problem.

One way to address this would be to modify icalendar.el to make
it understand org-diary-class.  Start with a function like
calendar--convert-cyclic-to-ical and modify it to
read and convert org-diary-class entries as well.

icalendar.el should really have hooks to allow other functions
to be plugged into it, but it does not.  So you can just amend
one of its functions and define that after you loaded
icalendar.el, or use advice.

Another way would of cause be to put functionality into
org-icalendar to search for and convert such entries.


HTH

- Carsten


Re: [O] Formal description of Org files

2011-04-15 Thread Peter Frings

On 15 Apr 2011, at 12:57, Carsten Dominik wrote:

 On Apr 15, 2011, at 10:54 AM, Rainer Stengele wrote:
 
 Am 15.04.2011 09:58, schrieb Carsten Dominik:
 Hi,
 
 I have a question.
 
 At FOSDEM, someone asked me if there was a formal description of the 
 structure of Org files, in some language that would be the input for a 
 parser (or parser generator?) so that Org file could be easily parsed.

snip

 Hi,
 
 maybe Backus-Naur was meant?
 
 That is very well possible.  Sounds like a word I would not have 
 recognized
 So would on Org-mode grammar start like this?

 headline ::= *+ opt-todo-keyword
opt-priority-cookie
title
opt-tags
 
 opt-todo-keyword ::= whitespace todo-keyword | “”
snip

Yes, that seems like extended BN. [1]
Good luck with it! You’ll need it... :-)

[1] http://en.wikipedia.org/wiki/Extended_Backus–Naur_Form


Cheers,
Peter.
-- 
c++; // this makes c bigger but returns the old value




Re: [O] Formal description of Org files

2011-04-15 Thread Carsten Dominik

On Apr 15, 2011, at 1:50 PM, Peter Frings wrote:

 
 On 15 Apr 2011, at 12:57, Carsten Dominik wrote:
 
 On Apr 15, 2011, at 10:54 AM, Rainer Stengele wrote:
 
 Am 15.04.2011 09:58, schrieb Carsten Dominik:
 Hi,
 
 I have a question.
 
 At FOSDEM, someone asked me if there was a formal description of the 
 structure of Org files, in some language that would be the input for a 
 parser (or parser generator?) so that Org file could be easily parsed.
 
 snip
 
 Hi,
 
 maybe Backus-Naur was meant?
 
 That is very well possible.  Sounds like a word I would not have 
 recognized
 So would on Org-mode grammar start like this?
 
 headline ::= *+ opt-todo-keyword
   opt-priority-cookie
   title
   opt-tags
 
 opt-todo-keyword ::= whitespace todo-keyword | “”
 snip
 
 Yes, that seems like extended BN. [1]
 Good luck with it! You’ll need it... :-)

Well, if tis is complicated, I am not going to do this.
But maybe there is a volunteer out there - I'd be happy to
support him or her.

- Carsten




[O] [Accepted] * org-html.el (org-html-make-link): correct a bug in coderef link.

2011-04-15 Thread Carsten Dominik
Patch 746 (http://patchwork.newartisans.com/patch/746/) is now Accepted.

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C1302614330-23496-1-git-send-email-manuel.giraud%40univ-nantes.fr%3E

Here is the original message containing the patch:

 Content-Type: text/plain; charset=utf-8
 MIME-Version: 1.0
 Content-Transfer-Encoding: 7bit
 Subject: [O] * org-html.el (org-html-make-link): correct a bug in coderef 
 link.
 Date: Tue, 12 Apr 2011 18:18:50 -
 From: Manuel Giraud manuel.gir...@univ-nantes.fr
 X-Patchwork-Id: 746
 Message-Id: 1302614330-23496-1-git-send-email-manuel.gir...@univ-nantes.fr
 To: emacs-orgmode@gnu.org
 Cc: Manuel Giraud manuel.gir...@univ-nantes.fr
 
 ---
  lisp/org-html.el |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)
 
 
 diff --git a/lisp/org-html.el b/lisp/org-html.el
 index 58fbc05..5d53478 100644
 --- a/lisp/org-html.el
 +++ b/lisp/org-html.el
 @@ -826,7 +826,8 @@ MAY-INLINE-P allows inlining it as an image.
   (not type)
   (string= type http)
   (string= type https)
 - (string= type file))
 + (string= type file)
 + (string= type coderef))
  (if fragment
 (setq thefile (concat thefile # fragment
  
 @@ -836,7 +837,8 @@ MAY-INLINE-P allows inlining it as an image.
(setq thefile
   (let
  ((str (org-export-html-format-href thefile)))
 -   (if (and type (not (string= file type)))
 +   (if (and type (not (or (string= file type)
 +  (string= coderef type
 (concat type : str)
 str)))
  
 



[O] [Accepted] Fix agenda display when headlines are missing

2011-04-15 Thread Carsten Dominik
Patch 748 (http://patchwork.newartisans.com/patch/748/) is now Accepted.

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C1302696730-14326-1-git-send-email-bernt%40norang.ca%3E

Here is the original message containing the patch:

 Content-Type: text/plain; charset=utf-8
 MIME-Version: 1.0
 Content-Transfer-Encoding: 7bit
 Subject: [O] Fix agenda display when headlines are missing
 Date: Wed, 13 Apr 2011 17:12:10 -
 From: Bernt Hansen be...@norang.ca
 X-Patchwork-Id: 748
 Message-Id: 1302696730-14326-1-git-send-email-be...@norang.ca
 To: emacs-orgmode@gnu.org
 Cc: Richard Riley rile...@googlemail.com, Bernt Hansen be...@norang.ca
 
 * lisp/org-agenda.el (org-agenda-get-timestamps): Fix agenda display when 
 headlines are missing
 
 The following entry breaks the agenda display.
 
 ,
 | 
 | :PROPERTIES:
 | :DateCreated: 2011-04-13 Mi 10:00
 | :END:
 |
 | 
 [[gnus:nntp%2BGwene:gwene.org.emacsen.planet][gnus:nntp+Gwene:gwene.org.emacsen.planet]]
 `
 
 Provide the empty string as the headline if the search for the
 headline returns nil.  org-format-agenda-items requires a string for
 the headline parameter.
 
 ---
 Hi Richard,
 
 This should if your issue.  Please test it and report back.
 This patch is available at git://git.norang.ca/org-mode.git 
 fix-agenda-empty-headines
 
 Regards,
 Bernt
 
 
  lisp/org-agenda.el |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
 index 5571838..768c417 100644
 --- a/lisp/org-agenda.el
 +++ b/lisp/org-agenda.el
 @@ -4710,7 +4710,7 @@ This function is invoked if 
 `org-agenda-todo-ignore-deadlines',
   (setq hdmarker (org-agenda-new-marker)
 tags (org-get-tags-at))
   (looking-at \\*+[ \t]+\\([^\r\n]+\\))
 - (setq head (match-string 1))
 + (setq head (or (match-string 1) ))
   (setq txt (org-format-agenda-item
  (if inactivep org-agenda-inactive-leader nil)
  head category tags timestr
 



[O] [Accepted] org mobile - pre hooks

2011-04-15 Thread Carsten Dominik
Patch 654 (http://patchwork.newartisans.com/patch/654/) is now Accepted.

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C87tyfhf6gr.fsf%40gnu.org%3E

Here is the original message containing the patch:

 Content-Type: text/plain; charset=utf-8
 MIME-Version: 1.0
 Content-Transfer-Encoding: 7bit
 Subject: [O] org mobile - pre hooks
 Date: Sun, 06 Mar 2011 04:17:08 -
 From: Bastien Guerry b...@altern.org
 X-Patchwork-Id: 654
 Message-Id: 87tyfhf6gr@gnu.org
 To: Richard Riley rile...@googlemail.com
 Cc: Emacs-orgmode mailing list emacs-orgmode@gnu.org
 
 Hi Richard,
 
 Richard Riley rile...@googlemail.com writes:
 
  Could I suggest that org-mobile-pre-push-hook is processed at the start
  of the org-mobile-push function before the checks? That way it can be
  used to properly setup mobile e.g using auth-source for the mobile
  password.
 
 This trivial patch will perhaps do.  I'm not using org-mobile.el so
 please let me know if there are any side-effects.
 
 Thanks,
 
 
 diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
 index 5471734..ffdd92c 100644
 --- a/lisp/org-mobile.el
 +++ b/lisp/org-mobile.el
 @@ -305,9 +305,9 @@ create all custom agenda views, for upload to the mobile 
 phone.
 (org-agenda-redo-command org-agenda-redo-command))
(save-excursion
   (save-window-excursion
 +   (run-hooks 'org-mobile-pre-push-hook)
 (org-mobile-check-setup)
 (org-mobile-prepare-file-lists)
 -   (run-hooks 'org-mobile-pre-push-hook)
 (message Creating agendas...)
 (let ((inhibit-redisplay t)) (org-mobile-create-sumo-agenda))
 (message Creating agendas...done)
 



[O] [Accepted] Fix typo in agenda local variable

2011-04-15 Thread Carsten Dominik
Patch 749 (http://patchwork.newartisans.com/patch/749/) is now Accepted.

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C1302732325-21162-1-git-send-email-bernt%40norang.ca%3E

Here is the original message containing the patch:

 Content-Type: text/plain; charset=utf-8
 MIME-Version: 1.0
 Content-Transfer-Encoding: 7bit
 Subject: [O] Fix typo in agenda local variable
 Date: Thu, 14 Apr 2011 03:05:25 -
 From: Bernt Hansen be...@norang.ca
 X-Patchwork-Id: 749
 Message-Id: 1302732325-21162-1-git-send-email-be...@norang.ca
 To: emacs-orgmode@gnu.org
 Cc: Bernt Hansen be...@norang.ca
 
 * lisp/org-agenda.el (org-agenda-filter-by-tag): Fix variable name typo
 
 maybe-reftresh - maybe-refresh
 
 ---
 This patch is available at git://git.norang.ca/org-mode.git 
 fix-agenda-var-typo
 
 -Bernt
 
  lisp/org-agenda.el |   10 +-
  1 files changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
 index 5571838..321221d 100644
 --- a/lisp/org-agenda.el
 +++ b/lisp/org-agenda.el
 @@ -5905,7 +5905,7 @@ to switch to narrowing.
(effort-prompt )
(inhibit-read-only t)
(current org-agenda-filter)
 -  maybe-reftresh a n tag)
 +  maybe-refresh a n tag)
  (unless char
(message
 %s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [=?]:effort: 
 @@ -5952,12 +5952,12 @@ to switch to narrowing.
   (push modifier org-agenda-filter
   (if (not (null org-agenda-filter))
   (org-agenda-filter-apply org-agenda-filter)))
 -  (setq maybe-reftresh t))
 +  (setq maybe-refresh t))
   ((equal char ?/)
(org-agenda-filter-by-tag-show-all)
(when (get 'org-agenda-filter :preset-filter)
   (org-agenda-filter-apply org-agenda-filter))
 -  (setq maybe-reftresh t))
 +  (setq maybe-refresh t))
   ((or (equal char ?\ )
 (setq a (rassoc char alist))
 (and (= char ?0) (= char ?9)
 @@ -5974,9 +5974,9 @@ to switch to narrowing.
   (cons (concat (if strip - +) tag)
 (if narrow current nil)))
(org-agenda-filter-apply org-agenda-filter)
 -  (setq maybe-reftresh t))
 +  (setq maybe-refresh t))
   (t (error Invalid tag selection character %c char)))
 -(when (and maybe-reftresh
 +(when (and maybe-refresh
  (eq org-agenda-clockreport-mode 'with-filter))
(org-agenda-redo
  
 



Re: [O] Formal description of Org files

2011-04-15 Thread Christian Egli
Carsten Dominik carsten.domi...@gmail.com writes:

 At FOSDEM, someone asked me if there was a formal description of the
 structure of Org files, in some language that would be the input for a
 parser (or parser generator?) so that Org file could be easily parsed.

Maybe the person was talking about antlr[1], ANother Tool for Language
Recognition, a language tool that provides a framework for constructing
recognizers, interpreters, compilers, and translators from grammatical
descriptions containing actions in a variety of target languages.

It even seems to have preliminary support for generating an elisp
parser[2][3]

There is also an emacs mode for editing antlr files[4].

Sounds like an interesting project.

Thanks
Christian

Footnotes: 
[1]  http://www.antlr.org/
[2]  http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets
[3]  https://github.com/olabini/antlr-elisp
[4]  http://antlr-mode.sourceforge.net/
-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland




Re: [O] Formal description of Org files

2011-04-15 Thread Peter Frings

On 15 Apr 2011, at 14:58, Christian Egli wrote:

 Carsten Dominik carsten.domi...@gmail.com writes:
 
 At FOSDEM, someone asked me if there was a formal description of the
 structure of Org files, in some language that would be the input for a
 parser (or parser generator?) so that Org file could be easily parsed.
 
 Maybe the person was talking about antlr[1], ANother Tool for Language
 Recognition, a language tool that provides a framework for constructing
 recognizers, interpreters, compilers, and translators from grammatical
 descriptions containing actions in a variety of target languages”.
snip

 Sounds like an interesting project.

Wow, if that thing can export syntax diagrams in PNG or PDF I’d be really 
happy. Looks very interesting — albeit serious overkill for what I’d use it :-).

thanks,
Peter.
-- 
c++; // this makes c bigger but returns the old value




Re: [O] Formal description of Org files

2011-04-15 Thread Filippo A. Salustri
Antlr is just another in a long line of lexical parsers.  I still remember
the original lex (for lexical analysis), which in combination with yacc (for
parsing and grammar) could make pretty much any conventional programming
language.
Then GNU came up with Flex (fast lex) and Bison (instead of yacc...get it?
:)
Then IDEs really started to take off and much of the ugly parts of writing
languages disappeared, which led to all kinds of new tools like antlr.

But they all basically do the same thing: let one describe the syntax and
grammar of (quasi) formal (programming) languages.

I don't know if any of them produce diagrams, but I wouldn't be surprised if
at least some did.

Cheers.
Fil

On 15 April 2011 09:42, Peter Frings peter.fri...@agfa.com wrote:


 On 15 Apr 2011, at 14:58, Christian Egli wrote:

  Carsten Dominik carsten.domi...@gmail.com writes:
 
  At FOSDEM, someone asked me if there was a formal description of the
  structure of Org files, in some language that would be the input for a
  parser (or parser generator?) so that Org file could be easily parsed.
 
  Maybe the person was talking about antlr[1], ANother Tool for Language
  Recognition, a language tool that provides a framework for constructing
  recognizers, interpreters, compilers, and translators from grammatical
  descriptions containing actions in a variety of target languages”.
 snip

  Sounds like an interesting project.

 Wow, if that thing can export syntax diagrams in PNG or PDF I’d be really
 happy. Looks very interesting — albeit serious overkill for what I’d use it
 :-).

 thanks,
 Peter.
 --
 c++; // this makes c bigger but returns the old value





-- 
Filippo A. Salustri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson University
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5000 ext 7749
Fax: 416/979-5265
Email: salus...@ryerson.ca
http://deseng.ryerson.ca/~fil/


[O] [babel] ob-C.el annoyances

2011-04-15 Thread Julien Fantin
Hi list, hi Eric,

I've been using ob-C to go through the KR book, and I've noticed a few
annoyances along the way.

* Use of the captial C identifier 

Support functions are defined as ob-C-*. In consequence, I need to
#+begin_src C to get a block to execute, because #+begin_src c fails
with No org-babel-execute function for c!. The problem is that I can't
edit the block since there is no C-mode. Defining an alias fixed the
issue, but it doesn't work OOTB, and doesn't feel like a good solution
at all.

Is there a reasoning behind this, or where you, as I suspect, trying to
define some support functions that would work for both C and C++ ?


* Feeding text into blocks

This is not directly related to ob-C.el, but I was looking for a way to
feed some text to a block's STDIN while it was executed by babel.  I
wanted to specifiy this text either inline from the block's header
arguments or from a dedicated text block.

It'd ideally look like this :

** Inline

#+begin_src c :feed foo bar
int main(void) {
while ((c = getchar()) != EOF) {
putchar(c);
}
return 0;
}
#+end_src

#+results:
: foo bar

** From a text block

#+source: my-stdin
#+begin_src text
foo bar
#+end_src

#+begin_src c :feed my-stdin
int main(void) {
while ((c = getchar()) != EOF) {
putchar(c);
}
return 0;
}
#+end_src

#+results:
: foo bar

TL;DR if this is already possible somehow please skip the following and let
me know :)

I couldn't figure out how to pipe the text from within babel though. So
I resorted to tangling the text blocks, and redefined
org-babel-C-execute to use that new header argument :feed. It gets
prepended to the cmdline in the org-babel-eval function call ; if foo is
an existing file it gets cat'ed through a pipe to the rest of the
cmdline in org-babel-eval, otherwise it is simply echo'ed. This is not
as good as what I described above, but after getting to use it, I really
think a generalization of this use-case is desirable.

Please let me know whar you think.

Regards,
Julien.




[O] My new favorite custom agenda command

2011-04-15 Thread Matthew Sauer
I have been working on learning and playing with some lisp and looking
through the amazing powerfulness of orgmode.  This is my new favorite
agenda command.  I use it as the right hand side of my startup buffers
(I have two).  On the left I have my refile.org file (the I am not
sure where I am putting this item but I need a container for it) that
is a temporary storage buffer I need to try to keep empty except for
my refile headlines and a dynamic block showing recently updated
files.  On the right is the following calendar, gives me a good
overview.  Of course for some users the deadline warning days might
need to be smaller for unscheduled deadlines.

Thanks for all the help and good ideas I have seen flowing through the
list that has helped me get to where I can start hacking orgmode to be
what I want/need it to be.

Matt

--cut here--cut here-start

'(org-agenda-custom-commands
   (quote (
   (s Startup View (
(agenda  ;;short calendar
'(org-agenda-ndays 2) ;;
Number of Days of Agenda Calendar to Display
'(org-deadline-warning-days
7)) ;; Show all deadlines for next week
(agenda   ;; how many days until an
item is due if I haven't scheduled to work on it
((org-agenda-time-grid nil)
 (org-deadline-warning-days
365);; Shows all deadlines for next nnn days
 (org-agenda-entry-types
'(:deadline))  ;; Look just for items if they have a deadline
 (org-agenda-skip-entry-if
'scheduled)  ;; Skips items that are scheduled
 (org-agenda-ndays 1) ;; Show just today
 (org-agenda-overriding-header
Unscheduled upcoming deadlines:) ;;Meaningful name
 ))
(todo 
'(org-agenda-overriding-header Unscheduled No Deadline TODO:
));;TODO items not scheduled nor
deadlined
)
--cut herecut hereend-



Re: [O] Formal description of Org files

2011-04-15 Thread Wes Hardaker
 On Fri, 15 Apr 2011 09:58:09 +0200, Carsten Dominik 
 carsten.domi...@gmail.com said:

CD Unfortunately I did not catch the name of the format description
CD language that could be used for something, not did I catch the name
CD of the person who talked to me.

Another option, besides those mentioned, is probably ABNF.

-- 
Wes Hardaker 
My Pictures:  http://capturedonearth.com/
My Thoughts:  http://pontifications.hardakers.net/



Re: [O] My new favorite custom agenda command

2011-04-15 Thread Matthew Sauer
However, now looking at it, maybe my top agenda calendar should skip
deadlines or just have todays since I have a larger list below.  Hmm,
going to have to think about this some more but I am really liking
this start.

Matt

On Fri, Apr 15, 2011 at 8:59 AM, Matthew Sauer
improv.philoso...@gmail.com wrote:
 I have been working on learning and playing with some lisp and looking
 through the amazing powerfulness of orgmode.  This is my new favorite
 agenda command.  I use it as the right hand side of my startup buffers
 (I have two).  On the left I have my refile.org file (the I am not
 sure where I am putting this item but I need a container for it) that
 is a temporary storage buffer I need to try to keep empty except for
 my refile headlines and a dynamic block showing recently updated
 files.  On the right is the following calendar, gives me a good
 overview.  Of course for some users the deadline warning days might
 need to be smaller for unscheduled deadlines.

 Thanks for all the help and good ideas I have seen flowing through the
 list that has helped me get to where I can start hacking orgmode to be
 what I want/need it to be.

 Matt

 --cut here--cut here-start

 '(org-agenda-custom-commands
   (quote (
           (s Startup View (
                                (agenda  ;;short calendar
                                        '(org-agenda-ndays 2) ;;
 Number of Days of Agenda Calendar to Display
                                        '(org-deadline-warning-days
 7)) ;; Show all deadlines for next week
                                (agenda   ;; how many days until an
 item is due if I haven't scheduled to work on it
                                        ((org-agenda-time-grid nil)
                                         (org-deadline-warning-days
 365)        ;; Shows all deadlines for next nnn days
                                         (org-agenda-entry-types
 '(:deadline))  ;; Look just for items if they have a deadline
                                         (org-agenda-skip-entry-if
 'scheduled)  ;; Skips items that are scheduled
                                         (org-agenda-ndays 1) ;; Show just 
 today
                                         (org-agenda-overriding-header
 Unscheduled upcoming deadlines:) ;;Meaningful name
                                         ))
                                (todo 
 '(org-agenda-overriding-header Unscheduled No Deadline TODO:
 ));;TODO items not scheduled nor
 deadlined
                                )
 --cut herecut hereend-




Re: [O] Complex numbers

2011-04-15 Thread Renier Marchand
It is a cool idea yes, but I quickly learned that it also have its
problems, i.e. you cant really create nice column formulas because the
reference is not aware of the current row etc.

The biggest problem as I see it is that emacs-lisp does not support
the complex data type as lisp (natively) do. I am going to look into a
way of representing it.. maybe a two element lisp list (re im). I am
not really versed in lisp so it is a bit of a problem to modify code,
but I am looking into it.

One problem that I have encountered is that when a two element list is
referenced in the following scenario

| (1 2) | #ERROR |
#+TBLFM: $2='(sbe myfunc (data $1))

an error is caused because lisp is trying to execute this list
appearing struct, but when I do

| (1 2) |
| (2 3) |
| resul |
#+TBLFM: $1@3='(sbe myfunc (data @1$1..@2$1))

no error is reported because it is assumed to be a list of data for my
python code. i.e. it is sent as [[1,2],[2,3]] which is what I want. Is
there a way to get more consistent behavior?

Thank you.
Renier

On Wed, Apr 13, 2011 at 6:35 PM, Eric Schulte schulte.e...@gmail.com wrote:
 Renier Marchand reni...@gmail.com writes:

 I have found the following way to reference my data correctly without
 having to quote it or have data rewritten.

 I do:

       #+tblname: my-data
       | hmin |
       |--|
       |      |
       | 0.05 |
       |  0.2 |
       |  0.2 |
       #+TBLFM: @5$1='(sbe myfunc (data my-data[3:4,0]))

 This also works for complex data as you suggested.


 Very cool, I would never have thought to use a reference within a table
 formula.


 But is there a way to refer in the formula to the current table
 instead of a specific table? Because this would obviously not work for
 multiple tables with the same name. (i.e. copy and paste for another
 dataset)


 No, there is no support for that sort of usage, and adding such a
 position dependent reference would be a fairly large change from the
 existing reference resolution mechanisms.

 Best -- Eric


 Regards,

 Renier

 On Wed, Apr 13, 2011 at 5:52 AM, Eric Schulte schulte.e...@gmail.com wrote:
 Hi Renier,

 The Org-mode table machinery is interpreting the values of your table
 cells as emacs lisp (given that the table formula is an elisp, rather
 than a calc formula).  Due to the , the result is a weird nested list
 which confuses your python code block.  Some options here include...

 1. wrapping these cells in quotes so that they are passed to the python
   block as strings...

   #+source: parameter-variation(data=0)
   #+begin_src python :result values
     return 'text'
   #+end_src

   |---|
   | (0.0331901438056,0.000535222885197) |
   | (0.0333434157791,0.000537930174356) |
   | (0.0345727512157,0.000559346040457) |
   | (0.0353146483908,0.000571501584524) |
   | (0.0355522909393,0.000574387067408) |
   | (0.0356575682336,0.000574851263615) |
   | (0.0357806926897,0.000575051685084) |
   |---|
   | text                                  |
   #+TBLFM: @8$1='(sbe parameter-variation (nums @1$1..@7$1))

 2. referencing the table from an external code block, rather than inside
   of a table formula.  This is probably the easier solution, but it
   doesn't insert the result into your table, unless you do something
   tricky like give the code block and the table the same name so that
   the results of the code block replace the table...

   #+results: complex-data
   |-|
   | (0.0331901438056,0.000535222885197) |
   | (0.0333434157791,0.000537930174356) |
   | (0.0345727512157,0.000559346040457) |
   | (0.0353146483908,0.000571501584524) |
   | (0.0355522909393,0.000574387067408) |
   | (0.0356575682336,0.000574851263615) |
   | (0.0357806926897,0.000575051685084) |
   #+TBLFM: @8$1='(sbe parameter-variation (nums @1$1..@7$1))

   #+begin_src python :var data=complex-data
     return data
   #+end_src

 Hope this helps -- Eric

 Renier Marchand reni...@gmail.com writes:

 Hi.

 I have been playing around with complex data that has been returned
 from Python. This is obviously not in calc.el format but if I change
 them to the correct format I can manipulate them using calc.

 but

 When I want to pass the complex numbers (python format) to python I
 get an error. If I pass real number everything works as expected

 For example:

       #+source: parameter-variation(data=0)
       #+begin_src python :result values
         return 'text'
       #+end_src


   |   |  hmin |                         |
   |---+---+-|
   |   |   |     |
   |   |  0.05 | (0.0331901438056,0.000535222885197) |
   |   |   0.1 | (0.0333434157791,0.000537930174356) |
   |   |   0.3 | (0.0345727512157,0.000559346040457) |
   |   |   0.6 | (0.0353146483908,0.000571501584524) |
   |   |   0.9 | (0.0355522909393,0.000574387067408) 

Re: [O] Formal description of Org files

2011-04-15 Thread Jambunathan K
Carsten Dominik carsten.domi...@gmail.com writes:

 On Apr 15, 2011, at 1:50 PM, Peter Frings wrote:

 
 On 15 Apr 2011, at 12:57, Carsten Dominik wrote:
 
 On Apr 15, 2011, at 10:54 AM, Rainer Stengele wrote:
 
 Am 15.04.2011 09:58, schrieb Carsten Dominik:
 Hi,
 
 I have a question.
 
 At FOSDEM, someone asked me if there was a formal description of
 the structure of Org files, in some language that would be the
 input for a parser (or parser generator?) so that Org file could
 be easily parsed.
 
 snip
 
 Hi,
 
 maybe Backus-Naur was meant?
 
 That is very well possible.  Sounds like a word I would not have 
 recognized
 So would on Org-mode grammar start like this?
 
 headline ::= *+ opt-todo-keyword
   opt-priority-cookie
   title
   opt-tags
 
 opt-todo-keyword ::= whitespace todo-keyword | “”
 snip
 
 Yes, that seems like extended BN. [1]
 Good luck with it! You’ll need it... :-)

 Well, if tis is complicated, I am not going to do this.
 But maybe there is a volunteer out there - I'd be happy to
 support him or her.

IF there is a need for a lexer and parser may be one should start with
the parser that is part of cedet.

http://www.emacswiki.org/emacs/HowToSetUpSemanticBovinatorForANewLanguage

Jambunathan K.

 - Carsten

-- 



Re: [O] Complex numbers

2011-04-15 Thread Eric Schulte
Renier Marchand reni...@gmail.com writes:

 It is a cool idea yes, but I quickly learned that it also have its
 problems, i.e. you cant really create nice column formulas because the
 reference is not aware of the current row etc.

 The biggest problem as I see it is that emacs-lisp does not support
 the complex data type as lisp (natively) do. I am going to look into a
 way of representing it.. maybe a two element lisp list (re im). I am
 not really versed in lisp so it is a bit of a problem to modify code,
 but I am looking into it.

 One problem that I have encountered is that when a two element list is
 referenced in the following scenario

 | (1 2) | #ERROR |
 #+TBLFM: $2='(sbe myfunc (data $1))

 an error is caused because lisp is trying to execute this list
 appearing struct, but when I do

 | (1 2) |
 | (2 3) |
 | resul |
 #+TBLFM: $1@3='(sbe myfunc (data @1$1..@2$1))

 no error is reported because it is assumed to be a list of data for my
 python code. i.e. it is sent as [[1,2],[2,3]] which is what I want. Is
 there a way to get more consistent behavior?


If you represent the complex number as a vector instead of a list, then
elisp will not assume that the first element is a function and try to
evaluate the data, e.g.

| [1 2]|
|--|
| real:1 complex:2 |
#+TBLFM: @2$1='(sbe real (it @1$1))

#+source: real(it='())
#+begin_src emacs-lisp
  (format real:%d complex:%d (aref it 0) (aref it 1))
#+end_src

also, a quoted list '(1 2) would work...

Best -- Eric


 Thank you.
 Renier

 On Wed, Apr 13, 2011 at 6:35 PM, Eric Schulte schulte.e...@gmail.com wrote:
 Renier Marchand reni...@gmail.com writes:

 I have found the following way to reference my data correctly without
 having to quote it or have data rewritten.

 I do:

       #+tblname: my-data
       | hmin |
       |--|
       |      |
       | 0.05 |
       |  0.2 |
       |  0.2 |
       #+TBLFM: @5$1='(sbe myfunc (data my-data[3:4,0]))

 This also works for complex data as you suggested.


 Very cool, I would never have thought to use a reference within a table
 formula.


 But is there a way to refer in the formula to the current table
 instead of a specific table? Because this would obviously not work for
 multiple tables with the same name. (i.e. copy and paste for another
 dataset)


 No, there is no support for that sort of usage, and adding such a
 position dependent reference would be a fairly large change from the
 existing reference resolution mechanisms.

 Best -- Eric


 Regards,

 Renier

 On Wed, Apr 13, 2011 at 5:52 AM, Eric Schulte schulte.e...@gmail.com 
 wrote:
 Hi Renier,

 The Org-mode table machinery is interpreting the values of your table
 cells as emacs lisp (given that the table formula is an elisp, rather
 than a calc formula).  Due to the , the result is a weird nested list
 which confuses your python code block.  Some options here include...

 1. wrapping these cells in quotes so that they are passed to the python
   block as strings...

   #+source: parameter-variation(data=0)
   #+begin_src python :result values
     return 'text'
   #+end_src

   |---|
   | (0.0331901438056,0.000535222885197) |
   | (0.0333434157791,0.000537930174356) |
   | (0.0345727512157,0.000559346040457) |
   | (0.0353146483908,0.000571501584524) |
   | (0.0355522909393,0.000574387067408) |
   | (0.0356575682336,0.000574851263615) |
   | (0.0357806926897,0.000575051685084) |
   |---|
   | text                                  |
   #+TBLFM: @8$1='(sbe parameter-variation (nums @1$1..@7$1))

 2. referencing the table from an external code block, rather than inside
   of a table formula.  This is probably the easier solution, but it
   doesn't insert the result into your table, unless you do something
   tricky like give the code block and the table the same name so that
   the results of the code block replace the table...

   #+results: complex-data
   |-|
   | (0.0331901438056,0.000535222885197) |
   | (0.0333434157791,0.000537930174356) |
   | (0.0345727512157,0.000559346040457) |
   | (0.0353146483908,0.000571501584524) |
   | (0.0355522909393,0.000574387067408) |
   | (0.0356575682336,0.000574851263615) |
   | (0.0357806926897,0.000575051685084) |
   #+TBLFM: @8$1='(sbe parameter-variation (nums @1$1..@7$1))

   #+begin_src python :var data=complex-data
     return data
   #+end_src

 Hope this helps -- Eric

 Renier Marchand reni...@gmail.com writes:

 Hi.

 I have been playing around with complex data that has been returned
 from Python. This is obviously not in calc.el format but if I change
 them to the correct format I can manipulate them using calc.

 but

 When I want to pass the complex numbers (python format) to python I
 get an error. If I pass real number everything works as expected

 For example:

       #+source: parameter-variation(data=0)
       #+begin_src python :result values
        

Re: [O] [PATCH] Make tangling work in an indirect buffer

2011-04-15 Thread Eric Schulte
Hi Shaun,

Thanks for sharing this patch, I have just applied it.  And yes, this is
my preferred format for sharing a patch.

Sorry about the delay, I missed this email initially.  Adding a
[babel] tag to the subject line of emails related to Babel code will
help ensure that they are noticed.

Thanks again for the patch! -- Eric

Shaun Johnson sh...@slugfest.demon.co.uk writes:

 The attached patch makes tangling (org-babel-tangle) work
 in indirect buffers. Previously it would fail before running
 org-babel-post-tangle-hook because indirect have a buffer-file-name
 of nil whereas the code was expecting a string in the following
 fragment:

 (message tangled %d code block%s from %s block-counter
(if (= block-counter 1)  s)
  (file-name-nondirectory (buffer-file-name (or
 (buffer-base-buffer) (current-buffer)


 I hope the patch is in the correct format.

 Shaun.
 From d11bae118dcc1e69fd148002a55e4ae29551c319 Mon Sep 17 00:00:00 2001
 From: Shaun Johnson sh...@slugfest.demon.co.uk
 Date: Wed, 9 Mar 2011 15:32:40 +
 Subject: [PATCH] Babel: Stop tangling failing in an indirect buffer

 * ob-tangle.el (org-babel-tangle): Make it work in an indirect buffer.

 The problem was that the message generated after tangling included the
 file name of the current buffer which was nil in an indirect buffer.

 TINYCHANGE
 ---
  lisp/ob-tangle.el |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
 index 4e203be..f7f7047 100644
 --- a/lisp/ob-tangle.el
 +++ b/lisp/ob-tangle.el
 @@ -243,7 +243,7 @@ exported source code blocks by language.
 (org-babel-tangle-collect-blocks lang))
(message tangled %d code block%s from %s block-counter
 (if (= block-counter 1)  s)
 -(file-name-nondirectory (buffer-file-name (current-buffer
 +(file-name-nondirectory (buffer-file-name (or 
 (buffer-base-buffer) (current-buffer)
;; run `org-babel-post-tangle-hook' in all tangled files
(when org-babel-post-tangle-hook
   (mapc

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



Re: [O] [BUG][babel] :result output table doesn't work for python code blocks

2011-04-15 Thread Eric Schulte
Eric S Fraga e.fr...@ucl.ac.uk writes:

 Eric Schulte schulte.e...@gmail.com writes:

 [...]

 That said, I agree that in examples like yours above the returned value
 should be a table given that the :results table is explicitly stated.
 I've just pushed up a patch after which the following is possible.

 Eric,

 It would appear that this change you've made is only for python)?  Is
 there any chance of having the same for octave, please?  But only if it
 is easy to do as =:results output raw= with carefully formatted output
 does the job for me for the moment!


Hi Eric,

I do not have a local copy of octave, so I'm less confident making
changes to that file, but the attached patch attempts to make the same
changes in ob-octave which were made in ob-python.

Could you please test this patch for both external and session based
evaluation and let me know if it works (I'm more hopeful that the
external evaluation will work as expected than the session evaluation).

Once this is working I'll commit it to the core.

Thanks -- Eric

From 7477c3ac10d28342ccf993ea36b41ebfcab015ac Mon Sep 17 00:00:00 2001
From: Eric Schulte schulte.e...@gmail.com
Date: Fri, 15 Apr 2011 10:11:18 -0600
Subject: [PATCH] ob-octave: allow collecting tabular results when :results output

* lisp/ob-octave.el (org-babel-octave-evaluate-external-process): Dump
  output to temp file, and read results from that file as with :results value.
  (org-babel-octave-evaluate-session): Read results from temporary
  file with both :results output and :results value.
---
 lisp/ob-octave.el |   55 
 1 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index 3430dea..064677e 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -164,18 +164,18 @@ value of the last statement in BODY, as elisp.
 
 (defun org-babel-octave-evaluate-external-process (body result-type matlabp)
   Evaluate BODY in an external octave process.
-  (let ((cmd (if matlabp
+  (let ((tmp-file (org-babel-temp-file octave-))
+	(cmd (if matlabp
 		 org-babel-matlab-shell-command
 	   org-babel-octave-shell-command)))
 (case result-type
-  (output (org-babel-eval cmd body))
-  (value (let ((tmp-file (org-babel-temp-file octave-)))
-	   (org-babel-eval
-		cmd
-		(format org-babel-octave-wrapper-method body
-			(org-babel-process-file-name tmp-file 'noquote)
-			(org-babel-process-file-name tmp-file 'noquote)))
-	   (org-babel-octave-import-elisp-from-file tmp-file))
+  (output (with-temp-file tmp-file (insert (org-babel-eval cmd body
+  (value (org-babel-eval
+	  cmd
+	  (format org-babel-octave-wrapper-method body
+		  (org-babel-process-file-name tmp-file 'noquote)
+		  (org-babel-process-file-name tmp-file 'noquote)
+(org-babel-octave-import-elisp-from-file tmp-file)))
 
 (defun org-babel-octave-evaluate-session
   (session body result-type optional matlabp)
@@ -194,7 +194,8 @@ value of the last statement in BODY, as elisp.
 		  (format org-babel-matlab-emacs-link-wrapper-method
 			  body
 			  (org-babel-process-file-name tmp-file 'noquote)
-			  (org-babel-process-file-name tmp-file 'noquote) wait-file) \n)
+			  (org-babel-process-file-name tmp-file 'noquote)
+			  wait-file) \n)
 	   (mapconcat
 		#'org-babel-chomp
 		(list (format org-babel-octave-wrapper-method
@@ -221,21 +222,25 @@ value of the last statement in BODY, as elisp.
 		   org-babel-octave-eoe-output)
 		 t full-body)
 		  (insert full-body) (comint-send-input nil t results)
-(case result-type
-  (value
-   (org-babel-octave-import-elisp-from-file tmp-file))
-  (output
-   (progn
-	 (setq results
-	   (if matlabp
-		   (cdr (reverse (delq  (mapcar
-	   #'org-babel-octave-read-string
-	   (mapcar #'org-babel-trim raw)
-		 (cdr (member org-babel-octave-eoe-output
-			  (reverse (mapcar
-	#'org-babel-octave-read-string
-	(mapcar #'org-babel-trim raw)))
-	 (mapconcat #'identity (reverse results) \n))
+(if (or (member code result-params)
+	(member pp result-params)
+	(member scalar result-params)
+	(and (member output result-params)
+		 (not (member table result-params
+	(progn
+	  (setq results
+		(if matlabp
+		(cdr (reverse (delq  (mapcar
+	#'org-babel-octave-read-string
+	(mapcar #'org-babel-trim raw)
+		  (cdr (member org-babel-octave-eoe-output
+			   (reverse (mapcar
+	 #'org-babel-octave-read-string
+	 (mapcar #'org-babel-trim raw)))
+	  (mapconcat #'identity (reverse results) \n))
+  (when (equal results-type 'output)
+	(with-temp-file tmp-file (insert raw)))
+  (org-babel-octave-import-elisp-from-file tmp-file
 
 (defun org-babel-octave-import-elisp-from-file (file-name)
   Import data from FILE-NAME.
-- 
1.7.1


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


Re: [O] [babel] ob-C.el annoyances

2011-04-15 Thread Eric Schulte
Julien Fantin julienfan...@gmail.com writes:

 Hi list, hi Eric,

 I've been using ob-C to go through the KR book, and I've noticed a few
 annoyances along the way.

 * Use of the captial C identifier 

 Support functions are defined as ob-C-*. In consequence, I need to
 #+begin_src C to get a block to execute, because #+begin_src c fails
 with No org-babel-execute function for c!. The problem is that I can't
 edit the block since there is no C-mode. Defining an alias fixed the
 issue, but it doesn't work OOTB, and doesn't feel like a good solution
 at all.


I've changed the default value of `org-src-lang-modes' so with the
latest version of Org-mode the begin_src C code blocks will use the
appropriate mode without the need to define an alias.  Thanks for
pointing out this inconsistency.


 Is there a reasoning behind this, or where you, as I suspect, trying to
 define some support functions that would work for both C and C++ ?


For a while we had a mix of both C and c in our function names, and
recently we normalized on C.  It seems we left a few loose ends in
this process.



 * Feeding text into blocks

 This is not directly related to ob-C.el, but I was looking for a way to
 feed some text to a block's STDIN while it was executed by babel.  I
 wanted to specifiy this text either inline from the block's header
 arguments or from a dedicated text block.


There is currently the option of passing command line arguments to C
code blocks, e.g.,

#+begin_src C :cmdline 1 2 3 4 5 :includes stdio.h
  int main(int argc, char **argv){
printf(argv[1] %s\n, argv[1]);
return 0;
  }
#+end_src

#+results:
: argv[1] 1

However there is no support for piping to/from the STDIN/STDOUT/STDERR
of code blocks.  The issue of pipes has come up before (for example with
a robust piping interface, we could stream data between code blocks in
much the same way as piped commands on the command line).  Such a change
would require significant work, may require support for asynchronous
code block execution.

While such large projects may make (for example) a good google SOC
project, I don't believe they will be implemented in the near future.


 It'd ideally look like this :

 ** Inline

 #+begin_src c :feed foo bar
 int main(void) {
 while ((c = getchar()) != EOF) {
 putchar(c);
 }
 return 0;
 }
 #+end_src

 #+results:
 : foo bar

 ** From a text block

 #+source: my-stdin
 #+begin_src text
 foo bar
 #+end_src

 #+begin_src c :feed my-stdin
 int main(void) {
 while ((c = getchar()) != EOF) {
 putchar(c);
 }
 return 0;
 }
 #+end_src

 #+results:
 : foo bar

 TL;DR if this is already possible somehow please skip the following and let
 me know :)

 I couldn't figure out how to pipe the text from within babel though. So
 I resorted to tangling the text blocks, and redefined
 org-babel-C-execute to use that new header argument :feed. It gets
 prepended to the cmdline in the org-babel-eval function call ; if foo is
 an existing file it gets cat'ed through a pipe to the rest of the
 cmdline in org-babel-eval, otherwise it is simply echo'ed. This is not
 as good as what I described above, but after getting to use it, I really
 think a generalization of this use-case is desirable.

 Please let me know whar you think.


I agree fully, however I would want to implement piping in such a manner
that it can easily be extended to any language, rather than in a C
specific manner.  It sounds like you have a nice solution currently.
Perhaps rather than overwriting the execute function, you could wrap
this up into a new function, and share the code on Worg so others could
incorporate it into their workflow.

Best -- Eric


 Regards,
 Julien.




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



Re: [O] org-babel (org-babel-detangle)

2011-04-15 Thread Mohamed HIBTI
Eric Schulte schulte.eric at gmail.com writes:
 
 Hi Mohamed,
 
 The comment prompt you mentioned actually isn't babel specific but is
 raised by the `comment-region' function which is used by babel to
 comment out links.  Look at the documentation for `comment-region'
 (below) which has information on variables to set to avoid the comment
 syntax prompt in xml documents.
 
 Best -- Eric
 
 ,[C-h f comment-region]
 | comment-region is an interactive compiled Lisp function in
 | `newcomment.el'.
 | 
 | It is bound to C-c r.
 | 
 | (comment-region BEG END optional ARG)
 | 
 | Comment or uncomment each line in the region.
 | With just C-u prefix arg, uncomment each line in region BEG .. END.
 | Numeric prefix ARG means use ARG comment characters.
 | If ARG is negative, delete that many comment characters instead.
 | 
 | The strings used as comment starts are built from `comment-start'
 | and `comment-padding'; the strings used as comment ends are built
 | from `comment-end' and `comment-padding'.
 | 
 | By default, the `comment-start' markers are inserted at the
 | current indentation of the region, and comments are terminated on
 | each line (even for syntaxes in which newline does not end the
 | comment and blank lines do not get comments).  This can be
 | changed with `comment-style'.
 `
 
 Mohamed HIBTI mohamed.hibti at gmail.com writes:
 
  Eric Schulte schulte.eric at gmail.com writes:
 
  Hi Eric,
  I tried it, it worked quite well but I have a trouble with the syntax 
comment
  (No comment syntax is defined.  Use: ) Since I have too many blocks, is 
there 
  any way to set it as a local variable ?
 
  Regards,
  Mohamed
 
 
 
  P.S. 
  I tried without success
 
  #+ Local Variables :
  #+ org-babel-tangle-comment-format-beg: !--[[%link][source-name]]
  #+ org-babel-tangle-comment-format-end: source-name ends here--
  #+ End:
 
  and 
 
  # Local Variables :
  # org-babel-tangle-comment-format-beg: !--[[%link][source-name]]
  # org-babel-tangle-comment-format-end: source-name ends here--
  # End:
 
 
 
 
 
 
 
 
 

Thanks for this answer.
You are right ! 
In the line

 #+BEGIN_SRC XML :tangle ./sample04.xml :comment yes

XML (with capitals) is not identified with the xml-mode where the variables 
`comment-begin' and `comment-end' are well defined.
I changed to  

 #+BEGIN_SRC xml :tangle ./sample04.xml :comment yes

and it worked !

Best regards,
Mohamed
Thanks for this answer.
You are right ! 


In the line

 #+BEGIN_SRC XML :tangle ./sample04.xml :comment yes

XML (with capitals) is not identified with the xml-mode where the variables 
`comment-begin' and `comment-end' are well defined.
I changed to  

 #+BEGIN_SRC xml :tangle ./sample04.xml :comment yes

and it worked !

Best regards,
Mohamed




Re: [O] Formal description of Org files

2011-04-15 Thread Rustom Mody

 Hi,

 I have a question.

 At FOSDEM, someone asked me if there was a formal description of the
 structure of Org files, in some language
 that would be the input for a parser (or parser generator?) so that Org
 file could be easily parsed.

 Unfortunately I did not catch the name of the format description language
 that could be
 used for something, not did I catch the name of the person who talked to
 me.

 Can anyone help out here?  Let me know what language to use, and maybe help
 work on such a formal description?  I
 think it would be useful to have


Something like yacc (bison, antlr etc) are all 'executable BNF' languages.
 When they work they can make the code an order of magnitude smaller and
development/programming correspondingly easier.

That said I see a couple of hitches.

1. Grammatical handling of languages is based on the assumption of a clear
and well defined set of tokens/lexemes.  I expect this would be harder in
org than the typical programming languages for which yacc etc are used.  For
example in most 'normal' languages there are comments and strings.  These
involve some non trivial handling which is entirely hidden from the grammar
by being pushed into the lexer.

2. Parsing a program is done for the full program as a rule (IDEs are the
exception to the rule). Sensible parsing of program fragments, where the
fragmenting could be quite arbitrary, is a bit of a research problem

3. As I see it, the main declarative tool (somewhat akin to grammars) that
org uses is regular expressions.  IOW org is written with re-s strung
together with programming logic ie vanilla elisp.  An alternative that stays
within the regular framework (not using the heavy guns of context free
parsing) may be ragel: http://www.complang.org/ragel/

Rusi


Re: [O] Formal description of Org files

2011-04-15 Thread MidLifeXis at PerlMonks
This is something I would like to see adopted by the org community as well.  
One 
of my main reasons is to allow other languages to be able to at least, given 
the 
proper configuration information (for TODO keywords, etc), to be able to deal 
with org files.  I am not quite sure where the lines should be drawn, but I am 
envisioning something like:

* The ORG format definition and actions

The format of the .org file (ORG) itself and a set of actions that are well 
behaved (add node, move node up, node id, property value, etc).  A core set of 
validation tests could be created to exercise any compliant org library.

* The configuration for a set of ORG files

The configuration for a given org (note the small org) application, defining 
particular tweaks that an application can use to make sense of a properly 
formatted ORG file, such as valid TODO keywords, etc.  This area is muddy in my 
mind.

* The org application itself - how the org files are used in a particular 
application, or the ideas and data that set of ORG files represents, or how an 
exporter handles the data thrown at it, or

But that is just /my/ dream.







From: Rustom Mody rustompm...@gmail.com
To: emacs-orgmode emacs-orgmode@gnu.org
Sent: Fri, April 15, 2011 12:13:45 PM
Subject: Re: [O] Formal description of Org files


Hi,

I have a question.

At FOSDEM, someone asked me if there was a formal description of the structure 
of Org files, in some language
that would be the input for a parser (or parser generator?) so that Org file 
could be easily parsed.

Unfortunately I did not catch the name of the format description language that 
could be
used for something, not did I catch the name of the person who talked to me.

Can anyone help out here?  Let me know what language to use, and maybe help 
work 
on such a formal description?  I
think it would be useful to have

Something like yacc (bison, antlr etc) are all 'executable BNF' languages.  
When 
they work they can make the code an order of magnitude smaller and 
development/programming correspondingly easier.

That said I see a couple of hitches.

1. Grammatical handling of languages is based on the assumption of a clear and 
well defined set of tokens/lexemes.  I expect this would be harder in org than 
the typical programming languages for which yacc etc are used.  For example in 
most 'normal' languages there are comments and strings.  These involve some non 
trivial handling which is entirely hidden from the grammar by being pushed into 
the lexer.

2. Parsing a program is done for the full program as a rule (IDEs are the 
exception to the rule). Sensible parsing of program fragments, where the 
fragmenting could be quite arbitrary, is a bit of a research problem

3. As I see it, the main declarative tool (somewhat akin to grammars) that org 
uses is regular expressions.  IOW org is written with re-s strung together with 
programming logic ie vanilla elisp.  An alternative that stays within the 
regular framework (not using the heavy guns of context free parsing) may be 
ragel: http://www.complang.org/ragel/

Rusi


Re: [O] Formal description of Org files

2011-04-15 Thread Eric Schulte
If one goal of such a formal description of Org-mode would be to parse
text Org-mode files into an abstract syntax tree (which is reminiscent
of [1] and [2]) then perhaps we should look at parsers which have
already been applied to other document languages (e.g. tex, html etc...)
or at least support xml output.  If such parsers exist and have been
widely applied, then maybe they could support the exportation of
Org-mode files, or even automate the writing of code for such exporters?

Best -- Eric

Wes Hardaker wjhns...@hardakers.net writes:

 On Fri, 15 Apr 2011 09:58:09 +0200, Carsten Dominik
 carsten.domi...@gmail.com said:

 CD Unfortunately I did not catch the name of the format description
 CD language that could be used for something, not did I catch the name
 CD of the person who talked to me.

 Another option, besides those mentioned, is probably ABNF.


Footnotes: 
[1]  the effort to unify exporting behind a single parser of Org-mode
 files into an abstract elisp tree

[2]  http://johnmacfarlane.net/pandoc/, which as I recall has an
 Org-mode backend

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



[O] bug with export as html?

2011-04-15 Thread Richard Riley


,
| + Create a file for each vhost you wish to redirect email for. From our 
example
|   we create /etc/exim4/virtualhosts/myweb.com. In it we place our email
|   mappings. Here is an example:-
| #+begin_example
| info: i...@gmail.com
| webmaster: webmas...@gmail.com
| * : :blackhole:
| #+end_example
| Here we can see that i...@myweb.com gets sent to i...@gmail.com. Easy peasy.
`

My export finished at the blackhole line. Any org mark up characters
inside literal blocks should be ignored I thought. It seems that

org-export-as-html

falls over in my export at that * in the src block.

Something I can tweak or a legitimate bug?



[O] FR: color inline footnotes

2011-04-15 Thread Samuel Wales
Is it possible to color inline footnotes with a special face in the
org file?  It's a wishlist only.

Samuel

-- 
The Kafka Pandemic:
  
http://thekafkapandemic.blogspot.com/2010/12/welcome-to-kafka-pandemic-two-forces_9182.html
I support the Whittemore-Peterson Institute (WPI)
===
I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard MRV paper.



Re: [O] bug with export as html?

2011-04-15 Thread Nick Dokos
Richard Riley rile...@googlemail.com wrote:

 
 
 ,
 | + Create a file for each vhost you wish to redirect email for. From our 
 example
 |   we create /etc/exim4/virtualhosts/myweb.com. In it we place our email
 |   mappings. Here is an example:-
 | #+begin_example
 | info: i...@gmail.com
 | webmaster: webmas...@gmail.com
 | * : :blackhole:
 | #+end_example
 | Here we can see that i...@myweb.com gets sent to i...@gmail.com. Easy peasy.
 `
 
 My export finished at the blackhole line. Any org mark up characters
 inside literal blocks should be ignored I thought. It seems that
 
 org-export-as-html
 
 falls over in my export at that * in the src block.
 
 Something I can tweak or a legitimate bug?
 

Perhaps upgrade to latest? I cannot reproduce this either as it stands or with
a headline added. The relevant portion of the html file (with the headline 
added)
looks like this:

,
| div id=outline-container-1 class=outline-2
| h2 id=sec-1span class=section-number-21/span foo /h2
| div class=outline-text-2 id=text-1
| 
| ul
| liCreate a file for each vhost you wish to redirect email for. From our 
example
|   we create /etc/exim4/virtualhosts/myweb.com. In it we place our email
|   mappings. Here is an example:-
| /li
| /ul
| 
| 
| 
| 
| pre class=exampleinfo: i...@gmail.com
| webmaster: webmas...@gmail.com
| * : :blackhole:
| /pre
| 
| 
| p
| Here we can see that i...@myweb.com gets sent to i...@gmail.com. Easy peasy.
| /p
`

Nick



Re: [O] [PATCH][ANN] org-html/org-odt/org-docbook

2011-04-15 Thread Jambunathan K

 This is a formal request to integrate my org-html.el  org-odt.el
 changes in to the master branch. 

 This patch introduces 3 major features:
 1. A generic exporter
 2. All new html backend re-implemented as a plugin to (1).
 3. A odt backend as a plugin to (1).

 The patch is based on git commit 3d802.

With a day's hack, I was able to make org-docbook.el ride on top of
(1). The changes are in my work-area and I will be committing docbook
changes to my staging branch in few days.

In effect, all html derived exporters (org-html, org-docbook, org-odt)
will ride atop a single core.

Giving a quick heads-up.

Jambunathan K.







[O] Bug: symbol function's definition is null : signum [7.5]

2011-04-15 Thread Sylvain Beucler
When using S-up to modify a date with an our range in Org 7.5, I get
symbol function's definition is null : signum.

E.g. 2011-03-10 jeu. 10:30-11:30

It appears that (org-modify-ts-extra) is using this function, but
unlike in CL isn't not an elisp built-in :)

As a work-around I added an internal defun:
(defun org-modify-ts-extra (s pos n dm)
  Change the different parts of the lead-time and repeat fields in timestamp.
  (defun signum (x) 
(cond
 (( x 0)  1)
 (( x 0) -1)
 ((= x 0)  0)))
[...]

-- 
Sylvain



[O] Begginer using orgmode

2011-04-15 Thread Arnold, Travis
Hi all after much googling and searching I came across org mode while trying to 
find a system for my mac on which I could take notes for my school classes. 
I've read the manual and taken a look at the worg tutorials but  seem to keep 
messing up my .emacs config file, I seemed to have borked the sequence, or work 
flow of my TODO states, I started with the ones in the example but just took 
out the next step and added some short cuts, t, s, d and c, but C-t just cycles 
from TODO -DONE and since I know every little about coding, or lisp I am 
unsure of what I did wrong.  I cannot also seem to find a a way to just get 
bolded section headings with out the 1.x.x etc etc for my notes, if anything I 
wonder if there is a way to get list the sections with roman numerals?

As the note taking system I have so far enjoyed it and would love to tinker and 
tweak it for an agenda but am fearful of messing up. Might anyone know of a 
tutorial for luddites like myself who are just starting out? I am unsure if I 
even set up my .emacs file correctly: I basically copied and pasted the 
relevant bits that I thought I needed.

Respectfully and thank you for the time,
Travis


[O] Error message while compiling - sha1

2011-04-15 Thread Asuptyam Bryuluanemon
While following the installation instructions on
http://orgmode.org/guide/Installation.html#Installation

I get an error message after issuing the make command


While compiling toplevel forms in file ~/src/org-7.5/lisp/org-feed.el:
  !! File error ((Cannot open load file sha1))
Done
make: *** [lisp/org-feed.elc] Error 1

Does anyone have any suggestions?


Regards,

Asuptyam


[O] Forcing image to inline

2011-04-15 Thread Andy Jewell
Hi. . . I'm new to org-mode and I'm totally blown away that I've never ran
across it before!  Wow, so much to learn!

I have several questions for the group and am trying to do due diligence on
each of them because there is much material where the answer might lie.  So
this is my first question: is there a way to force org-mode to recognize a
link as an image if it is a URL with no identification of it *as* an image?


I have an image saved on Google but obviously the link doesn't look like an
image.  Here's the markup:

* See the image below:
  [[
https://docs.google.com/leaf?id=0B-swGEqSDpxyMjgwNjE0MzEtMTA4OC00NTdmLWE3MjktMDJmOGE5ZWM2YjY0hl=en
]]
* See the image above

I know attributes can be added but not sure what attribute would make it
realize it was an image.. ?

Any help?


Andy


[O] resolving conflicting appointments

2011-04-15 Thread Ivan Kanis
Hello,

At the last two org camps we talked about conflicting appointments. I
was thinking we could display on top of the calendar an agenda view of
the target date. That way we can quickly see potential conflicts before
confirming an appointment. What do you think?

Take care,
-- 
Ivan Kanis
http://kanis.fr

Go confidently in the direction of your dreams. Live the life you
have imagined.
-- Henry David Thoreau 



Re: [O] org-babel (org-babel-detangle)

2011-04-15 Thread Mohamed HIBTI
Eric Schulte schulte.e...@gmail.com writes:

Thanks for this answer.
I got it.




 Hi Mohamed,

 The comment prompt you mentioned actually isn't babel specific but is
 raised by the `comment-region' function which is used by babel to
 comment out links.  Look at the documentation for `comment-region'
 (below) which has information on variables to set to avoid the comment
 syntax prompt in xml documents.

 Best -- Eric

 ,[C-h f comment-region]
 | comment-region is an interactive compiled Lisp function in
 | `newcomment.el'.
 | 
 | It is bound to C-c r.
 | 
 | (comment-region BEG END optional ARG)
 | 
 | Comment or uncomment each line in the region.
 | With just C-u prefix arg, uncomment each line in region BEG .. END.
 | Numeric prefix ARG means use ARG comment characters.
 | If ARG is negative, delete that many comment characters instead.
 | 
 | The strings used as comment starts are built from `comment-start'
 | and `comment-padding'; the strings used as comment ends are built
 | from `comment-end' and `comment-padding'.
 | 
 | By default, the `comment-start' markers are inserted at the
 | current indentation of the region, and comments are terminated on
 | each line (even for syntaxes in which newline does not end the
 | comment and blank lines do not get comments).  This can be
 | changed with `comment-style'.
 `

 Mohamed HIBTI mohamed.hi...@gmail.com writes:

 Eric Schulte schulte.eric at gmail.com writes:

 Hi Eric,
 I tried it, it worked quite well but I have a trouble with the syntax comment
 (No comment syntax is defined.  Use: ) Since I have too many blocks, is 
 there 
 any way to set it as a local variable ?

 Regards,
 Mohamed



 P.S. 
 I tried without success

 #+ Local Variables :
 #+ org-babel-tangle-comment-format-beg: !--[[%link][source-name]]
 #+ org-babel-tangle-comment-format-end: source-name ends here--
 #+ End:

 and 

 # Local Variables :
 # org-babel-tangle-comment-format-beg: !--[[%link][source-name]]
 # org-babel-tangle-comment-format-end: source-name ends here--
 # End:











Re: [O] Bug: symbol function's definition is null : signum [7.5]

2011-04-15 Thread Nick Dokos
Sylvain Beucler b...@beuc.net wrote:

 When using S-up to modify a date with an our range in Org 7.5, I get
 symbol function's definition is null : signum.
 
 E.g. 2011-03-10 jeu. 10:30-11:30
 
 It appears that (org-modify-ts-extra) is using this function, but
 unlike in CL isn't not an elisp built-in :)
 
 As a work-around I added an internal defun:
 (defun org-modify-ts-extra (s pos n dm)
   Change the different parts of the lead-time and repeat fields in 
 timestamp.
   (defun signum (x) 
 (cond
  (( x 0)  1)
  (( x 0) -1)
  ((= x 0)  0)))
 [...]
 

What version of emacs are you using?

For emacs 24 at least, it's defined in cl-extra.el (which is distributed
with emacs itself).  That in turn is loaded when cl is loaded and there
are plenty of places where org does a (require 'cl), e.g. when loading
org.el or org-agenda.el; but it may be that you have found a path in
that does not do so, however unlikely that scenario is.

So you can probably resolve the problem by adding a (require 'cl)
somewhere in your .emacs. But if you can, it would be worthwhile to
figure out how you end up in that situation, so the (require 'cl) can be
added to the appropriate place.

If you are using emacs 23 or earlier, the above might not be applicable,
but you probably can still resolve the problem the same way: adding a
(require 'cl) in your .emacs. If that does not resolve it, then adding a
(require 'cl-extra) as well should certainly do so.

Nick




Re: [O] Error message while compiling - sha1

2011-04-15 Thread Tassilo Horn
Asuptyam Bryuluanemon abryuluane...@gmail.com writes:

 While following the installation instructions on
 http://orgmode.org/guide/Installation.html#Installation

 I get an error message after issuing the make command

 While compiling toplevel forms in file ~/src/org-7.5/lisp/org-feed.el:
   !! File error ((Cannot open load file sha1))
 Done
 make: *** [lisp/org-feed.elc] Error 1

 Does anyone have any suggestions?

As I've already told you, org-mode version  6.26b do not support Emacs
21.4 as you are using.  That Emacs 21 does not contain sha1.el is only
one minor issue.  Org uses other Emacs 22+ features, too.

So if you really cannot update your emacs copy, then fetch
org-mode-6.26b and use that.

Bye,
Tassilo




Re: [O] Error message while compiling - sha1

2011-04-15 Thread Nick Dokos
Asuptyam Bryuluanemon abryuluane...@gmail.com wrote:

 While following the installation instructions on 
 http://orgmode.org/guide/Installation.html#Installation
 
 I get an error message after issuing the make command
 
 While compiling toplevel forms in file ~/src/org-7.5/lisp/org-feed.el:
   !! File error ((Cannot open load file sha1))
 Done
 make: *** [lisp/org-feed.elc] Error 1
 
 Does anyone have any suggestions?
 

Well, either your load-path is not set correctly or you are missing the file.
sha1.el is a file that is distributed with emacs. In my case, it is in

/usr/local/share/emacs/24.0.50/lisp/sha1.elc

but depending on which version of emacs you have and how you installed it,
it may be in a different directory. 

Try locating it with

M-x locate-library RET sha1 RET

If not found, try to find where standard elisp files are located in your
setup and see if sha1.el or sha1.elc is in there as well (e.g. try

M-x locate-library RET files RET

That should certainly be found: check the directory and see if sha1.el
and/or sha1.elc is in that directory. If not, your installation is
probably incomplete. If it is there, try loading it with

   M-x load-library RET sha1 RET

If all of that works, the compilation of org-feed.el should work as well.
If not, send another note and include the output of all the commands above
as well as the version of emacs you are running:

   M-x emacs-version

Nick




Re: [O] Unable to use M-Ret from line-wrapped relative time items

2011-04-15 Thread Tomer Altman

Can someone merely reply and confirm that:

* I've submitted this bug report to the correct forum
* I've supplied the information that I need to

Thank you for your time.

Cheers,

~Tomer Altman

On 4/13/11 10:59 AM, Tomer Altman wrote:

Hi,

I am an inexperienced org-mode user, so my apologies if this bug report
falls short, or is submitted to the wrong forum.

I've been experiencing an annoying bug/break since upgrading to OrgMode
7.5. I'm running it on GNU Emacs 22.3.1 (i386-apple-darwin9, Carbon
Version 1.6.0).

When I am using a relative timer, I can usually hit M-Ret at the end of
the current item, to create a new time-stamped item (I'm using [X] for
point):

- 0:02:04 :: foo[X]

This leads to a new timestamp item:

- 0:02:04 :: foo
- 0:02:06 ::

But when the text of the second note gets to be too long, Emacs wraps
the text to the next line (I have the Fill minor mode active). Trying to
use M-Ret from the end of the second line of the second item leads to
the attached break/backtrace:

- 0:02:04 :: foo
- 0:02:06 :: bar bar bar bar bar bar bar bar bar bar bar bar bar bar
bar[X]

Any ideas on how to fix this bug/break? Do I merely need to upgrade my
version of GNU Emacs?

Thank you for your time  help,

~Tomer






Re: [O] Begginer using orgmode

2011-04-15 Thread Arnold, Travis
emacs 22.1, that is in Mac OSX 10.6.6 and Orgmode 7.4 Here is my .emacs file, 
all stuff I've cribbed from either the tutorial or the Orgpdf itself, with my 
own specification regarding what is in the agenda make up, a notes.org, school 
and an Agenda.org(to differeniate from school deadlines)
-Travis Arnold

;; Org-mode settings


(add-to-list 'auto-mode-alist '(\\.org$ . org-mode))
(global-set-key \C-cl 'org-store-link)
(global-set-key \C-ca 'org-agenda)
(global-font-lock-mode 1)
(add-to-list 'load-path /Users/Tmoney/org-7.4/lisp)
(custom-set-variables
  ;; custom-set-variables was added by Custom.  


  ;; If you edit it by hand, you could mess it up, so be careful.   


  ;; Your init file should contain only one such instance.  


  ;; If there is more than one, they won't work right.  


  '(gud-gdb-command-name gdb --annotate=1)
'(org-agenda-files (quote (~/org/Notes.org ~/org/school.org 
~/org/Agenda.org
(setq org-agenda-files (list ~/org/Notes.org
 ~/org/school.org
 ~/org/Agenda.org))
(setq org-todo-keywords '((sequence TODO(t) STARTED(s) WAITING(w@/!) | 
DONE(d))
  (sequence | CANCELED(c@/!
(setq org-log-done 'time)
(custom-set-faces
  ;; custom-set-faces was added by Custom.  


  ;; If you edit it by hand, you could mess it up, so be careful.   


  ;; Your init file should contain only one such instance.  


  ;; If there is more than one, they won't work right.

On 15 Apr, 2011, at 5:45 PM, Matthew Sauer wrote:

 do you have your section of .emacs or site file customizations that
 you used to set it up with?  also what version of Ogmode and emacs?
 
 On Wed, Apr 13, 2011 at 10:31 PM, Arnold, Travis tlarn...@radford.edu wrote:
 Hi all after much googling and searching I came across org mode while trying 
 to find a system for my mac on which I could take notes for my school 
 classes. I've read the manual and taken a look at the worg tutorials but  
 seem to keep messing up my .emacs config file, I seemed to have borked the 
 sequence, or work flow of my TODO states, I started with the ones in the 
 example but just took out the next step and added some short cuts, t, s, d 
 and c, but C-t just cycles from TODO -DONE and since I know every little 
 about coding, or lisp I am unsure of what I did wrong.  I cannot also seem 
 to find a a way to just get bolded section headings with out the 1.x.x etc 
 etc for my notes, if anything I wonder if there is a way to get list the 
 sections with roman numerals?
 
 As the note taking system I have so far enjoyed it and would love to tinker 
 and tweak it for an agenda but am fearful of messing up. Might anyone know 
 of a tutorial for luddites like myself who are just starting out? I am 
 unsure if I even set up my .emacs file correctly: I basically copied and 
 pasted the relevant bits that I thought I needed.
 
 Respectfully and thank you for the time,
 Travis