[O] Re: [Orgmode] [babel] [PATCH]

2011-03-02 Thread Martyn Jago
Eric Schulte schulte.e...@gmail.com writes:

[...]

 Also, I'm really pleased that you are looking into the test suite.  I do
 believe that a well maintained test suite would be a huge boon, both for
 Babel and for Org-mode at large, however, recently I have only had
 enough time to respond to issues raised on the mailing list, and haven't
 had the time needed to maintain the test suite---I know, I should be
 responding to mailing list issues by writing tests for all of the new
 development, but it hasn't yet integrated into my work flow.

 Best -- Eric


Hi Eric 

I appreciate you are very busy. I'm happy to build the test suite up
since I'm familiar with ERT and believe in testing. Its also a great way
to learn how org fits together! 

Regards

Martyn

[...]

---
Org-mode version 7.4 (release_7.4.581.g84dfb)
GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0)
 of 2011-02-25 


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


[O] Re: [Orgmode] [babel] [PATCH]

2011-03-02 Thread Eric Schulte
Martyn Jago martyn.j...@btinternet.com writes:

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

 [...]

 Also, I'm really pleased that you are looking into the test suite.  I do
 believe that a well maintained test suite would be a huge boon, both for
 Babel and for Org-mode at large, however, recently I have only had
 enough time to respond to issues raised on the mailing list, and haven't
 had the time needed to maintain the test suite---I know, I should be
 responding to mailing list issues by writing tests for all of the new
 development, but it hasn't yet integrated into my work flow.

 Best -- Eric


 Hi Eric 

 I appreciate you are very busy. I'm happy to build the test suite up
 since I'm familiar with ERT and believe in testing. Its also a great way
 to learn how org fits together! 


FANTASTIC! much appreciated, I think the entire community of Babel users
will benefit from increased application of the unit tests.

If you ever feel the need for test suite fodder, I maintain a file of
small examples generated from my mailing list responses and development.
See https://github.com/eschulte/babel-dev/raw/master/scraps.org

Cheers -- Eric


 Regards

 Martyn

 [...]

 ---
 Org-mode version 7.4 (release_7.4.581.g84dfb)
 GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0)
  of 2011-02-25 

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


[O] Re: [Orgmode] [babel] [PATCH]

2011-03-01 Thread Eric Schulte
Martyn Jago martyn.j...@btinternet.com writes:

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

 Hi Eric

 Hi Martyn,

 Thanks for this patch and for the very nice test file, I've just applied
 it along with a related patch in org-exp-blocks.el.

 Even with the patch applied I am still seeing undesirable behavior when
 exporting the test file.  I believe this is due to upstream processing
 of the blocks by the rest of org-mode, as the buffer *after* org-mode
 processing looks like this [1]

 Thanks -- Eric


 Thanks. That works great. One thing - I'm not seeing any undesirable
 behaviour that you mentioned - am I missing something?


I don't have time to test this out again right now, but if you see no
smoke, I'm happy to call no fire. :)


   git format-patch -o ~/Desktop/ HEAD~1

 Thanks for the tip - also, apologies for the 'too short' title (hope I
 didn't start anything ;) - I'm still getting used to gnus!

 One other thing, I've just been trying to get the tests running, and
 most of them are, but the noweb test is failing and I don't understand
 why. Has the noweb argument changed in any way...

 This doesn't expand on export to html and therefore fails the tests...


I don't believe that there have been any recent changes to the noweb
syntax, and the example below should indeed expand---and does for me
when interactively evaluated.  I'm not sure what needs to be changed for
the test to pass...

Also, I'm really pleased that you are looking into the test suite.  I do
believe that a well maintained test suite would be a huge boon, both for
Babel and for Org-mode at large, however, recently I have only had
enough time to respond to issues raised on the mailing list, and haven't
had the time needed to maintain the test suite---I know, I should be
responding to mailing list issues by writing tests for all of the new
development, but it hasn't yet integrated into my work flow.

Best -- Eric



 #+source: noweb-example
 #+begin_src emacs-lisp
   (message expanded)
 #+end_src

 #+begin_src emacs-lisp :noweb yes
   ;; noweb-yes-start
   noweb-example
   ;; noweb-yes-end
 #+end_src


 Regards

 Martyn


 will output a patch file to your desktop holding your last committed
 change.  This would allow me to more easily apply your patches, and will
 ensure that you get authorship credit in the git logs.

 Martyn Jago martyn.j...@btinternet.com writes:

 Hi Babel

 [...]

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

 Footnotes: 
 [1]  buffer *after* org-mode processing
 ,
 | ** new block regexp tests
 | *** Block 1 (Exports OK)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | Block 1
 | #+END_SRC
 | 
 | *** Block 2 (Exports OK - double blank line no white-space in Block)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | 
 | 
 | #+END_SRC
 | 
 | *** Block 3 (Fails - single blank line no white-space in Block)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | 
 | #+END_SRC
 | 
 | *** Block 4 (Gets consumed by previous Block)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | Block 4
 | #+END_SRC
 | 
 | *** Block 5 (Fails - no lines in Block)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | #+END_SRC
 | 
 | *** Block 6 (Gets consumed by previous Block
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | Block 6
 | #+END_SRC
 `



 ---
 Org-mode version 7.4 (release_7.4.529.gb23d)
 GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0)
  of 2011-02-25 

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


[O] Re: [Orgmode] [babel] [PATCH]

2011-02-28 Thread Martyn Jago
Eric Schulte schulte.e...@gmail.com writes:

Hi Eric

 Hi Martyn,

 Thanks for this patch and for the very nice test file, I've just applied
 it along with a related patch in org-exp-blocks.el.

 Even with the patch applied I am still seeing undesirable behavior when
 exporting the test file.  I believe this is due to upstream processing
 of the blocks by the rest of org-mode, as the buffer *after* org-mode
 processing looks like this [1]

 Thanks -- Eric


Thanks. That works great. One thing - I'm not seeing any undesirable
behaviour that you mentioned - am I missing something?

   git format-patch -o ~/Desktop/ HEAD~1

Thanks for the tip - also, apologies for the 'too short' title (hope I
didn't start anything ;) - I'm still getting used to gnus!

One other thing, I've just been trying to get the tests running, and
most of them are, but the noweb test is failing and I don't understand
why. Has the noweb argument changed in any way...

This doesn't expand on export to html and therefore fails the tests...

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

#+source: noweb-example
#+begin_src emacs-lisp
  (message expanded)
#+end_src

#+begin_src emacs-lisp :noweb yes
  ;; noweb-yes-start
  noweb-example
  ;; noweb-yes-end
#+end_src

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

Regards

Martyn


 will output a patch file to your desktop holding your last committed
 change.  This would allow me to more easily apply your patches, and will
 ensure that you get authorship credit in the git logs.

 Martyn Jago martyn.j...@btinternet.com writes:

 Hi Babel

[...]

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

 Footnotes: 
 [1]  buffer *after* org-mode processing
 ,
 | ** new block regexp tests
 | *** Block 1 (Exports OK)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | Block 1
 | #+END_SRC
 | 
 | *** Block 2 (Exports OK - double blank line no white-space in Block)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | 
 | 
 | #+END_SRC
 | 
 | *** Block 3 (Fails - single blank line no white-space in Block)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | 
 | #+END_SRC
 | 
 | *** Block 4 (Gets consumed by previous Block)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | Block 4
 | #+END_SRC
 | 
 | *** Block 5 (Fails - no lines in Block)
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | #+END_SRC
 | 
 | *** Block 6 (Gets consumed by previous Block
 | 
 | #+BEGIN_SRC sh :tangle test-out
 | Block 6
 | #+END_SRC
 `



---
Org-mode version 7.4 (release_7.4.529.gb23d)
GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0)
 of 2011-02-25 

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


Re: [Orgmode] [babel] [PATCH]

2011-02-27 Thread Eric Schulte
Hi Martyn,

Thanks for this patch and for the very nice test file, I've just applied
it along with a related patch in org-exp-blocks.el.

Even with the patch applied I am still seeing undesirable behavior when
exporting the test file.  I believe this is due to upstream processing
of the blocks by the rest of org-mode, as the buffer *after* org-mode
processing looks like this [1]

Thanks -- Eric

ps.  Now that you are signed up as an Org-mode contributor you could
start sending patches using the git format-patch utility, i.e.,

  git format-patch -o ~/Desktop/ HEAD~1

will output a patch file to your desktop holding your last committed
change.  This would allow me to more easily apply your patches, and will
ensure that you get authorship credit in the git logs.

Martyn Jago martyn.j...@btinternet.com writes:

 Hi Babel

 I've been working on an exporter and have come across some strange
 behaviour regarding 'empty' source blocks with regard to tangling.

 If an attempt is made to tangle a block containing two blank (no
 white-space) lines, the block is exported as carriage returns (as I
 would expect).

 If a block contains one or no blank lines, the #+end_src tag appears to
 be consumed by the block (along with subsequent text upto the next
 #+end_src tag).

 I tracked this down to the org-babel-src-block-regexp variable in ob.el
 and have modified it to give what appears to be consistent behaviour.

 I also found the following unresolved bug report which may be related...

 http://www.mail-archive.com/emacs-orgmode@gnu.org/msg29992.html

 I've included a simple test file, and resultant tangled files before and
 after the patch to attempt to convey the problem.

 NOTE: Since the patch itself modifies a defvar, and since I'm not clear
 on how a patched defvar should be updated downstream, the patch includes a
 setq statement to update the defvar org-babel-src-block-regexp for test
 purposes. The patch cannot therefore be applied as is.


 * Empty Block Tangle Test
 ** Typical Execution

 #+BEGIN_SRC emacs-lisp :tangle no

 (org-babel-tangle) ; or org-babel-tangle-file empty-block.org

 #+END_SRC

 #+results:
 | test-out |

 ** Tests
 *** Block 1 (Exports OK)

 #+BEGIN_SRC sh :tangle test-out
 Block 1
 #+END_SRC

 *** Block 2 (Exports OK - double blank line no white-space in Block)

 #+BEGIN_SRC sh :tangle test-out


 #+END_SRC

 *** Block 3 (Fails - single blank line no white-space in Block)

 #+BEGIN_SRC sh :tangle test-out

 #+END_SRC

 *** Block 4 (Gets consumed by previous Block)

 #+BEGIN_SRC sh :tangle test-out
 Block 4
 #+END_SRC

 *** Block 5 (Fails - no lines in Block)

 #+BEGIN_SRC sh :tangle test-out
 #+END_SRC

 *** Block 6 (Gets consumed by previous Block

 #+BEGIN_SRC sh :tangle test-out
 Block 6
 #+END_SRC

 *** Block 7 (Exports OK)

 #+BEGIN_SRC sh :tangle test-out
 Block 7
 #+END_SRC

 ** List params
 #+begin_src emacs-lisp 
   (sort* (mapcar (lambda (x)
(list (car x) (cdr x)))
  params) 'string-lessp :key 'car)
 #+end_src

 #+results:
 | :cache | no|
 | :colname-names | nil   |
 | :colnames  | no|
 | :comments  |   |
 | :exports   | results   |
 | :hlines| yes   |
 | :noweb | no|
 | :result-params | (replace) |
 | :result-type   | value |
 | :results   | replace   |
 | :rowname-names | nil   |
 | :session   | none  |
 | :shebang   |   |
 | :tangle| test-out  |




 diff --git a/lisp/ob.el b/lisp/ob.el
 index 6e98263..6d2f0d0 100644
 --- a/lisp/ob.el
 +++ b/lisp/ob.el
 @@ -138,9 +138,20 @@ remove code block execution from the C-c C-c keybinding.
 ;; (4) header arguments
 \\([^\n]*\\)\n
 ;; (5) body
 -   \\([^\000]+?\n\\)[ \t]*#\\+end_src)
 +   \\([^\000]*?\n*\\)[ \t]*#\\+end_src)
Regexp used to identify code blocks.)
  
 +(setq org-babel-src-block-regexp
 +  (concat
 +   ;; (1) indentation (2) lang
 +   ^\\([ \t]*\\)#\\+begin_src[ \t]+\\([^ \f\t\n\r\v]+\\)[ \t]*
 +   ;; (3) switches
 +   \\([^\:\n]*\[^\\n*]*\[^\:\n]*\\|[^\:\n]*\\)
 +   ;; (4) header arguments
 +   \\([^\n]*\\)\n
 +   ;; (5) body
 +   \\([^\000]*?\n*\\)[ \t]*#\\+end_src))
 +
  (defvar org-babel-inline-src-block-regexp
(concat
 ;; (1) replacement target (2) lang

 Regards

 Martyn

 ---
 Org-mode version 7.4 (release_7.4.529.gb23d)
 GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0)
  of 2011-02-25 
 ___
 Emacs-orgmode mailing list
 Please use `Reply All' to send replies to the list.
 Emacs-orgmode@gnu.org
 http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Footnotes: 
[1]  buffer *after* org-mode processing
,
| ** new block regexp tests
| *** Block 1 (Exports OK)
| 
| #+BEGIN_SRC sh :tangle test-out
| Block 1
| #+END_SRC
| 
| *** Block 2 (Exports OK - double blank line no white-space in Block)
| 
| #+BEGIN_SRC sh :tangle test-out
| 
| 
| #+END_SRC
| 
| *** Block 3 (Fails - single blank line no 

[Orgmode] [babel] [PATCH]

2011-02-25 Thread Martyn Jago

Hi Babel

I've been working on an exporter and have come across some strange
behaviour regarding 'empty' source blocks with regard to tangling.

If an attempt is made to tangle a block containing two blank (no
white-space) lines, the block is exported as carriage returns (as I
would expect).

If a block contains one or no blank lines, the #+end_src tag appears to
be consumed by the block (along with subsequent text upto the next
#+end_src tag).

I tracked this down to the org-babel-src-block-regexp variable in ob.el
and have modified it to give what appears to be consistent behaviour.

I also found the following unresolved bug report which may be related...

http://www.mail-archive.com/emacs-orgmode@gnu.org/msg29992.html

I've included a simple test file, and resultant tangled files before and
after the patch to attempt to convey the problem.

NOTE: Since the patch itself modifies a defvar, and since I'm not clear
on how a patched defvar should be updated downstream, the patch includes a
setq statement to update the defvar org-babel-src-block-regexp for test
purposes. The patch cannot therefore be applied as is.


* Empty Block Tangle Test
** Typical Execution

#+BEGIN_SRC emacs-lisp :tangle no

(org-babel-tangle) ; or org-babel-tangle-file empty-block.org

#+END_SRC

#+results:
| test-out |

** Tests
*** Block 1 (Exports OK)

#+BEGIN_SRC sh :tangle test-out
Block 1
#+END_SRC

*** Block 2 (Exports OK - double blank line no white-space in Block)

#+BEGIN_SRC sh :tangle test-out


#+END_SRC

*** Block 3 (Fails - single blank line no white-space in Block)

#+BEGIN_SRC sh :tangle test-out

#+END_SRC

*** Block 4 (Gets consumed by previous Block)

#+BEGIN_SRC sh :tangle test-out
Block 4
#+END_SRC

*** Block 5 (Fails - no lines in Block)

#+BEGIN_SRC sh :tangle test-out
#+END_SRC

*** Block 6 (Gets consumed by previous Block

#+BEGIN_SRC sh :tangle test-out
Block 6
#+END_SRC

*** Block 7 (Exports OK)

#+BEGIN_SRC sh :tangle test-out
Block 7
#+END_SRC

** List params
#+begin_src emacs-lisp 
  (sort* (mapcar (lambda (x)
   (list (car x) (cdr x)))
 params) 'string-lessp :key 'car)
#+end_src

#+results:
| :cache | no|
| :colname-names | nil   |
| :colnames  | no|
| :comments  |   |
| :exports   | results   |
| :hlines| yes   |
| :noweb | no|
| :result-params | (replace) |
| :result-type   | value |
| :results   | replace   |
| :rowname-names | nil   |
| :session   | none  |
| :shebang   |   |
| :tangle| test-out  |



test-out-pre-patch
Description: test-out-pre-patch


test-out-post-patch
Description: test-out-post-patch
diff --git a/lisp/ob.el b/lisp/ob.el
index 6e98263..6d2f0d0 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -138,9 +138,20 @@ remove code block execution from the C-c C-c keybinding.
;; (4) header arguments
\\([^\n]*\\)\n
;; (5) body
-   \\([^\000]+?\n\\)[ \t]*#\\+end_src)
+   \\([^\000]*?\n*\\)[ \t]*#\\+end_src)
   Regexp used to identify code blocks.)
 
+(setq org-babel-src-block-regexp
+  (concat
+   ;; (1) indentation (2) lang
+   ^\\([ \t]*\\)#\\+begin_src[ \t]+\\([^ \f\t\n\r\v]+\\)[ \t]*
+   ;; (3) switches
+   \\([^\:\n]*\[^\\n*]*\[^\:\n]*\\|[^\:\n]*\\)
+   ;; (4) header arguments
+   \\([^\n]*\\)\n
+   ;; (5) body
+   \\([^\000]*?\n*\\)[ \t]*#\\+end_src))
+
 (defvar org-babel-inline-src-block-regexp
   (concat
;; (1) replacement target (2) lang

Regards

Martyn

---
Org-mode version 7.4 (release_7.4.529.gb23d)
GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0)
 of 2011-02-25 
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [babel][patch] C++ inconsistencies

2011-02-18 Thread Martyn Jago

Hi

I've noticed a couple of minor inconsistencies with C++ export...

 - According to the Org manual (section 14.7 Languages) the identifier
   for C++ is C++ (upper-case), but in practice this fails and the
   identifier c++ (lower-case) must be used. In general, identifiers
   appear to be lower-case words or upper-case single characters (such
   as C and R) so perhaps this is a bug?

 - Within org-babel cpp is used to identify C++, however using cpp as an
   identifier actually exports as if it were a C block. 

If it is desired the following patch changes the C++ identifier to C++,
and maps cpp identifier also to C++, although perhaps it is better to
maintain c++ also for backward compatibility?

Regards

Martyn


diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index da0e768..86ec783 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -56,10 +56,10 @@ is currently being evaluated.)
 
 (defun org-babel-execute:cpp (body params)
   Execute BODY according to PARAMS.  This function calls
-`org-babel-execute:C'.
-  (org-babel-execute:C body params))
+`org-babel-execute:C++'.
+  (org-babel-execute:C++ body params))
 
-(defun org-babel-execute:c++ (body params)
+(defun org-babel-execute:C++ (body params)
 Execute a block of C++ code with org-babel.  This function is
 called by `org-babel-execute-src-block'.
   (let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))


---

Org-mode version 7.4
GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.0) of
2011-02-18



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


Re: [Orgmode] [Babel] Patch for adding Microsoft's osql command-line utility

2010-12-05 Thread Eric Schulte
Hi Seb,

Thanks for the patch, this has just been applied.

-- Eric

Sébastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric,

 Here a patch for osql from Microsoft.

 diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
 index 19c271d..9e6f06a 100644
 --- a/lisp/ob-sql.el
 +++ b/lisp/ob-sql.el
 @@ -66,6 +66,10 @@ This function is called by `org-babel-execute-src-block'.
   (out-file (or (cdr (assoc :out-file params))
 (org-babel-temp-file sql-out-)))
   (command (case (intern engine)
 +('msosql (format osql %s -s \\t\ -i %s -o %s
 + (or cmdline )
 + (org-babel-process-file-name in-file)
 + (org-babel-process-file-name out-file)))
  ('mysql (format mysql %s -e \source %s\  %s
  (or cmdline )
   (org-babel-process-file-name in-file)

 Best regards,
   Seb

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


[Orgmode] [Babel] Patch for adding Microsoft's osql command-line utility

2010-12-03 Thread Sébastien Vauban
Hi Eric,

Here a patch for osql from Microsoft.

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 19c271d..9e6f06a 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -66,6 +66,10 @@ This function is called by `org-babel-execute-src-block'.
  (out-file (or (cdr (assoc :out-file params))
(org-babel-temp-file sql-out-)))
  (command (case (intern engine)
+('msosql (format osql %s -s \\t\ -i %s -o %s
+ (or cmdline )
+ (org-babel-process-file-name in-file)
+ (org-babel-process-file-name out-file)))
 ('mysql (format mysql %s -e \source %s\  %s
 (or cmdline )
 (org-babel-process-file-name in-file)

Best regards,
  Seb

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


Re: [Orgmode] [Babel] Patch for Evaluation aborted

2010-11-25 Thread Eric Schulte
Hi Seb,

Nice idea, I've just pushed up a patch which improves this message.

Best -- Eric

Sébastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric and Dan,

 I was puzzled this morning by a message evalution aborted without any extra
 info. Aborted made me think there was an error, so I toggle debug-on-error,
 but it did not give me any more insight on the problem.

 After searching for the message in the code base, I found it in =ob.el= and
 understood it was when eval was disabled (set to =no= or =never=).

 In this case, I would ask for a clearer message:

 diff --git a/lisp/ob.el b/lisp/ob.el
 index 584d627..5bb0d5c 100644
 --- a/lisp/ob.el
 +++ b/lisp/ob.el
 @@ -219,7 +219,7 @@ of potentially harmful code.
(not (yes-or-no-p
  (format Evaluate this%scode on your system? 
  (if info (format  %s  (nth 0 info))  ))
 - (prog1 nil (message evaluation aborted))
 + (prog1 nil (message Evaluation disabled by user (option).))
t)))
  
  ;;;###autoload

 Feel free to change it to something better, but, in any case, I'd prefer
 disabled over aborted. At least in my mind, disabled is not related to
 error, while aborted is (in my mind, or in my Frenglish).

 Best regards,
   Seb

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


[Orgmode] [Babel] Patch for Evaluation aborted

2010-11-24 Thread Sébastien Vauban
Hi Eric and Dan,

I was puzzled this morning by a message evalution aborted without any extra
info. Aborted made me think there was an error, so I toggle debug-on-error,
but it did not give me any more insight on the problem.

After searching for the message in the code base, I found it in =ob.el= and
understood it was when eval was disabled (set to =no= or =never=).

In this case, I would ask for a clearer message:

--8---cut here---start-8---
diff --git a/lisp/ob.el b/lisp/ob.el
index 584d627..5bb0d5c 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -219,7 +219,7 @@ of potentially harmful code.
 (not (yes-or-no-p
   (format Evaluate this%scode on your system? 
   (if info (format  %s  (nth 0 info))  ))
-   (prog1 nil (message evaluation aborted))
+   (prog1 nil (message Evaluation disabled by user (option).))
   t)))
 
 ;;;###autoload
--8---cut here---end---8---

Feel free to change it to something better, but, in any case, I'd prefer
disabled over aborted. At least in my mind, disabled is not related to
error, while aborted is (in my mind, or in my Frenglish).

Best regards,
  Seb

-- 
Sébastien Vauban


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


Re: [Orgmode] [babel][PATCH] org-babel-asymptote now handles variables.

2010-06-04 Thread Eric Schulte
Hi Nicolas,

Nicolas Goaziou n.goaz...@gmail.com writes:

 Eric Schulte writes:

 This patch looks great!

 Thank you.


I just applied this patch.  Thanks again for the contribution.


 Thanks for the contribution. However before I apply this patch, can
 I ask, have you signed the FSF papers.

 It is on it's way : I've already received their confirmation email and
 the papers I have to sign should arrive soon. So, I guess the whole
 process should take a week or two from now.


Sounds good, please let me know when this is complete.

Best -- Eric


 Regards,

 --
 Nicolas

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


Re: [Orgmode] [babel][PATCH] org-babel-asymptote now handles variables.

2010-06-02 Thread Eric Schulte
Hi Nicolas,

This patch looks great!  Thanks for the contribution.  However before I
apply this patch, can I ask, have you signed the FSF papers.

As org-babel is being incorporated into the core of Org-mode and will be
considered part of Emacs we need authors of any contributions longer
than 10 lines to sign the FSF papers.

http://orgmode.org/worg/org-contribute.php

Thanks -- Eric

Nicolas Goaziou n.goaz...@gmail.com writes:

 Hello,

 Here is a patch to allow the use of variables in org-babel-asymptote.
 Types integer, string, symbol (treated as string) float and any table
 of those are recognized.

 Thanks,

 - Nicolas

 diff --git a/contrib/babel/lisp/langs/org-babel-asymptote.el 
 b/contrib/babel/lisp/langs/org-babel-asymptote.el
 index 59ca291..eed1a87 100644
 --- a/contrib/babel/lisp/langs/org-babel-asymptote.el
 +++ b/contrib/babel/lisp/langs/org-babel-asymptote.el
 @@ -37,8 +37,6 @@
  ;; 3) we are adding the file and cmdline header arguments, if file
  ;;is omitted then the -V option is passed to the asy command for
  ;;interactive viewing
 -;;
 -;; 4) there are no variables (at least for now)
  
  ;;; Requirements:
  
 @@ -56,13 +54,17 @@
  (defvar org-babel-default-header-args:asymptote '((:results . file) 
 (:exports . results))
Default arguments to use when evaluating a asymptote source block.)
  
 -(defun org-babel-expand-body:asymptote (body params optional 
 processed-params) body)
 +(defun org-babel-expand-body:asymptote (body params optional 
 processed-params)
 +  (let ((vars (second (or processed-params
 +  (org-babel-process-params params)
 +(concat (mapconcat 'org-babel-asymptote-var-to-asymptote vars \n) \n 
 body \n)))
  
  (defun org-babel-execute:asymptote (body params)
Execute a block of Asymptote code with org-babel.  This function is
  called by `org-babel-execute-src-block'.
(message executing Asymptote source code block)
 -  (let* ((result-params (split-string (or (cdr (assoc :results params)) )))
 +  (let* ((processed-params (org-babel-process-params params))
 + (result-params (split-string (or (cdr (assoc :results params)) )))
   (out-file (cdr (assoc :file params)))
   (format (or (and out-file
(string-match .+\\.\\(.+\\) out-file)
 @@ -75,12 +77,76 @@ called by `org-babel-execute-src-block'.
(concat -globalwrite -f  format  -o  out-file)
  -V)
  cmdline   in-file)))
 -(with-temp-file in-file (insert body))
 +(with-temp-file in-file (insert (org-babel-expand-body:asymptote body 
 params processed-params)))
  (message cmd) (shell-command cmd)
  out-file))
  
  (defun org-babel-prep-session:asymptote (session params)
(error Asymptote does not support sessions))
  
 +(defun org-babel-asymptote-var-to-asymptote (pair)
 +  Convert an elisp val into a string of asymptote code specifying a var
 +of the same value.
 +  (let ((var (car pair))
 +(val (if (symbolp (cdr pair))
 + (symbol-name (cdr pair))
 +   (cdr pair
 +(cond
 + ((integerp val)
 +  (format int %S=%S; var val))
 + ((floatp val)
 +  (format real %S=%S; var val))
 + ((stringp val)
 +  (format string %S=\%s\; var val))
 + ((listp val)
 +  (let* ((dimension-2-p (not (null (cdr val
 + (dim (if dimension-2-p [][] []))
 + (type (org-babel-asymptote-define-type val))
 + (array (org-babel-asymptote-table-to-array
 + val
 + (if dimension-2-p '(:lstart { :lend }, :llend 
 })
 +(format %S%s %S=%s; type dim var array))
 +
 +(defun org-babel-asymptote-table-to-array (table params)
 +  Convert values of an elisp table into a string of an asymptote array.
 +Empty cells are ignored.
 +  (labels ((atom-to-string (table)
 +   (cond
 +((null table) '())
 +((not (listp (car table)))
 + (cons (if (and (stringp (car table))
 +(not (string= (car table) )))
 +   (format \%s\ (car table))
 + (format %s (car table)))
 +   (atom-to-string (cdr table
 +(t
 + (cons (atom-to-string (car table))
 +   (atom-to-string (cdr table))
 +   ;; Remove any empty row
 +   (fix-empty-lines (table)
 +(delq nil (mapcar (lambda (l) (delq  l)) 
 table
 +(orgtbl-to-generic
 + (fix-empty-lines (atom-to-string table))
 + (org-combine-plists '(:hline nil :sep , :tstart { :tend }) 
 params
 +
 +(defun org-babel-asymptote-define-type (data)
 +  Determine type of DATA. DATA is a list.
 +Type 

Re: [Orgmode] [babel][PATCH] org-babel-asymptote now handles variables.

2010-06-02 Thread Nicolas Goaziou
 Eric Schulte writes:

 This patch looks great!

Thank you.

 Thanks for the contribution. However before I apply this patch, can
 I ask, have you signed the FSF papers.

It is on it's way : I've already received their confirmation email and
the papers I have to sign should arrive soon. So, I guess the whole
process should take a week or two from now.

Regards,

--
Nicolas

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


[Orgmode] [babel] [PATCH] org-babel-asymptote now handles variables

2010-05-30 Thread Nicolas Goaziou
Hello,

This patch makes org-babel-asymptote handle variables. Types integer,
string, symbol (treated as strings), float, and any list of those are
supported.

- Nicolas

  

org-babel-asymptote.patch
Description: Binary data
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [babel][PATCH] org-babel-asymptote now handles variables.

2010-05-30 Thread Nicolas Goaziou
Hello,

Here is a patch to allow the use of variables in org-babel-asymptote.
Types integer, string, symbol (treated as string) float and any table
of those are recognized.

Thanks,

- Nicolas

diff --git a/contrib/babel/lisp/langs/org-babel-asymptote.el 
b/contrib/babel/lisp/langs/org-babel-asymptote.el
index 59ca291..eed1a87 100644
--- a/contrib/babel/lisp/langs/org-babel-asymptote.el
+++ b/contrib/babel/lisp/langs/org-babel-asymptote.el
@@ -37,8 +37,6 @@
 ;; 3) we are adding the file and cmdline header arguments, if file
 ;;is omitted then the -V option is passed to the asy command for
 ;;interactive viewing
-;;
-;; 4) there are no variables (at least for now)
 
 ;;; Requirements:
 
@@ -56,13 +54,17 @@
 (defvar org-babel-default-header-args:asymptote '((:results . file) 
(:exports . results))
   Default arguments to use when evaluating a asymptote source block.)
 
-(defun org-babel-expand-body:asymptote (body params optional 
processed-params) body)
+(defun org-babel-expand-body:asymptote (body params optional processed-params)
+  (let ((vars (second (or processed-params
+  (org-babel-process-params params)
+(concat (mapconcat 'org-babel-asymptote-var-to-asymptote vars \n) \n 
body \n)))
 
 (defun org-babel-execute:asymptote (body params)
   Execute a block of Asymptote code with org-babel.  This function is
 called by `org-babel-execute-src-block'.
   (message executing Asymptote source code block)
-  (let* ((result-params (split-string (or (cdr (assoc :results params)) )))
+  (let* ((processed-params (org-babel-process-params params))
+ (result-params (split-string (or (cdr (assoc :results params)) )))
  (out-file (cdr (assoc :file params)))
  (format (or (and out-file
   (string-match .+\\.\\(.+\\) out-file)
@@ -75,12 +77,76 @@ called by `org-babel-execute-src-block'.
   (concat -globalwrite -f  format  -o  out-file)
 -V)
 cmdline   in-file)))
-(with-temp-file in-file (insert body))
+(with-temp-file in-file (insert (org-babel-expand-body:asymptote body 
params processed-params)))
 (message cmd) (shell-command cmd)
 out-file))
 
 (defun org-babel-prep-session:asymptote (session params)
   (error Asymptote does not support sessions))
 
+(defun org-babel-asymptote-var-to-asymptote (pair)
+  Convert an elisp val into a string of asymptote code specifying a var
+of the same value.
+  (let ((var (car pair))
+(val (if (symbolp (cdr pair))
+ (symbol-name (cdr pair))
+   (cdr pair
+(cond
+ ((integerp val)
+  (format int %S=%S; var val))
+ ((floatp val)
+  (format real %S=%S; var val))
+ ((stringp val)
+  (format string %S=\%s\; var val))
+ ((listp val)
+  (let* ((dimension-2-p (not (null (cdr val
+ (dim (if dimension-2-p [][] []))
+ (type (org-babel-asymptote-define-type val))
+ (array (org-babel-asymptote-table-to-array
+ val
+ (if dimension-2-p '(:lstart { :lend }, :llend })
+(format %S%s %S=%s; type dim var array))
+
+(defun org-babel-asymptote-table-to-array (table params)
+  Convert values of an elisp table into a string of an asymptote array.
+Empty cells are ignored.
+  (labels ((atom-to-string (table)
+   (cond
+((null table) '())
+((not (listp (car table)))
+ (cons (if (and (stringp (car table))
+(not (string= (car table) )))
+   (format \%s\ (car table))
+ (format %s (car table)))
+   (atom-to-string (cdr table
+(t
+ (cons (atom-to-string (car table))
+   (atom-to-string (cdr table))
+   ;; Remove any empty row
+   (fix-empty-lines (table)
+(delq nil (mapcar (lambda (l) (delq  l)) 
table
+(orgtbl-to-generic
+ (fix-empty-lines (atom-to-string table))
+ (org-combine-plists '(:hline nil :sep , :tstart { :tend }) 
params
+
+(defun org-babel-asymptote-define-type (data)
+  Determine type of DATA. DATA is a list.
+Type symbol is returned as 'symbol. The type is usually the type
+of the first atom encountered, except for arrays of int where
+every cell must be of int type.
+  (labels ((anything-but-int (el)
+ (cond
+  ((null el) nil)
+  ((not (listp (car el)))
+   (cond
+((floatp (car el)) 'real)
+((stringp (car el)) 'string)
+(t
+