Re: [O] foot note / enumeration question

2011-07-03 Thread Robert Klein

Hi,

On 07/02/2011 10:10 AM, Nicolas Goaziou wrote:

Hello,

Robert Klein  writes:


A file of

#+begin_example
* Title

This is a text [fn:: the
1. footnote] with a footnote.
#+end_example

begins an enumeration inside the footenote and then
forgets to close the footnote (which in LaTeX export
gets closed at the next \section or so).

I'm not sure what the expected behavior should be -- I'd
obviously prefer no enumerations in footnotes :)  Is there
a way to specify this in the header, e.g.
enum-in-footnotes: nil or similar?   Just thinking when
someone pute literary references in footnotes this could
be useful (e.g.: [fn:: My fun. pp. 3-5, 12. edition, O'Really,
1996. London, New York...] )

This confusing case shouldn't happen, unless the user somehow does it on
purpose. Indeed, Org prevents auto-filling to break a line where it
would create a new list item.

This looks to me as a false problem ; I don't think we should write some
workaround for it.

Regards,



Thanks for your help.  I figured out now,  there's a special case I 
triggered:


It is due to the closing square bracket right after "29."


My minimal .emacs file only loads org-mode:

#+begin_example
(setq load-path (cons "~/.emacs.d/org-mode/lisp" load-path))
#+end_example

and my test file is:
#+begin_example
* Title

Alpha gamma, phi beta epsilon phi gamma, psi iota omega, phi mu beta
lambda kappa sigma zeta theta eta, phi psi iota chi gamma[fn:: Eta. 1,
29.]. Alpha gamma
#+end_example

When I press Alt-q to reformat the paragraph nothing happens.

When I delete the last line and continue after the "[fn::Eta 1," with
" 29.]. Alpha" Emacs breaks the line after I type the blank before "Alpha",
so the new line begins with:

#+begin_example
.29].
#end_example

Now, when I put a blank after the "29" and before the closing
square bracket it works.

So, that's it. I'm going to put spaces between the dots and
closing brackets now.

Again, thanks for your help and pointing me to the right place.

Best regards
Robert




Re: [O] Move to item to the bottom

2011-07-03 Thread Nicolas Goaziou
Hello,

Marcelo de Moraes Serpa  writes:

> Nicolas, the function works quite well!  Thanks. Just one last request: Is
> it possible to not follow the item until the bottom? The issue is that, once
> running it and when the item is sent to the bottom of the file, the pointer
> is also put there and the buffer scrolls down with it.


Sure, it's simple as packing it into a (save-excursion ...)

#+begin_src emacs-lisp
(defun ngz-move-headline-at-bottom ()
  "Move current headline to the last position in the same tree"
  (interactive)
  (unless (org-at-heading-p) (error "Not at an headline"))
  (save-excursion (while (ignore-errors (org-move-subtree-down)
#+end_src

Regards,

-- 
Nicolas Goaziou



[O] [Accepted] [O, 1/2] org-lparse/org-odt: Add docstring. Silence byte-compiler

2011-07-03 Thread Bastien Guerry
Patch 820 (http://patchwork.newartisans.com/patch/820/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C81vcvkoa7a.fsf%40gmail.com%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,1/2] org-lparse/org-odt: Add docstring. Silence byte-compiler
> Date: Sat, 02 Jul 2011 22:37:29 -
> From: Jambunathan K 
> X-Patchwork-Id: 820
> Message-Id: <81vcvkoa7a@gmail.com>
> To: emacs-orgmode@gnu.org
> Cc: 
> 
> I am attaching two org-odt patches for inclusion. Both are desirable and
> not mandatory.
> 
> ---
> 
> 
> >From 38d0dcbc921d69ba55c3a5bb3a219204800370c9 Mon Sep 17 00:00:00 2001
> From: Jambunathan K 
> Date: Sat, 2 Jul 2011 16:51:38 +0530
> Subject: [PATCH 1/2] org-lparse/org-odt: Add docstring. Silence byte-compiler.
> 
> * contrib/lisp/org-odt.el (org-odt-unit-test):
> Removed. This doesn't belong to production code.
> 
> * contrib/lisp/org-lparse.el (org-lparse-and-open)
> (org-lparse-to-buffer, org-lparse-backend)
> (org-lparse-other-backend, org-lparse-body-only)
> (org-lparse-to-buffer): Update docstring.
> ---
>  contrib/lisp/org-lparse.el |   52 +--
>  contrib/lisp/org-odt.el|   11 -
>  2 files changed, 40 insertions(+), 23 deletions(-)
> 
> diff --git a/contrib/lisp/org-lparse.el b/contrib/lisp/org-lparse.el
> index cff8fd6..b37b683 100755
> --- a/contrib/lisp/org-lparse.el
> +++ b/contrib/lisp/org-lparse.el
> @@ -50,8 +50,6 @@
>  ;;; See README.org file that comes with this library for answers to
>  ;;; FAQs and more information on using this library.
>  
> -;;; Use M-x `org-odt-unit-test' for test driving the odt exporter
> -
>  ;;; Code:
>  
>  (require 'org-exp)
> @@ -59,10 +57,11 @@
>  
>  ;;;###autoload
>  (defun org-lparse-and-open (target-backend native-backend arg)
> -  "Export the outline as HTML and immediately open it with a browser.
> -If there is an active region, export only the region.
> -The prefix ARG specifies how many levels of the outline should become
> -headlines.  The default is 3.  Lower levels will become bulleted lists."
> +  "Export the outline to TARGET-BACKEND via NATIVE-BACKEND and open exported 
> file.
> +If there is an active region, export only the region.  The prefix
> +ARG specifies how many levels of the outline should become
> +headlines.  The default is 3.  Lower levels will become bulleted
> +lists."
>;; (interactive "Mbackend: \nP")
>(interactive
> (let* ((input (if (featurep 'ido) 'ido-completing-read 'completing-read))
> @@ -102,8 +101,9 @@ emacs   --batch
>  
>  ;;;###autoload
>  (defun org-lparse-to-buffer (backend arg)
> -  "Call `org-lparse` with output to a temporary buffer.
> -No file is created.  The prefix ARG is passed through to `org-lparse'."
> +  "Call `org-lparse' with output to a temporary buffer.
> +No file is created.  The prefix ARG is passed through to
> +`org-lparse'."
>(interactive "Mbackend: \nP")
>(let ((tempbuf (format "*Org %s Export*" (upcase backend
>(org-lparse backend backend arg nil nil tempbuf)
> @@ -508,9 +508,36 @@ then that converter is used.  Otherwise
>  (defvar org-lparse-toc)
>  (defvar org-lparse-entity-control-callbacks-alist)
>  (defvar org-lparse-entity-format-callbacks-alist)
> -(defvar org-lparse-backend)
> -(defvar org-lparse-body-only)
> -(defvar org-lparse-to-buffer)
> +(defvar org-lparse-backend nil
> +  "The native backend to which the document is currently exported.
> +This variable is let bound during `org-lparse'.  Valid values are
> +one of the symbols corresponding to `org-lparse-native-backends'.
> +
> +Compare this variable with `org-export-current-backend' which is
> +bound only during `org-export-preprocess-string' stage of the
> +export process.
> +
> +See also `org-lparse-other-backend'.")
> +
> +(defvar org-lparse-other-backend nil
> +  "The target backend to which the document is currently exported.
> +This variable is let bound during `org-lparse'.  This variable is
> +set to either `org-lparse-backend' or one of the symbols
> +corresponding to OTHER-BACKENDS specification of the
> +org-lparse-backend.
> +
> +For example, if a document is exported to \"odt\" then both
> +org-lparse-backend and org-lparse-other-backend are bound to
> +'odt.  On the other hand, if a document is exported to \"odt\"
> +and then converted to \"doc\" then org-lparse-backend is set to
> +'odt and org-lparse-other-backend is set to 'doc.")
> +
> +(defvar org-lparse-body-only nil
> +  "Bind this to BODY-ONLY arg of `org-lparse'.")
> +
> +(defvar org-lparse-to-buffer nil
> +  "Bind this to TO-BUFFER arg of `org-lparse'.")
> +
>  (defun org-do-lparse (arg &optional hidden ext-plist
> to-buffer body-only pub-dir)
>"Export the outline to various formats.
> @@ -1240,6 +1267,7 @@ But it has the disadvantage, that no cell- or 
> row-

[O] [Accepted] [O, 2/2] doc/org.texi: Add a new node for OpenDocumentText exporter

2011-07-03 Thread Bastien Guerry
Patch 821 (http://patchwork.newartisans.com/patch/821/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C81r568oa45.fsf%40gmail.com%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,2/2] doc/org.texi: Add a new node for OpenDocumentText exporter
> Date: Sat, 02 Jul 2011 22:39:22 -
> From: Jambunathan K 
> X-Patchwork-Id: 821
> Message-Id: <81r568oa45@gmail.com>
> To: emacs-orgmode@gnu.org
> Cc: 
> 
> --
> 
> 
> >From 1177aa67678e2c9b0fd1d65cd0d87436fd63a08e Mon Sep 17 00:00:00 2001
> From: Jambunathan K 
> Date: Sat, 2 Jul 2011 22:40:18 +0530
> Subject: [PATCH 2/2] doc/org.texi: Add a new node for OpenDocumentText 
> exporter
> 
> ---
>  doc/org.texi |  180 +++--
>  1 files changed, 173 insertions(+), 7 deletions(-)
> 
> diff --git a/doc/org.texi b/doc/org.texi
> index afa1623..d3753ce 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -574,6 +574,7 @@ Exporting
>  * HTML export:: Exporting to HTML
>  * LaTeX and PDF export::Exporting to @LaTeX{}, and processing to PDF
>  * DocBook export::  Exporting to DocBook
> +* OpenDocumentText export:: Exporting to OpenDocumentText
>  * TaskJuggler export::  Exporting to TaskJuggler
>  * Freemind export:: Exporting to Freemind mind maps
>  * XOXO export:: Exporting to XOXO
> @@ -610,6 +611,16 @@ DocBook export
>  * Images in DocBook export::How to insert figures into DocBook output
>  * Special characters::  How to handle special characters
>  
> +OpenDocument export
> +
> +* OpenDocumentText export commands::How to invoke OpenDocumentText export
> +* Applying Custom Styles::  How to apply custom styles to the output
> +* Converting to Other formats:: How to convert to formats like doc, docx etc
> +* Links in OpenDocumentText export::  How links will be interpreted and 
> formatted
> +* Tables in OpenDocumentText export::How Tables are handled
> +* Images in OpenDocumentText export::How to insert figures
> +* Additional Documentation::  How to handle special characters
> +
>  Publishing
>  
>  * Configuration::   Defining projects
> @@ -9378,11 +9389,13 @@ the web, while the XOXO format provides a solid base 
> for exchange with a
>  broad range of other applications.  @LaTeX{} export lets you use Org-mode and
>  its structured editing functions to easily create @LaTeX{} files.  DocBook
>  export makes it possible to convert Org files to many other formats using
> -DocBook tools.  For project management you can create gantt and resource
> -charts by using TaskJuggler export.  To incorporate entries with associated
> -times like deadlines or appointments into a desktop calendar program like
> -iCal, Org-mode can also produce extracts in the iCalendar format.  Currently
> -Org-mode only supports export, not import of these different formats.
> +DocBook tools.  OpenDocumentText export allows seamless colloboration across
> +organizational boundaries.  For project management you can create gantt and
> +resource charts by using TaskJuggler export.  To incorporate entries with
> +associated times like deadlines or appointments into a desktop calendar
> +program like iCal, Org-mode can also produce extracts in the iCalendar
> +format.  Currently Org-mode only supports export, not import of these
> +different formats.
>  
>  Org supports export of selected regions when @code{transient-mark-mode} is
>  enabled (default in Emacs 23).
> @@ -9395,6 +9408,7 @@ enabled (default in Emacs 23).
>  * HTML export:: Exporting to HTML
>  * LaTeX and PDF export::Exporting to @LaTeX{}, and processing to PDF
>  * DocBook export::  Exporting to DocBook
> +* OpenDocumentText export:: Exporting to OpenDocumentText
>  * TaskJuggler export::  Exporting to TaskJuggler
>  * Freemind export:: Exporting to Freemind mind maps
>  * XOXO export:: Exporting to XOXO
> @@ -10416,7 +10430,7 @@ Here is a simple example Org document that is 
> intended for beamer export.
>  
>  For more information, see the documentation on Worg.
>  
> -@node DocBook export, TaskJuggler export, LaTeX and PDF export, Exporting
> +@node DocBook export, OpenDocumentText export, LaTeX and PDF export, 
> Exporting
>  @section DocBook export
>  @cindex DocBook export
>  @cindex PDF export
> @@ -10613,7 +10627,156 @@ special characters included in XHTML entities:
>  "
>  @end example
>  
> -@node  TaskJuggler export, Freemind export, DocBook export, Exporting
> +@c begin opendocument
> +
> +@node OpenDocumentText export, TaskJuggler export, DocBook export, Exporting
> +@section OpenDocumentText export
> +@cindex OpenDocumentText export
> +@cindex K, Jambunathan
> +
> +Org-mode 7.6 supports expo

Re: [O] Typo in 'org-without-partial-completion'

2011-07-03 Thread Bastien
Hi Nick, David,

David Maus  writes:

> Yes and yes.
>
> (and (boundp 'partial-completion-mode)
>  partial-completion-mode
>  (fboundp 'partial-completion-mode))
>
> Is the right condition. Bound, non-nil and callable.
>
> @Bastien: Pushed fix for this to master.

Thanks!

-- 
 Bastien



Re: [O] Bugs and patches hunt before tomorrow

2011-07-03 Thread Bastien
Hi David,

David Maus  writes:

> Three patches, byte compiler complains with Emacs 22, one for a
> accidentally scoped variable in org-latex's preprocessor.

All applied, great.  Thanks!

-- 
 Bastien



Re: [O] Bugs and patches hunt before tomorrow

2011-07-03 Thread Bastien
David Maus  writes:

> And resubmit of this one:
>
> http://article.gmane.org/gmane.emacs.orgmode/43235

Applied, thanks.

-- 
 Bastien



Re: [O] [PATCH 2/2] doc/org.texi: Add a new node for OpenDocumentText exporter

2011-07-03 Thread Bastien
Hi Jambunathan,

Jambunathan K  writes:

> Otherwise you can copy the 3 files that you find in the below URL.
>
> http://repo.or.cz/w/org-mode/org-jambu.git/tree/HEAD:/packages/emacs-24.1
>
> to the URL of your choosing under http://orgmode.org/pkg and update the
> manual accordingly.

Jason, can you take care of this?

No emergency, as this must be ready only after 7.6 is release *and*
merged to Emacs trunk.

Thanks!

-- 
 Bastien



Re: [O] Function: Extract link location to killring

2011-07-03 Thread Bastien
Hi Memnon,

Memnon Anon  writes:

> Bastien  writes:
>
>> These two snippets could live on Worg -- can anyone add this to
>> org-hacks.el (or any relevant place)?
>
> Done. 

Thanks for this!

-- 
 Bastien



[O] [babel] python sessions

2011-07-03 Thread Andrea Crotti
I wanted to use sessions in python to do some nice literate programming
and splitting functions, but it doesn't work as expected.

Here below a very simple example in python and ruby, where in ruby
everything seems to work well while in python it doesn't...
And by the way, what is that org_babel_python_eoe? I can't find it
documented anywhere in the manual...

I've read some time ago that python support for babel was a bit tricky,
are there workarounds to make it work anyway?

Or could you explain briefly what the problem is so that I can try to
contribute as soon as I finish this thing?

Thanks a lot,
Andrea

--8<---cut here---start->8---
#+begin_src python :session
  def var(x):
  return float(x ** 2)
  
#+end_src

#+results:
: org_babel_python_eoe

#+begin_src python :session
  def var2(x):
  return x ** 2 * var(x)
  
  var2(10)
#+end_src

#+results:
: org_babel_python_eoe

#+begin_src ruby :session
  def fun(x)
x + 2
  end
#+end_src

#+results:
: nil

#+begin_src ruby :session
  def fun2(x)
x + fun(x)
  end
  
  fun2 10
#+end_src

#+results:
: 22

--8<---cut here---end--->8---



[O] [PATCH] Don't call calendar-absolute-from-gregorian in org-diary-class

2011-07-03 Thread Rémi Vanicat
calendar-absolute-from-gregorian return a number of day. But the
result is used as if it was a (year month day) list.
---
 lisp/org-agenda.el |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 2bec518..66af554 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4879,10 +4879,8 @@ be skipped.
 
 This function is here only for backward compatibility and it is deprecated,
 please use `org-class' instead."
-  (let* ((date1 (calendar-absolute-from-gregorian
-(org-order-calendar-date-args m1 d1 y1)))
-(date2 (calendar-absolute-from-gregorian
-(org-order-calendar-date-args m2 d2 y2)))
+  (let* ((date1 (org-order-calendar-date-args m1 d1 y1))
+(date2 (org-order-calendar-date-args m2 d2 y2))
 (d (calendar-absolute-from-gregorian date)))
 (org-class
  (nth 2 date1) (car date1) (nth 1 date1)
-- 
1.7.5.4






[O] org -> lilypond?

2011-07-03 Thread Rustom Mody
Hello fellow-music-orgers!

I would really like to use something like lilypond to make music.  A basic
requirement of mine is that it should render as score and play as sound
simultaneously. See http://vimeo.com/16894001/ for a demo.  This is because
I use it to teach singing to pelple with no musical background.

I use nted playing through timidity currently for this.  If there is some
workflow involving lilypond for this that will be real cool.
Does anyone know of such?

Thanks
Rusi

PS. Sorry if this is OT but the recent entry of ob-lilypond into org prompts
me to ask this.


Re: [O] [babel] python sessions

2011-07-03 Thread Eric Schulte
Hi Andrea,

Andrea Crotti  writes:

> I wanted to use sessions in python to do some nice literate programming
> and splitting functions, but it doesn't work as expected.
>
> Here below a very simple example in python and ruby, where in ruby
> everything seems to work well while in python it doesn't...
> And by the way, what is that org_babel_python_eoe? I can't find it
> documented anywhere in the manual...
>

This string is used by Babel to indicate when to stop waiting for output
form the interactive python process and return control to the user.

>
> I've read some time ago that python support for babel was a bit tricky,
> are there workarounds to make it work anyway?
>

This is true, in addition to being a language which is dependent upon
whitespace characters, python has been tricky due to the many
independent inferior python modes (python.el, python-mode.el, etc...)
and to the fact that I personally and not very familiar with the
language.

I've just pushed up a patch which should improve upon the python session
behavior.  After this patch your example returns the following
results...

--8<---cut here---start->8---
#+begin_src python :session :results silent
  def var(x):
  return float(x ** 2)
#+end_src

#+begin_src python :session :result value
  def var2(x):
  return x ** 2 * var(x)
  
  var2(10)
#+end_src

#+results:
: 1.0
--8<---cut here---end--->8---

Please let me know if you notice any other problematic behavior.

Thanks -- Eric

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



Re: [O] [babel] python sessions

2011-07-03 Thread Andrea Crotti
Eric Schulte  writes:
>
> This is true, in addition to being a language which is dependent upon
> whitespace characters, python has been tricky due to the many
> independent inferior python modes (python.el, python-mode.el, etc...)
> and to the fact that I personally and not very familiar with the
> language.

That is indeed a problem (also in cedet for example) and I really would
like to have just one and working well python mode, not a thousand.. 

>
> I've just pushed up a patch which should improve upon the python session
> behavior.  After this patch your example returns the following
> results...
>
> #+begin_src python :session :results silent
>   def var(x):
>   return float(x ** 2)
> #+end_src
>
> #+begin_src python :session :result value
>   def var2(x):
>   return x ** 2 * var(x)
>   
>   var2(10)
> #+end_src
>
> #+results:
> : 1.0
>

That example now works like a charm
But here still I get that string, but if I tangle the file I get the
correct result, any idea?

--8<---cut here---start->8---
#+begin_src python :session :tangle myset.py :results silent
  class MySetList(object):
  
  def __init__(self):
  self._set = []
  
  def add(self, el):
  if el not in self._set:
  self._set.append(el)
  
  # implementation of other typical set functions
#+end_src

#+begin_src python :session :tangle myset.py :results silent
  class MySetDict(object):
  
  def __init__(self):
  self._dic = {}
  
  def add(self, el):
  if el not in self._dic:
  # we only care about the keys
  self._dic[el] = None
#+end_src

#+begin_src python :session :tangle myset.py :results silent
  class MySetSet(object):
  def __init__(self):
  self._set = set()
  
  def add(self, el):
  self._set.add(el)
#+end_src


#+begin_src python :session :exports both :tangle myset.py
  import timeit
  import random
  
  NUM_ELS = 100
  
  
  def add_many_to_set(set_type):
  m = set_type()
  for i in range(NUM_ELS):
  m.add(i)
  
  
  def test_impl(set_type):
  to_import = """
  from __main__ import add_many_to_set
  from __main__ import %s"""
  
  name = set_type.__name__
  print("testing %s" % name)
  return timeit.timeit("add_many_to_set(%s)" % name,
   setup=(to_import % name))
  
  
  test_impl(MySetList), test_impl(MySetDict), test_impl(MySetSet)
  
#+end_src
--8<---cut here---end--->8---



Re: [O] [bug] [babel] fontification of source code blocks lost if using #+header(s)

2011-07-03 Thread Eric S Fraga
Eric Schulte  writes:

> Hi Eric,
>
> Thanks for pointing this out, I've just pushed up a patch which should
> fix this fontificaiton.  Please let me know if something is not
> working.

Thanks Eric.  Seems to be working just fine.
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.561.g9e7ef)



Re: [O] [babel] evaluating ledger source block now scans large number of org files

2011-07-03 Thread Eric S Fraga
Eric Schulte  writes:

> Hi Eric,
>
> Thanks for pointing this out.  IDs can be used to resolve code block
> references, however it appears that the `org-id-goto' function is
> attempting to re-scan all ID locations when a reference is not found.
> I've just pushed up a patch which side-steps this rescanning behavior.

Thanks.  This too seems to be working just fine now.
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.561.g9e7ef)



Re: [O] [babel] python sessions

2011-07-03 Thread Eric Schulte
Andrea Crotti  writes:

> Eric Schulte  writes:
>>
>> This is true, in addition to being a language which is dependent upon
>> whitespace characters, python has been tricky due to the many
>> independent inferior python modes (python.el, python-mode.el, etc...)
>> and to the fact that I personally and not very familiar with the
>> language.
>
> That is indeed a problem (also in cedet for example) and I really would
> like to have just one and working well python mode, not a thousand.. 
>

>From what I hear the situation should improve in Emacs24, as there is a
ground up re-write which should contain much of the functionality of
python-mode.el with the Emacs-amenable license of python.el.

>
>>
>> I've just pushed up a patch which should improve upon the python session
>> behavior.  After this patch your example returns the following
>> results...
>>
>> #+begin_src python :session :results silent
>>   def var(x):
>>   return float(x ** 2)
>> #+end_src
>>
>> #+begin_src python :session :result value
>>   def var2(x):
>>   return x ** 2 * var(x)
>>   
>>   var2(10)
>> #+end_src
>>
>> #+results:
>> : 1.0
>>
>
> That example now works like a charm
> But here still I get that string, but if I tangle the file I get the
> correct result, any idea?
>

The eoe string will only even appear in session output when there is no
other result returned by the code block.  I've just pushed up a small
change which should fix this situation.

The eoe will never appear in tangled code as it is part of the
interactive session evaluation.

Best -- Eric

>
> #+begin_src python :session :tangle myset.py :results silent
>   class MySetList(object):
>   
>   def __init__(self):
>   self._set = []
>   
>   def add(self, el):
>   if el not in self._set:
>   self._set.append(el)
>   
>   # implementation of other typical set functions
> #+end_src
>
> #+begin_src python :session :tangle myset.py :results silent
>   class MySetDict(object):
>   
>   def __init__(self):
>   self._dic = {}
>   
>   def add(self, el):
>   if el not in self._dic:
>   # we only care about the keys
>   self._dic[el] = None
> #+end_src
>
> #+begin_src python :session :tangle myset.py :results silent
>   class MySetSet(object):
>   def __init__(self):
>   self._set = set()
>   
>   def add(self, el):
>   self._set.add(el)
> #+end_src
>
>
> #+begin_src python :session :exports both :tangle myset.py
>   import timeit
>   import random
>   
>   NUM_ELS = 100
>   
>   
>   def add_many_to_set(set_type):
>   m = set_type()
>   for i in range(NUM_ELS):
>   m.add(i)
>   
>   
>   def test_impl(set_type):
>   to_import = """
>   from __main__ import add_many_to_set
>   from __main__ import %s"""
>   
>   name = set_type.__name__
>   print("testing %s" % name)
>   return timeit.timeit("add_many_to_set(%s)" % name,
>setup=(to_import % name))
>   
>   
>   test_impl(MySetList), test_impl(MySetDict), test_impl(MySetSet)
>   
> #+end_src

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



[O] Compiler warnings on current HEAD

2011-07-03 Thread Achim Gratz

I still get the following warnings w/ GNU Emacs 23.2.1 on the current
HEAD:

In org-footnote-all-labels:
org-footnote.el:336:62:Warning: reference to free variable `rtn'
org-footnote.el:352:74:Warning: assignment to free variable `rtn'

In org-footnote-normalize:
org-footnote.el:531:41:Warning: reference to free variable
`org-export-footnotes-seen'
org-footnote.el:568:19:Warning: org-fill-paragraph called with 0 arguments,
but requires 1
org-footnote.el:574:49:Warning: reference to free variable
`org-export-footnotes-data'
org-footnote.el:653:17:Warning: assignment to free variable
`org-export-footnotes-seen'

In end of data:
ob-ref.el:265:1:Warning: the following functions are not known to be defined:
org-id-find-id-in-file, org-show-context


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

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




Re: [O] [babel] python sessions

2011-07-03 Thread Andrea Crotti
Eric Schulte  writes:

>
> From what I hear the situation should improve in Emacs24, as there is a
> ground up re-write which should contain much of the functionality of
> python-mode.el with the Emacs-amenable license of python.el.
>

Nice to know, I use python-mode.el and emacs24, but I would vote for a
merge :)

>
> The eoe string will only even appear in session output when there is no
> other result returned by the code block.  I've just pushed up a small
> change which should fix this situation.
>
> The eoe will never appear in tangled code as it is part of the
> interactive session evaluation.
>
> Best -- Eric

I think the last patch created some problems, now it often (but not
always and I can't get why) when I execute the source block, and still I
can't make it work the previous example that I posted...

Thanks,
Andrea



Re: [O] Compiler warnings on current HEAD

2011-07-03 Thread Bastien
Hi Achim,

Achim Gratz  writes:

> I still get the following warnings w/ GNU Emacs 23.2.1 on the current
> HEAD:
>
> In org-footnote-all-labels:
> org-footnote.el:336:62:Warning: reference to free variable `rtn'
> org-footnote.el:352:74:Warning: assignment to free variable `rtn'
>
> In org-footnote-normalize:
> org-footnote.el:531:41:Warning: reference to free variable
> `org-export-footnotes-seen'
> org-footnote.el:568:19:Warning: org-fill-paragraph called with 0 arguments,
> but requires 1
> org-footnote.el:574:49:Warning: reference to free variable
> `org-export-footnotes-data'
> org-footnote.el:653:17:Warning: assignment to free variable
> `org-export-footnotes-seen'

Fixed, thanks!

> In end of data:
> ob-ref.el:265:1:Warning: the following functions are not known to be defined:
> org-id-find-id-in-file, org-show-context

Eric, could you fix those?

-- 
 Bastien



[O] OLUG talk about Org-mode

2011-07-03 Thread Carsten Dominik
Hi, 

I just saw this flying by on twitter:

George De Bruin is giving a talk about Emacs org-mode on July 5.  It will be 
streamed live - maybe someone can try to capture the stream (Don't know if the 
OLUG makes the video available afterwards)?

http://www.olug.org/2011/06/july-2011-olug-meeting/


- Carsten




[O] [PATCH] org-table.el: Calc formulas evaluate to #ERROR.

2011-07-03 Thread Maciek Starzyk
This fixes regression bug introduced in
2e20cf9358deb9579ae6a22bc0deb2a772387194

diff --git a/lisp/org-table.el b/lisp/org-table.el
index a7fc863..9724dc2 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -2513,13 +2513,13 @@ not overwrite the stored one."
(error "#ERROR"))
   ev (if (numberp ev) (number-to-string ev) ev)
   ev (if duration (org-table-time-seconds-to-string
-   (string-to-number ev
+   (string-to-number ev)) ev))
   (or (fboundp 'calc-eval)
   (error "Calc does not seem to be installed, and is needed to
evaluate the formula"))
   (setq ev (calc-eval (cons form modes)
   (if numbers 'num))
 ev (if duration (org-table-time-seconds-to-string
- (string-to-number ev)
+ (string-to-number ev)) ev)))

 (when org-table-formula-debug
   (with-output-to-temp-buffer "*Substitution History*"


-- 
Maciek Starzyk


Re: [O] OLUG talk about Org-mode

2011-07-03 Thread suvayu ali
Hi Carsten,

On Sun, Jul 3, 2011 at 10:16 PM, Carsten Dominik
 wrote:
> Hi,
>
> I just saw this flying by on twitter:
>
> George De Bruin is giving a talk about Emacs org-mode on July 5.  It will be 
> streamed live - maybe someone can try to capture the stream (Don't know if 
> the OLUG makes the video available afterwards)?
>
> http://www.olug.org/2011/06/july-2011-olug-meeting/
>

If you look at the related videos at the bottom of the ustream page,
you can see there are recorded sessions of past talks. So maybe it
will be recorded automatically.

>
> - Carsten
>

-- 
Suvayu

Open source is the future. It sets us free.



[O] Link to original Org file with batch mode

2011-07-03 Thread Giorgio Valoti
Hi,
when I try to tangle files in batch mode, using a command like this:

emacs -batch ~/Developer/PROJECTS/gmp/project.org --eval="(org-babel-tangle)"

the resulting files do not have links to the original file, i.e.:



while if I tangle from emacs I get this, as expected:



Is there a way to generate links in batch mode? Or perhaps should I use a 
different way to invoke tangling from the command line?

Thank you in advance


--
Giorgio Valoti