[O] ob-sed-test failure introduced by f38f83b4

2016-07-11 Thread Achim Gratz

Two of the three ob-sed tests are failing after commit f38f83b4, but
only in batch mode.  It seems the final newline gets eaten somewhere,
leading to the string= howling in protest.  When I run the code in
question interactively, it works as expected (result shown in minibuffer
is a string _with_ the final newline).  I can't figure out why the
particular commit is having that effect, but it seems to have changed
some accidental setting that the sed tests were relying on.

--8<---cut here---start->8---
Test ob-sed-test/in-file-header-argument condition:
(ert-test-failed
 ((should
   (string= "A tested file.
"
(org-babel-execute-src-block)))
  :form
  (string= "A tested file.
" "A tested file.")
  :value nil))
   FAILED  2/3  ob-sed-test/in-file-header-argument
--8<---cut here---end--->8---

--8<---cut here---start->8---
Test ob-sed-test/simple-execution-of-script condition:
(ert-test-failed
 ((should
   (string= "A processed sentence.
"
(org-babel-execute-src-block)))
  :form
  (string= "A processed sentence.
" "A processed sentence.")
  :value nil))
   FAILED  3/3  ob-sed-test/simple-execution-of-script
--8<---cut here---end--->8---


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

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




Re: [O] ob-sed

2015-05-30 Thread Nick Dokos
Bjarte Johansen bjarte.johan...@infomedia.uib.no writes:

 On 30 May 2015, at 14:32, Nicolas Goaziou m...@nicolasgoaziou.fr wrote:
 
 Bjarte Johansen bjarte.johan...@infomedia.uib.no writes:
 
 I think I have addressed all of your comments except I didn’t
 understand the comment about the spaces. Are there two spaces extra or
 do you want me to introduce two spaces somewhere?
 
 As Suvayu Ali pointed out, sentences in comments and docstrings are
 expected to be separated by two spaces (american english convention).
 I was not aware of this convention. I also don’t really understand it, but I 
 will change it.


It dates from the typewriter era (as does the convention of double
spacing). In that context, it makes the visual detection of the end of
the sentence easier. But the real reason to follow it now is that the
emacs sentence commands use the convention to determine what a sentence
is.  See

(info (emacs) sentences)

Nick




Re: [O] ob-sed

2015-05-30 Thread Nicolas Goaziou
Bjarte Johansen bjarte.johan...@infomedia.uib.no writes:

 I think I have addressed all of your comments except I didn’t
 understand the comment about the spaces. Are there two spaces extra or
 do you want me to introduce two spaces somewhere?

As Suvayu Ali pointed out, sentences in comments and docstrings are
expected to be separated by two spaces (american english convention).

Also, is the following line

 +(require 'sed-mode)

really needed? AFAICT there is no such mode in Emacs tree.


Regards,



Re: [O] ob-sed

2015-05-30 Thread Bjarte Johansen

 On 30 May 2015, at 14:32, Nicolas Goaziou m...@nicolasgoaziou.fr wrote:
 
 Bjarte Johansen bjarte.johan...@infomedia.uib.no writes:
 
 I think I have addressed all of your comments except I didn’t
 understand the comment about the spaces. Are there two spaces extra or
 do you want me to introduce two spaces somewhere?
 
 As Suvayu Ali pointed out, sentences in comments and docstrings are
 expected to be separated by two spaces (american english convention).
I was not aware of this convention. I also don’t really understand it, but I 
will change it.

 Also, is the following line
 
 +(require 'sed-mode)
 
 really needed? AFAICT there is no such mode in Emacs tree.

No. It is not. I have removed it.



0001-Org-Babel-now-supports-sed-scripts.patch
Description: Binary data


Re: [O] ob-sed

2015-05-30 Thread Nicolas Goaziou
Bjarte Johansen bjarte.johan...@infomedia.uib.no writes:

 From 3efecb4b439d357b30acb67ad5327fec987f76da Mon Sep 17 00:00:00 2001
 From: Bjarte Johansen bjarte.johan...@gmail.com
 Date: Thu, 28 May 2015 13:29:09 +0200
 Subject: [PATCH] Org Babel now supports sed scripts

Applied. Thank you.


Regards,



Re: [O] ob-sed

2015-05-29 Thread Nicolas Goaziou
Bjarte Johansen bjarte.johan...@infomedia.uib.no writes:

 I think I have addressed all your comments in the attached patch.

Thank you. Some more comments follow.

 Subject: [PATCH] Org Babel now supports sed scripts

You should add something like the following to your commit message:

  * doc/org.texi: Signal new Babel language

  * lisp/ob-sed.el:
  * testing/examples/ob-sed-test.org:
  * testing/lisp/test-ob-sed.el: New files.

 -@item GNU Screen @tab screen @tab shell @tab sh 
 -@item SQL @tab sql @tab SQLite @tab sqlite
 +@item GNU Screen @tab screen Sed @tab sed
 +@item @tab shell @tab sh @item SQL @tab sql
 +@item @tab SQLite @tab sqlite @tab @tab

This looks wrong. I think it should be:

  @item GNU Screen @tab screen @tab Sed @tab sed
  @item shell @tab sh @tab SQL @tab sql
  @item SQLite @tab sqlite @tab @tab

 +;;; Usage:
 +
 +;; Add to your Emacs config:
 +
 +;; (org-babel-do-load-languages
 +;;  'org-babel-load-languages
 +;;  '((sed . t)))

You may want to introduce usage for :cmd-line and :in-file arguments in
Usage section.

 +(defconst org-babel-header-args:sed
 +  '((:cmd-line :any
 + :in-file  :any))
 +  Sed specific header arguments.)

It should be

  '((:cmd-line . :any)
(:in-file  . :any))

See, for example `org-babel-header-args:R'

 +(defun org-babel-execute:sed (body params)
 +  Execute a block of sed code with Org Babel.
 +BODY is the source inside a sed source block and PARAMS is an
 +association list over the source block configurations. This
^^^
 two spaces


Regards,



Re: [O] ob-sed

2015-05-29 Thread Bjarte Johansen
I think I have addressed all of your comments except I didn’t understand the 
comment about the spaces. Are there two spaces extra or do you want me to 
introduce two spaces somewhere?

I have attached the updated patch.

Regards,
Bjarte



0001-Org-Babel-now-supports-sed-scripts.patch
Description: Binary data




 On 29 May 2015, at 11:00, Nicolas Goaziou m...@nicolasgoaziou.fr wrote:
 
 Bjarte Johansen bjarte.johan...@infomedia.uib.no writes:
 
 I think I have addressed all your comments in the attached patch.
 
 Thank you. Some more comments follow.
 
 Subject: [PATCH] Org Babel now supports sed scripts
 
 You should add something like the following to your commit message:
 
  * doc/org.texi: Signal new Babel language
 
  * lisp/ob-sed.el:
  * testing/examples/ob-sed-test.org:
  * testing/lisp/test-ob-sed.el: New files.
 
 -@item GNU Screen @tab screen @tab shell @tab sh 
 -@item SQL @tab sql @tab SQLite @tab sqlite
 +@item GNU Screen @tab screen Sed @tab sed
 +@item @tab shell @tab sh @item SQL @tab sql
 +@item @tab SQLite @tab sqlite @tab @tab
 
 This looks wrong. I think it should be:
 
  @item GNU Screen @tab screen @tab Sed @tab sed
  @item shell @tab sh @tab SQL @tab sql
  @item SQLite @tab sqlite @tab @tab
 
 +;;; Usage:
 +
 +;; Add to your Emacs config:
 +
 +;; (org-babel-do-load-languages
 +;;  'org-babel-load-languages
 +;;  '((sed . t)))
 
 You may want to introduce usage for :cmd-line and :in-file arguments in
 Usage section.
 
 +(defconst org-babel-header-args:sed
 +  '((:cmd-line :any
 + :in-file  :any))
 +  Sed specific header arguments.)
 
 It should be
 
  '((:cmd-line . :any)
(:in-file  . :any))
 
 See, for example `org-babel-header-args:R'
 
 +(defun org-babel-execute:sed (body params)
 +  Execute a block of sed code with Org Babel.
 +BODY is the source inside a sed source block and PARAMS is an
 +association list over the source block configurations. This
^^^
 two spaces
 
 
 Regards,



Re: [O] ob-sed

2015-05-29 Thread Suvayu Ali
Hi Bjarte,

On Fri, May 29, 2015 at 03:32:51PM +0200, Bjarte Johansen wrote:
  
  +(defun org-babel-execute:sed (body params)
  +  Execute a block of sed code with Org Babel.
  +BODY is the source inside a sed source block and PARAMS is an
  +association list over the source block configurations. This
 ^^^
  two spaces

I think Nicolas means there should be two spaces after the period after
configurations.  Something like this:

  configurations.  This

It is probably clearer to see, once you read his email in a fixed width
font.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] ob-sed

2015-05-28 Thread Bjarte Johansen
I think I have addressed all your comments in the attached patch.

Regards,
Bjarte




0001-Org-Babel-now-supports-sed-scripts.patch
Description: Binary data


Re: [O] ob-sed

2015-05-27 Thread Bjarte Johansen
I had loosely based it on my own ob-sparql and ob-awk, I saw that there was a 
remnant of ob-sparql left in there. Here is an updated version.




ob-sed.el
Description: Binary data


[O] ob-sed

2015-05-27 Thread Bjarte Johansen
Hi,

I originally wrote this for Eric Schulte’s sed-mode, but he thought I should 
post it here instead. I have been using it for little over a week and it has 
been working perfectly for me. If there is anything that you think should be 
added or removed before it is accepted into org-mode please tell me.

I have already signed the CA for projects in relation to GNU Emacs.

Regards,
Bjarte



ob-sed.el
Description: Binary data


Re: [O] ob-sed

2015-05-27 Thread Nicolas Goaziou
Hello,

Bjarte Johansen bjarte.johan...@infomedia.uib.no writes:

 I had loosely based it on my own ob-sparql and ob-awk, I saw that
 there was a remnant of ob-sparql left in there. Here is an updated
 version.

Thank you. Some comments follow.

 ;;; ob-sed.el --- org-babel functions for sed scripts

 ;; Copyright (C) 2015 Bjarte Johansen

You need to change the copyright to Free Software Foundation, Inc.

 ;; Author: Bjarte Johansen
 ;; Keywords: literate programming, reproducible research
 ;; Version: 0.1.0

You will need to add This file is part of GNU Emacs.

 ;; Provides a way to evaluate sed scripts in org-mode.

org-mode - Org mode

 (defvar org-babel-sed-command sed)

Missing docstring.

 (defun org-babel-execute:sed (body params)
   Execute a block of sed code with org-babel.  This function is
 called by `org-babel-execute-src-block'

org-babel - Org Babel

This function is should be moved to a new line, not on the summary
line.  BODY and PARAMS ought to be explained.

   (message executing sed source code block)
   (let* ((result-params (cdr (assoc :result-params params)))

`assoc' - `assq' (same goes for other occurrences)

  (cmd-line (cdr (assoc :cmd-line params)))
  (in-file (cdr (assoc :in-file params)))

:cmd-line and :in-file look like sed-specific header arguments. If
that's correct, you should create a defconst,
`org-babel-header-args:sed' and list them here, probably with :any
value.

  (cmd (mapconcat #'identity (remove nil (list org-babel-sed-command
 -f code-file
 cmd-line
 in-file))
 )))

`remove' - `remq'

Bonus points for tests, too. Also, org.texi needs to be updated.


Regards,

-- 
Nicolas Goaziou