emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ob-sed
@ 2015-05-27  8:51 Bjarte Johansen
  2015-05-27  8:56 ` ob-sed Bjarte Johansen
  0 siblings, 1 reply; 11+ messages in thread
From: Bjarte Johansen @ 2015-05-27  8:51 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

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


[-- Attachment #2: ob-sed.el --]
[-- Type: application/octet-stream, Size: 2926 bytes --]

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

;; Copyright (C) 2015 Bjarte Johansen

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

;;; License:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

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

;;; Usage:

;; Add to your Emacs config:

;; (org-babel-do-load-languages
;;  'org-babel-load-languages
;;  '((sed . t)))

(require 'ob)
(require 'sed-mode)

(defvar org-babel-sed-command "sed")

(defvar org-babel-tangle-lang-exts)
(add-to-list 'org-babel-tangle-lang-exts '("sed" . "sed"))

(defvar org-babel-default-header-args:sparql '()
  "Default arguments for evaluating a sed source code block.")

(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'"
  (message "executing sed source code block")
  (let* ((result-params (cdr (assoc :result-params params)))
         (cmd-line (cdr (assoc :cmd-line params)))
         (in-file (cdr (assoc :in-file params)))
	 (code-file (let ((file (org-babel-temp-file "sed-")))
                      (with-temp-file file
			(insert body)) file))
	 (stdin (let ((stdin (cdr (assoc :stdin params))))
		   (when stdin
		     (let ((tmp (org-babel-temp-file "sed-stdin-"))
			   (res (org-babel-ref-resolve stdin)))
		       (with-temp-file tmp
			 (insert res))
		       tmp))))
         (cmd (mapconcat #'identity (remove nil (list org-babel-sed-command
						      "-f" code-file
						      cmd-line
						      in-file))
			 " ")))
    (org-babel-reassemble-table
     (let ((results
            (cond
             (stdin (with-temp-buffer
                      (call-process-shell-command cmd stdin (current-buffer))
                      (buffer-string)))
             (t (org-babel-eval cmd "")))))
       (when results
         (org-babel-result-cond result-params
	   results
	   (let ((tmp (org-babel-temp-file "sed-results-")))
	     (with-temp-file tmp (insert results))
	     (org-babel-import-elisp-from-file tmp)))))
     (org-babel-pick-name
      (cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
     (org-babel-pick-name
      (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))

(provide 'ob-sed)
;;; ob-sed.el ends here

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-27  8:51 ob-sed Bjarte Johansen
@ 2015-05-27  8:56 ` Bjarte Johansen
  2015-05-27 21:31   ` ob-sed Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Bjarte Johansen @ 2015-05-27  8:56 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 147 bytes --]

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.



[-- Attachment #2: ob-sed.el --]
[-- Type: application/octet-stream, Size: 2923 bytes --]

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

;; Copyright (C) 2015 Bjarte Johansen

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

;;; License:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

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

;;; Usage:

;; Add to your Emacs config:

;; (org-babel-do-load-languages
;;  'org-babel-load-languages
;;  '((sed . t)))

(require 'ob)
(require 'sed-mode)

(defvar org-babel-sed-command "sed")

(defvar org-babel-tangle-lang-exts)
(add-to-list 'org-babel-tangle-lang-exts '("sed" . "sed"))

(defvar org-babel-default-header-args:sed '()
  "Default arguments for evaluating a sed source code block.")

(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'"
  (message "executing sed source code block")
  (let* ((result-params (cdr (assoc :result-params params)))
         (cmd-line (cdr (assoc :cmd-line params)))
         (in-file (cdr (assoc :in-file params)))
	 (code-file (let ((file (org-babel-temp-file "sed-")))
                      (with-temp-file file
			(insert body)) file))
	 (stdin (let ((stdin (cdr (assoc :stdin params))))
		   (when stdin
		     (let ((tmp (org-babel-temp-file "sed-stdin-"))
			   (res (org-babel-ref-resolve stdin)))
		       (with-temp-file tmp
			 (insert res))
		       tmp))))
         (cmd (mapconcat #'identity (remove nil (list org-babel-sed-command
						      "-f" code-file
						      cmd-line
						      in-file))
			 " ")))
    (org-babel-reassemble-table
     (let ((results
            (cond
             (stdin (with-temp-buffer
                      (call-process-shell-command cmd stdin (current-buffer))
                      (buffer-string)))
             (t (org-babel-eval cmd "")))))
       (when results
         (org-babel-result-cond result-params
	   results
	   (let ((tmp (org-babel-temp-file "sed-results-")))
	     (with-temp-file tmp (insert results))
	     (org-babel-import-elisp-from-file tmp)))))
     (org-babel-pick-name
      (cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
     (org-babel-pick-name
      (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))

(provide 'ob-sed)
;;; ob-sed.el ends here

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-27  8:56 ` ob-sed Bjarte Johansen
@ 2015-05-27 21:31   ` Nicolas Goaziou
  2015-05-28 11:47     ` ob-sed Bjarte Johansen
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2015-05-27 21:31 UTC (permalink / raw)
  To: Bjarte Johansen; +Cc: emacs-orgmode

Hello,

Bjarte Johansen <bjarte.johansen@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-27 21:31   ` ob-sed Nicolas Goaziou
@ 2015-05-28 11:47     ` Bjarte Johansen
  2015-05-29  9:00       ` ob-sed Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Bjarte Johansen @ 2015-05-28 11:47 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 85 bytes --]

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

Regards,
Bjarte



[-- Attachment #2: 0001-Org-Babel-now-supports-sed-scripts.patch --]
[-- Type: application/octet-stream, Size: 8358 bytes --]

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

---
 doc/org.texi                     |   5 +-
 lisp/ob-sed.el                   | 100 +++++++++++++++++++++++++++++++++++++++
 testing/examples/ob-sed-test.org |  35 ++++++++++++++
 testing/lisp/test-ob-sed.el      |  60 +++++++++++++++++++++++
 4 files changed, 198 insertions(+), 2 deletions(-)
 create mode 100644 lisp/ob-sed.el
 create mode 100644 testing/examples/ob-sed-test.org
 create mode 100644 testing/lisp/test-ob-sed.el

diff --git a/doc/org.texi b/doc/org.texi
index f10d4f5..f82566f 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -15056,8 +15056,9 @@ Code blocks in the following languages are supported.
 @item Processing.js @tab processing @tab Python @tab python 
 @item R @tab R @tab Ruby @tab ruby 
 @item Sass @tab sass @tab Scheme @tab scheme 
-@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
 @end multitable
 
 Language-specific documentation is available for some languages.  If
diff --git a/lisp/ob-sed.el b/lisp/ob-sed.el
new file mode 100644
index 0000000..ee32241
--- /dev/null
+++ b/lisp/ob-sed.el
@@ -0,0 +1,100 @@
+;;; ob-sed.el --- org-babel functions for sed scripts
+
+;; Copyright (C) 2015 Free Software Foundation
+
+;; Author: Bjarte Johansen
+;; Keywords: literate programming, reproducible research
+;; Version: 0.1.0
+
+;; This file is part of GNU Emacs.
+
+;;; License:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides a way to evaluate sed scripts in Org mode.
+
+;;; Usage:
+
+;; Add to your Emacs config:
+
+;; (org-babel-do-load-languages
+;;  'org-babel-load-languages
+;;  '((sed . t)))
+
+(require 'ob)
+(require 'sed-mode)
+
+(defvar org-babel-sed-command "sed"
+  "Name of the sed executable command.")
+
+(defvar org-babel-tangle-lang-exts)
+(add-to-list 'org-babel-tangle-lang-exts '("sed" . "sed"))
+
+(defconst org-babel-header-args:sed
+  '((:cmd-line :any
+     :in-file  :any))
+  "Sed specific header arguments.")
+
+(defvar org-babel-default-header-args:sed '()
+  "Default arguments for evaluating a sed source block.")
+
+(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
+function is called by `org-babel-execute-src-block'."
+  (message "executing sed source code block")
+  (let* ((result-params (cdr (assq :result-params params)))
+         (cmd-line (cdr (assq :cmd-line params)))
+         (in-file (cdr (assq :in-file params)))
+	 (code-file (let ((file (org-babel-temp-file "sed-")))
+                      (with-temp-file file
+			(insert body)) file))
+	 (stdin (let ((stdin (cdr (assq :stdin params))))
+		   (when stdin
+		     (let ((tmp (org-babel-temp-file "sed-stdin-"))
+			   (res (org-babel-ref-resolve stdin)))
+		       (with-temp-file tmp
+			 (insert res))
+		       tmp))))
+         (cmd (mapconcat #'identity
+			 (remq nil
+			       (list org-babel-sed-command
+				     (format "--file=\"%s\"" code-file)
+				     cmd-line
+				     in-file))
+			 " ")))
+    (org-babel-reassemble-table
+     (let ((results
+            (cond
+             (stdin (with-temp-buffer
+                      (call-process-shell-command cmd stdin (current-buffer))
+                      (buffer-string)))
+             (t (org-babel-eval cmd "")))))
+       (when results
+         (org-babel-result-cond result-params
+	   results
+	   (let ((tmp (org-babel-temp-file "sed-results-")))
+	     (with-temp-file tmp (insert results))
+	     (org-babel-import-elisp-from-file tmp)))))
+     (org-babel-pick-name
+      (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
+     (org-babel-pick-name
+      (cdr (assq :rowname-names params)) (cdr (assq :rownames params))))))
+
+(provide 'ob-sed)
+;;; ob-sed.el ends here
diff --git a/testing/examples/ob-sed-test.org b/testing/examples/ob-sed-test.org
new file mode 100644
index 0000000..aae1323
--- /dev/null
+++ b/testing/examples/ob-sed-test.org
@@ -0,0 +1,35 @@
+#+PROPERTY: results silent scalar
+#+Title: a collection of examples for ob-sed tests
+
+* Test simple execution of sed script
+  :PROPERTIES:
+  :ID:       C7E7CA6A-2601-42C9-B534-4102D62E458D
+  :END:
+
+  #+NAME: ex1
+  #+BEGIN_EXAMPLE
+    An example sentence.
+  #+END_EXAMPLE
+
+  #+BEGIN_SRC sed :stdin ex1
+    s/n example/ processed/
+    2 d
+  #+END_SRC
+
+* Test :in-file header argument
+  :PROPERTIES:
+  :ID:       54EC49AA-FE9F-4D58-812E-00FC87FAF562
+  :END:
+
+  #+BEGIN_SRC sed :in-file test1.txt
+  s/test/tested/
+  #+END_SRC
+
+* Test :cmd-line header argument
+  :PROPERTIES:
+  :ID:       E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1
+  :END:
+
+  #+BEGIN_SRC sed :in-file test2.txt :cmd-line "-i"
+    s/test/tested again/
+  #+END_SRC
diff --git a/testing/lisp/test-ob-sed.el b/testing/lisp/test-ob-sed.el
new file mode 100644
index 0000000..c108240
--- /dev/null
+++ b/testing/lisp/test-ob-sed.el
@@ -0,0 +1,60 @@
+;;; test-ob-sed.el --- tests for ob-sed.el
+
+;; Copyright (c) 2015 Bjarte Johansen
+;; Authors: Bjarte Johansen
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(org-test-for-executable "sed")
+(unless (featurep 'ob-sed)
+  (signal 'missing-test-dependency "Support for Sed code blocks"))
+
+(ert-deftest ob-sed-test/simple-execution-of-script ()
+  "Test simple execution of script."
+  (org-test-at-id "C7E7CA6A-2601-42C9-B534-4102D62E458D"
+    (org-babel-next-src-block)
+    (should (string= "A processed sentence.\n"
+		     (org-babel-execute-src-block)))))
+
+(ert-deftest ob-sed-test/in-file-header-argument ()
+  "Test :in-file header argument."
+  (org-test-at-id "54EC49AA-FE9F-4D58-812E-00FC87FAF562"
+    (let ((default-directory temporary-file-directory))
+      (with-temp-buffer
+	(insert "A test file.")
+	(write-file "test1.txt"))
+      (org-babel-next-src-block)
+      (should (string= "A tested file.\n"
+		       (org-babel-execute-src-block))))))
+
+(ert-deftest ob-sed-test/cmd-line-header-argument ()
+  "Test :cmd-line header argument."
+  (org-test-at-id "E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1"
+    (let ((default-directory temporary-file-directory))
+      (with-temp-buffer
+	(insert "A test file.")
+	(write-file "test2.txt"))
+      (org-babel-next-src-block)
+      (org-babel-execute-src-block)
+      (should (string= "A tested again file.\n"
+		       (with-temp-buffer
+			 (insert-file-contents "test2.txt")
+			 (buffer-string)))))))
+
+
+
+;;; test-ob-sed ends here
-- 
2.3.2 (Apple Git-55)


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-28 11:47     ` ob-sed Bjarte Johansen
@ 2015-05-29  9:00       ` Nicolas Goaziou
  2015-05-29 13:32         ` ob-sed Bjarte Johansen
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2015-05-29  9:00 UTC (permalink / raw)
  To: Bjarte Johansen; +Cc: emacs-orgmode

Bjarte Johansen <bjarte.johansen@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,

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-29  9:00       ` ob-sed Nicolas Goaziou
@ 2015-05-29 13:32         ` Bjarte Johansen
  2015-05-29 17:08           ` ob-sed Suvayu Ali
  2015-05-30 12:32           ` ob-sed Nicolas Goaziou
  0 siblings, 2 replies; 11+ messages in thread
From: Bjarte Johansen @ 2015-05-29 13:32 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

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


[-- Attachment #2: 0001-Org-Babel-now-supports-sed-scripts.patch --]
[-- Type: application/octet-stream, Size: 8925 bytes --]

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

* 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.
---
 doc/org.texi                     |   5 +-
 lisp/ob-sed.el                   | 108 +++++++++++++++++++++++++++++++++++++++
 testing/examples/ob-sed-test.org |  35 +++++++++++++
 testing/lisp/test-ob-sed.el      |  60 ++++++++++++++++++++++
 4 files changed, 206 insertions(+), 2 deletions(-)
 create mode 100644 lisp/ob-sed.el
 create mode 100644 testing/examples/ob-sed-test.org
 create mode 100644 testing/lisp/test-ob-sed.el

diff --git a/doc/org.texi b/doc/org.texi
index f10d4f5..05d8666 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -15056,8 +15056,9 @@ Code blocks in the following languages are supported.
 @item Processing.js @tab processing @tab Python @tab python 
 @item R @tab R @tab Ruby @tab ruby 
 @item Sass @tab sass @tab Scheme @tab scheme 
-@item GNU Screen @tab screen @tab shell @tab sh 
-@item SQL @tab sql @tab SQLite @tab sqlite
+@item GNU Screen @tab screen @tab Sed @tab sed
+@item shell @tab sh @tab SQL @tab sql
+@item SQLite @tab sqlite @tab @tab
 @end multitable
 
 Language-specific documentation is available for some languages.  If
diff --git a/lisp/ob-sed.el b/lisp/ob-sed.el
new file mode 100644
index 0000000..a42336d
--- /dev/null
+++ b/lisp/ob-sed.el
@@ -0,0 +1,108 @@
+;;; ob-sed.el --- org-babel functions for sed scripts
+
+;; Copyright (C) 2015 Free Software Foundation
+
+;; Author: Bjarte Johansen
+;; Keywords: literate programming, reproducible research
+;; Version: 0.1.0
+
+;; This file is part of GNU Emacs.
+
+;;; License:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides a way to evaluate sed scripts in Org mode.
+
+;;; Usage:
+
+;; Add to your Emacs config:
+
+;; (org-babel-do-load-languages
+;;  'org-babel-load-languages
+;;  '((sed . t)))
+
+;; In addition to the normal header arguments, ob-sed also provides
+;; :cmd-line and :in-file. :cmd-line allows one to pass other flags to
+;; the sed command like the "--in-place" flag which makes sed edit the
+;; file pass to it instead of outputting to standard out or to a
+;; different file. :in-file is a header arguments that allows one to
+;; tell Org Babel which file the sed script to act on.
+
+;;; Code:
+(require 'ob)
+(require 'sed-mode)
+
+(defvar org-babel-sed-command "sed"
+  "Name of the sed executable command.")
+
+(defvar org-babel-tangle-lang-exts)
+(add-to-list 'org-babel-tangle-lang-exts '("sed" . "sed"))
+
+(defconst org-babel-header-args:sed
+  '((:cmd-line . :any
+     :in-file  . :any))
+  "Sed specific header arguments.")
+
+(defvar org-babel-default-header-args:sed '()
+  "Default arguments for evaluating a sed source block.")
+
+(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
+function is called by `org-babel-execute-src-block'."
+  (message "executing sed source code block")
+  (let* ((result-params (cdr (assq :result-params params)))
+         (cmd-line (cdr (assq :cmd-line params)))
+         (in-file (cdr (assq :in-file params)))
+	 (code-file (let ((file (org-babel-temp-file "sed-")))
+                      (with-temp-file file
+			(insert body)) file))
+	 (stdin (let ((stdin (cdr (assq :stdin params))))
+		   (when stdin
+		     (let ((tmp (org-babel-temp-file "sed-stdin-"))
+			   (res (org-babel-ref-resolve stdin)))
+		       (with-temp-file tmp
+			 (insert res))
+		       tmp))))
+         (cmd (mapconcat #'identity
+			 (remq nil
+			       (list org-babel-sed-command
+				     (format "--file=\"%s\"" code-file)
+				     cmd-line
+				     in-file))
+			 " ")))
+    (org-babel-reassemble-table
+     (let ((results
+            (cond
+             (stdin (with-temp-buffer
+                      (call-process-shell-command cmd stdin (current-buffer))
+                      (buffer-string)))
+             (t (org-babel-eval cmd "")))))
+       (when results
+         (org-babel-result-cond result-params
+	   results
+	   (let ((tmp (org-babel-temp-file "sed-results-")))
+	     (with-temp-file tmp (insert results))
+	     (org-babel-import-elisp-from-file tmp)))))
+     (org-babel-pick-name
+      (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
+     (org-babel-pick-name
+      (cdr (assq :rowname-names params)) (cdr (assq :rownames params))))))
+
+(provide 'ob-sed)
+;;; ob-sed.el ends here
diff --git a/testing/examples/ob-sed-test.org b/testing/examples/ob-sed-test.org
new file mode 100644
index 0000000..aae1323
--- /dev/null
+++ b/testing/examples/ob-sed-test.org
@@ -0,0 +1,35 @@
+#+PROPERTY: results silent scalar
+#+Title: a collection of examples for ob-sed tests
+
+* Test simple execution of sed script
+  :PROPERTIES:
+  :ID:       C7E7CA6A-2601-42C9-B534-4102D62E458D
+  :END:
+
+  #+NAME: ex1
+  #+BEGIN_EXAMPLE
+    An example sentence.
+  #+END_EXAMPLE
+
+  #+BEGIN_SRC sed :stdin ex1
+    s/n example/ processed/
+    2 d
+  #+END_SRC
+
+* Test :in-file header argument
+  :PROPERTIES:
+  :ID:       54EC49AA-FE9F-4D58-812E-00FC87FAF562
+  :END:
+
+  #+BEGIN_SRC sed :in-file test1.txt
+  s/test/tested/
+  #+END_SRC
+
+* Test :cmd-line header argument
+  :PROPERTIES:
+  :ID:       E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1
+  :END:
+
+  #+BEGIN_SRC sed :in-file test2.txt :cmd-line "-i"
+    s/test/tested again/
+  #+END_SRC
diff --git a/testing/lisp/test-ob-sed.el b/testing/lisp/test-ob-sed.el
new file mode 100644
index 0000000..c108240
--- /dev/null
+++ b/testing/lisp/test-ob-sed.el
@@ -0,0 +1,60 @@
+;;; test-ob-sed.el --- tests for ob-sed.el
+
+;; Copyright (c) 2015 Bjarte Johansen
+;; Authors: Bjarte Johansen
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(org-test-for-executable "sed")
+(unless (featurep 'ob-sed)
+  (signal 'missing-test-dependency "Support for Sed code blocks"))
+
+(ert-deftest ob-sed-test/simple-execution-of-script ()
+  "Test simple execution of script."
+  (org-test-at-id "C7E7CA6A-2601-42C9-B534-4102D62E458D"
+    (org-babel-next-src-block)
+    (should (string= "A processed sentence.\n"
+		     (org-babel-execute-src-block)))))
+
+(ert-deftest ob-sed-test/in-file-header-argument ()
+  "Test :in-file header argument."
+  (org-test-at-id "54EC49AA-FE9F-4D58-812E-00FC87FAF562"
+    (let ((default-directory temporary-file-directory))
+      (with-temp-buffer
+	(insert "A test file.")
+	(write-file "test1.txt"))
+      (org-babel-next-src-block)
+      (should (string= "A tested file.\n"
+		       (org-babel-execute-src-block))))))
+
+(ert-deftest ob-sed-test/cmd-line-header-argument ()
+  "Test :cmd-line header argument."
+  (org-test-at-id "E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1"
+    (let ((default-directory temporary-file-directory))
+      (with-temp-buffer
+	(insert "A test file.")
+	(write-file "test2.txt"))
+      (org-babel-next-src-block)
+      (org-babel-execute-src-block)
+      (should (string= "A tested again file.\n"
+		       (with-temp-buffer
+			 (insert-file-contents "test2.txt")
+			 (buffer-string)))))))
+
+
+
+;;; test-ob-sed ends here
-- 
2.3.2 (Apple Git-55)


[-- Attachment #3: Type: text/plain, Size: 1839 bytes --]





> On 29 May 2015, at 11:00, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> 
> Bjarte Johansen <bjarte.johansen@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,


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-29 13:32         ` ob-sed Bjarte Johansen
@ 2015-05-29 17:08           ` Suvayu Ali
  2015-05-30 12:32           ` ob-sed Nicolas Goaziou
  1 sibling, 0 replies; 11+ messages in thread
From: Suvayu Ali @ 2015-05-29 17:08 UTC (permalink / raw)
  To: emacs-orgmode

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-29 13:32         ` ob-sed Bjarte Johansen
  2015-05-29 17:08           ` ob-sed Suvayu Ali
@ 2015-05-30 12:32           ` Nicolas Goaziou
  2015-05-30 12:36             ` ob-sed Bjarte Johansen
  1 sibling, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2015-05-30 12:32 UTC (permalink / raw)
  To: Bjarte Johansen; +Cc: emacs-orgmode

Bjarte Johansen <bjarte.johansen@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,

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-30 12:32           ` ob-sed Nicolas Goaziou
@ 2015-05-30 12:36             ` Bjarte Johansen
  2015-05-30 13:01               ` ob-sed Nicolas Goaziou
  2015-05-31  2:08               ` ob-sed Nick Dokos
  0 siblings, 2 replies; 11+ messages in thread
From: Bjarte Johansen @ 2015-05-30 12:36 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]


> On 30 May 2015, at 14:32, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> 
> Bjarte Johansen <bjarte.johansen@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.


[-- Attachment #2: 0001-Org-Babel-now-supports-sed-scripts.patch --]
[-- Type: application/octet-stream, Size: 8904 bytes --]

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

* 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.
---
 doc/org.texi                     |   5 +-
 lisp/ob-sed.el                   | 107 +++++++++++++++++++++++++++++++++++++++
 testing/examples/ob-sed-test.org |  35 +++++++++++++
 testing/lisp/test-ob-sed.el      |  60 ++++++++++++++++++++++
 4 files changed, 205 insertions(+), 2 deletions(-)
 create mode 100644 lisp/ob-sed.el
 create mode 100644 testing/examples/ob-sed-test.org
 create mode 100644 testing/lisp/test-ob-sed.el

diff --git a/doc/org.texi b/doc/org.texi
index f10d4f5..05d8666 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -15056,8 +15056,9 @@ Code blocks in the following languages are supported.
 @item Processing.js @tab processing @tab Python @tab python 
 @item R @tab R @tab Ruby @tab ruby 
 @item Sass @tab sass @tab Scheme @tab scheme 
-@item GNU Screen @tab screen @tab shell @tab sh 
-@item SQL @tab sql @tab SQLite @tab sqlite
+@item GNU Screen @tab screen @tab Sed @tab sed
+@item shell @tab sh @tab SQL @tab sql
+@item SQLite @tab sqlite @tab @tab
 @end multitable
 
 Language-specific documentation is available for some languages.  If
diff --git a/lisp/ob-sed.el b/lisp/ob-sed.el
new file mode 100644
index 0000000..4d07f06
--- /dev/null
+++ b/lisp/ob-sed.el
@@ -0,0 +1,107 @@
+;;; ob-sed.el --- org-babel functions for sed scripts
+
+;; Copyright (C) 2015 Free Software Foundation
+
+;; Author: Bjarte Johansen
+;; Keywords: literate programming, reproducible research
+;; Version: 0.1.0
+
+;; This file is part of GNU Emacs.
+
+;;; License:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides a way to evaluate sed scripts in Org mode.
+
+;;; Usage:
+
+;; Add to your Emacs config:
+
+;; (org-babel-do-load-languages
+;;  'org-babel-load-languages
+;;  '((sed . t)))
+
+;; In addition to the normal header arguments, ob-sed also provides
+;; :cmd-line and :in-file. :cmd-line allows one to pass other flags to
+;; the sed command like the "--in-place" flag which makes sed edit the
+;; file pass to it instead of outputting to standard out or to a
+;; different file. :in-file is a header arguments that allows one to
+;; tell Org Babel which file the sed script to act on.
+
+;;; Code:
+(require 'ob)
+
+(defvar org-babel-sed-command "sed"
+  "Name of the sed executable command.")
+
+(defvar org-babel-tangle-lang-exts)
+(add-to-list 'org-babel-tangle-lang-exts '("sed" . "sed"))
+
+(defconst org-babel-header-args:sed
+  '((:cmd-line . :any
+     :in-file  . :any))
+  "Sed specific header arguments.")
+
+(defvar org-babel-default-header-args:sed '()
+  "Default arguments for evaluating a sed source block.")
+
+(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
+function is called by `org-babel-execute-src-block'."
+  (message "executing sed source code block")
+  (let* ((result-params (cdr (assq :result-params params)))
+         (cmd-line (cdr (assq :cmd-line params)))
+         (in-file (cdr (assq :in-file params)))
+	 (code-file (let ((file (org-babel-temp-file "sed-")))
+                      (with-temp-file file
+			(insert body)) file))
+	 (stdin (let ((stdin (cdr (assq :stdin params))))
+		   (when stdin
+		     (let ((tmp (org-babel-temp-file "sed-stdin-"))
+			   (res (org-babel-ref-resolve stdin)))
+		       (with-temp-file tmp
+			 (insert res))
+		       tmp))))
+         (cmd (mapconcat #'identity
+			 (remq nil
+			       (list org-babel-sed-command
+				     (format "--file=\"%s\"" code-file)
+				     cmd-line
+				     in-file))
+			 " ")))
+    (org-babel-reassemble-table
+     (let ((results
+            (cond
+             (stdin (with-temp-buffer
+                      (call-process-shell-command cmd stdin (current-buffer))
+                      (buffer-string)))
+             (t (org-babel-eval cmd "")))))
+       (when results
+         (org-babel-result-cond result-params
+	   results
+	   (let ((tmp (org-babel-temp-file "sed-results-")))
+	     (with-temp-file tmp (insert results))
+	     (org-babel-import-elisp-from-file tmp)))))
+     (org-babel-pick-name
+      (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
+     (org-babel-pick-name
+      (cdr (assq :rowname-names params)) (cdr (assq :rownames params))))))
+
+(provide 'ob-sed)
+;;; ob-sed.el ends here
diff --git a/testing/examples/ob-sed-test.org b/testing/examples/ob-sed-test.org
new file mode 100644
index 0000000..aae1323
--- /dev/null
+++ b/testing/examples/ob-sed-test.org
@@ -0,0 +1,35 @@
+#+PROPERTY: results silent scalar
+#+Title: a collection of examples for ob-sed tests
+
+* Test simple execution of sed script
+  :PROPERTIES:
+  :ID:       C7E7CA6A-2601-42C9-B534-4102D62E458D
+  :END:
+
+  #+NAME: ex1
+  #+BEGIN_EXAMPLE
+    An example sentence.
+  #+END_EXAMPLE
+
+  #+BEGIN_SRC sed :stdin ex1
+    s/n example/ processed/
+    2 d
+  #+END_SRC
+
+* Test :in-file header argument
+  :PROPERTIES:
+  :ID:       54EC49AA-FE9F-4D58-812E-00FC87FAF562
+  :END:
+
+  #+BEGIN_SRC sed :in-file test1.txt
+  s/test/tested/
+  #+END_SRC
+
+* Test :cmd-line header argument
+  :PROPERTIES:
+  :ID:       E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1
+  :END:
+
+  #+BEGIN_SRC sed :in-file test2.txt :cmd-line "-i"
+    s/test/tested again/
+  #+END_SRC
diff --git a/testing/lisp/test-ob-sed.el b/testing/lisp/test-ob-sed.el
new file mode 100644
index 0000000..c108240
--- /dev/null
+++ b/testing/lisp/test-ob-sed.el
@@ -0,0 +1,60 @@
+;;; test-ob-sed.el --- tests for ob-sed.el
+
+;; Copyright (c) 2015 Bjarte Johansen
+;; Authors: Bjarte Johansen
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(org-test-for-executable "sed")
+(unless (featurep 'ob-sed)
+  (signal 'missing-test-dependency "Support for Sed code blocks"))
+
+(ert-deftest ob-sed-test/simple-execution-of-script ()
+  "Test simple execution of script."
+  (org-test-at-id "C7E7CA6A-2601-42C9-B534-4102D62E458D"
+    (org-babel-next-src-block)
+    (should (string= "A processed sentence.\n"
+		     (org-babel-execute-src-block)))))
+
+(ert-deftest ob-sed-test/in-file-header-argument ()
+  "Test :in-file header argument."
+  (org-test-at-id "54EC49AA-FE9F-4D58-812E-00FC87FAF562"
+    (let ((default-directory temporary-file-directory))
+      (with-temp-buffer
+	(insert "A test file.")
+	(write-file "test1.txt"))
+      (org-babel-next-src-block)
+      (should (string= "A tested file.\n"
+		       (org-babel-execute-src-block))))))
+
+(ert-deftest ob-sed-test/cmd-line-header-argument ()
+  "Test :cmd-line header argument."
+  (org-test-at-id "E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1"
+    (let ((default-directory temporary-file-directory))
+      (with-temp-buffer
+	(insert "A test file.")
+	(write-file "test2.txt"))
+      (org-babel-next-src-block)
+      (org-babel-execute-src-block)
+      (should (string= "A tested again file.\n"
+		       (with-temp-buffer
+			 (insert-file-contents "test2.txt")
+			 (buffer-string)))))))
+
+
+
+;;; test-ob-sed ends here
-- 
2.3.2 (Apple Git-55)


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-30 12:36             ` ob-sed Bjarte Johansen
@ 2015-05-30 13:01               ` Nicolas Goaziou
  2015-05-31  2:08               ` ob-sed Nick Dokos
  1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2015-05-30 13:01 UTC (permalink / raw)
  To: Bjarte Johansen; +Cc: emacs-orgmode

Bjarte Johansen <bjarte.johansen@infomedia.uib.no> writes:

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

Applied. Thank you.


Regards,

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ob-sed
  2015-05-30 12:36             ` ob-sed Bjarte Johansen
  2015-05-30 13:01               ` ob-sed Nicolas Goaziou
@ 2015-05-31  2:08               ` Nick Dokos
  1 sibling, 0 replies; 11+ messages in thread
From: Nick Dokos @ 2015-05-31  2:08 UTC (permalink / raw)
  To: emacs-orgmode

Bjarte Johansen <bjarte.johansen@infomedia.uib.no> writes:

>> On 30 May 2015, at 14:32, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>> 
>> Bjarte Johansen <bjarte.johansen@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-05-31  2:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-27  8:51 ob-sed Bjarte Johansen
2015-05-27  8:56 ` ob-sed Bjarte Johansen
2015-05-27 21:31   ` ob-sed Nicolas Goaziou
2015-05-28 11:47     ` ob-sed Bjarte Johansen
2015-05-29  9:00       ` ob-sed Nicolas Goaziou
2015-05-29 13:32         ` ob-sed Bjarte Johansen
2015-05-29 17:08           ` ob-sed Suvayu Ali
2015-05-30 12:32           ` ob-sed Nicolas Goaziou
2015-05-30 12:36             ` ob-sed Bjarte Johansen
2015-05-30 13:01               ` ob-sed Nicolas Goaziou
2015-05-31  2:08               ` ob-sed Nick Dokos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).