From: Sebastien Vauban Date: Fri, 9 Jan 2015 11:10:25 +0100 Subject: [PATCH] Replace `sh' language by `shell' * README, babel.org, ob-shell-test.org, test-ob-exp.el, test-ob.el: Replace `sh' language by `shell'. --- testing/README | 2 +- testing/examples/babel.org | 54 +++++++++++++++++++------------------- testing/examples/ob-shell-test.org | 11 ++++---- testing/lisp/test-ob-exp.el | 12 ++++----- testing/lisp/test-ob.el | 28 ++++++++++---------- 5 files changed, 53 insertions(+), 54 deletions(-) diff --git a/testing/README b/testing/README index 34f6fcd..d8a31ac 100644 --- a/testing/README +++ b/testing/README @@ -17,7 +17,7 @@ relative to the base of the Org-mode directory. Also note that many of the current tests uses babel evaluation... -#+BEGIN_SRC sh :dir (expand-file-name "..") +#+BEGIN_SRC shell :dir (expand-file-name "..") # For Emacs earlier than 24, add -L /path/to/ert emacs -Q --batch \ -L lisp/ -L testing/ -L testing/lisp -l lisp/org.el \ diff --git a/testing/examples/babel.org b/testing/examples/babel.org index 8bae65b..978df7a 100644 --- a/testing/examples/babel.org +++ b/testing/examples/babel.org @@ -125,7 +125,7 @@ (list (my-map 'list #'+ (append prev-row '(0)) (append '(0) prev-row))))))) - + (pascals-triangle n) #+end_src @@ -196,9 +196,9 @@ an = sign. :results: silent :ID: 54cb8dc3-298c-4883-a933-029b3c9d4b18 :END: -Here is one in the middle src_sh{echo 1} of a line. -Here is one at the end of a line. src_sh{echo 2} -src_sh{echo 3} Here is one at the beginning of a line. +Here is one in the middle src_shell{echo 1} of a line. +Here is one at the end of a line. src_shell{echo 2} +src_shell{echo 3} Here is one at the beginning of a line. * exported inline source block :PROPERTIES: @@ -206,10 +206,10 @@ src_sh{echo 3} Here is one at the beginning of a line. :results: silent :exports: code :END: -Here is one in the middle src_sh{echo 1} of a line. -Here is one at the end of a line. src_sh{echo 2} -src_sh{echo 3} Here is one at the beginning of a line. -Here is one that is also evaluated: src_sh[:exports both]{echo 4} +Here is one in the middle src_shell{echo 1} of a line. +Here is one at the end of a line. src_shell{echo 2} +src_shell{echo 3} Here is one at the beginning of a line. +Here is one that is also evaluated: src_shell[:exports both]{echo 4} * mixed blocks with exports both :PROPERTIES: @@ -235,27 +235,27 @@ Here is one that is also evaluated: src_sh[:exports both]{echo 4} :noweb-sep: "" :END: -#+begin_src sh :tangle yes :noweb yes :shebang "#!/bin/sh" +#+begin_src shell :tangle yes :noweb yes :shebang "#!/bin/sh" <> #+end_src ** query all mounted disks -#+begin_src sh :noweb-ref fullest-disk +#+begin_src shell :noweb-ref fullest-disk df #+end_src ** strip the header row -#+begin_src sh :noweb-ref fullest-disk +#+begin_src shell :noweb-ref fullest-disk |sed '1d' #+end_src ** sort by the percent full -#+begin_src sh :noweb-ref fullest-disk +#+begin_src shell :noweb-ref fullest-disk |awk '{print $5 " " $6}'|sort -n |tail -1 #+end_src ** extract the mount point -#+begin_src sh :noweb-ref fullest-disk +#+begin_src shell :noweb-ref fullest-disk |awk '{print $2}' #+end_src * resolving sub-trees as references @@ -290,20 +290,20 @@ has length 14 :results: silent :ID: 0D0983D4-DE33-400A-8A05-A225A567BC74 :END: -src_sh{echo "One"} block at start of line - One spaced block in src_sh{ echo "middle" } of line -src_sh{echo 2} blocks on the src_emacs-lisp{"same"} line - Inline block with src_sh[:results silent]{ echo "parameters" }. +src_shell{echo "One"} block at start of line + One spaced block in src_shell{ echo "middle" } of line +src_shell{echo 2} blocks on the src_emacs-lisp{"same"} line + Inline block with src_shell[:results silent]{ echo "parameters" }. * org-babel-get-inline-src-block-matches (with empty args) :PROPERTIES: :results: silent :ID: d55dada7-de0e-4340-8061-787cccbedee5 :END: -src_sh[]{echo "One"} block at start of line - One spaced block in src_sh[]{ echo "middle" } of line -src_sh[]{echo 2} blocks on the src_emacs-lisp[]{"same"} line - Inline block with src_sh[:results silent]{ echo "parameters" }. +src_shell[]{echo "One"} block at start of line + One spaced block in src_shell[]{ echo "middle" } of line +src_shell[]{echo 2} blocks on the src_emacs-lisp[]{"same"} line + Inline block with src_shell[:results silent]{ echo "parameters" }. * exporting a code block with a name :PROPERTIES: @@ -312,7 +312,7 @@ src_sh[]{echo 2} blocks on the src_emacs-lisp[]{"same"} line exporting a code block with a name #+name: qux -#+begin_src sh :foo "baz" +#+begin_src shell :foo "baz" echo bar #+end_src * noweb no-export and exports both @@ -324,13 +324,13 @@ Weird interaction. here is one block #+name: noweb-no-export-and-exports-both-1 -#+BEGIN_SRC sh :exports none +#+BEGIN_SRC shell :exports none echo 1 #+END_SRC and another -#+BEGIN_SRC sh :noweb no-export :exports both +#+BEGIN_SRC shell :noweb no-export :exports both # I am inside the code block <> #+END_SRC @@ -373,11 +373,11 @@ Here is a call line with more than just the results exported. :END: #+name: strip-export-1 -#+BEGIN_SRC sh :exports none +#+BEGIN_SRC shell :exports none i="10" #+END_SRC -#+BEGIN_SRC sh :noweb strip-export :exports code :results silent +#+BEGIN_SRC shell :noweb strip-export :exports code :results silent <> echo "1$i" #+END_SRC @@ -444,7 +444,7 @@ comments for ":var": #+HEADER: :var c=(or (org-entry-get org-babel-current-src-block-location "c" t) "0") #+HEADER: :var d=(or (org-entry-get org-babel-current-src-block-location "d" t) "0") #+HEADER: :var e=(or (org-entry-get org-babel-current-src-block-location "e" t) "0") -#+BEGIN_SRC sh :shebang #!/bin/sh :exports results :results verbatim +#+BEGIN_SRC shell :shebang #!/bin/sh :exports results :results verbatim printf "shell a:$a, b:$b, c:$c, d:$d, e:$e" #+END_SRC diff --git a/testing/examples/ob-shell-test.org b/testing/examples/ob-shell-test.org index a54e5c0..ce4ae79 100644 --- a/testing/examples/ob-shell-test.org +++ b/testing/examples/ob-shell-test.org @@ -22,7 +22,7 @@ :ID: 0ba56632-8dc1-405c-a083-c204bae477cf :END: ** Generic shell: no arrays -#+begin_src sh :exports results :var array=sample_array +#+begin_src shell :exports results :var array=sample_array echo ${array} #+end_src @@ -32,7 +32,7 @@ echo ${array} ** Bash shell: support for arrays Bash will see a simple indexed array. In this test, we check that the returned value is indeed only the first item of the array, as opposed to -the generic serialiation that will return all elements of the array as +the generic serialiation that will return all elements of the array as a single string. #+begin_src bash :exports results :var array=sample_array echo ${array} @@ -47,7 +47,7 @@ echo ${array} :END: ** Generic shell: no special handing The shell will see all values as a single string. -#+begin_src sh :exports results :var table=sample_mapping_table +#+begin_src shell :exports results :var table=sample_mapping_table echo ${table} #+end_src @@ -69,13 +69,13 @@ echo ${table[second]} :ID: 82320a48-3409-49d7-85c9-5de1c6d3ff87 :END: ** Generic shell: no special handing -#+begin_src sh :exports results :var table=sample_big_table +#+begin_src shell :exports results :var table=sample_big_table echo ${table} #+end_src #+RESULTS: : bread 2 kg spaghetti 20 cm milk 50 dl - + ** Bash shell: support for associative arrays with lists Bash will see an associative array that contains each row as a single string. Bash cannot handle lists in associative arrays. @@ -85,4 +85,3 @@ echo ${table[spaghetti]} #+RESULTS: : 20 cm - diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el index 4669c55..940f2d6 100644 --- a/testing/lisp/test-ob-exp.el +++ b/testing/lisp/test-ob-exp.el @@ -1,6 +1,6 @@ ;;; test-ob-exp.el -;; Copyright (c) 2010-2014 Eric Schulte +;; Copyright (c) 2010-2015 Eric Schulte ;; Authors: Eric Schulte ;; This file is not part of GNU Emacs. @@ -239,11 +239,11 @@ Here is one at the end of a line. =2= (should (string-match (replace-regexp-in-string - "\\\\\\[]{" "\\(?:\\[]\\)?{" ;accept both src_sh[]{...} or src_sh{...} - (regexp-quote "Here is one in the middle src_sh[]{echo 1} of a line. -Here is one at the end of a line. src_sh[]{echo 2} -src_sh[]{echo 3} Here is one at the beginning of a line. -Here is one that is also evaluated: src_sh[]{echo 4} =4=") + "\\\\\\[]{" "\\(?:\\[]\\)?{" ;accept both src_shell[]{...} or src_shell{...} + (regexp-quote "Here is one in the middle src_shell[]{echo 1} of a line. +Here is one at the end of a line. src_shell[]{echo 2} +src_shell[]{echo 3} Here is one at the beginning of a line. +Here is one that is also evaluated: src_shell[]{echo 4} =4=") nil t) (org-test-at-id "cd54fc88-1b6b-45b6-8511-4d8fa7fc8076" (org-narrow-to-subtree) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index efde99a..48ffad2 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -1,6 +1,6 @@ ;;; test-ob.el --- tests for ob.el -;; Copyright (c) 2010-2014 Eric Schulte +;; Copyright (c) 2010-2015 Eric Schulte ;; Authors: Eric Schulte, Martyn Jago ;; This file is not part of GNU Emacs. @@ -269,7 +269,7 @@ this is simple" (ert-deftest test-org-babel/org-babel-get-inline-src-block-matches () (flet ((test-at-id (id) - (org-test-at-id + (org-test-at-id id (let ((test-point (point))) (should (fboundp 'org-babel-get-inline-src-block-matches)) @@ -294,7 +294,7 @@ this is simple" (test-at-id "d55dada7-de0e-4340-8061-787cccbedee5"))) (ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-1 () - (let ((test-line "src_sh{echo 1}")) + (let ((test-line "src_shell{echo 1}")) ;; src_ at bol line 1... (org-test-with-temp-text test-line @@ -468,14 +468,14 @@ this is simple" (ert-deftest test-org-babel/combining-scalar-and-raw-result-types () (org-test-with-temp-text-in-file " -#+begin_src sh :results scalar +#+begin_src shell :results scalar echo \"[[file:./cv.cls]]\" #+end_src #+name: : [[file:./cv.cls]] -#+begin_src sh :results raw scalar +#+begin_src shell :results raw scalar echo \"[[file:./cv.cls]]\" #+end_src " @@ -506,7 +506,7 @@ echo \"[[file:./cv.cls]]\" (ert-deftest test-org-babel/just-one-results-block () "Test that evaluating two times the same code block does not result in a duplicate results block." - (org-test-with-temp-text "#+begin_src sh\necho Hello\n#+end_src\n" + (org-test-with-temp-text "#+begin_src shell\necho Hello\n#+end_src\n" (org-babel-execute-src-block) (org-babel-execute-src-block) ; second code block execution (should (search-forward "Hello")) ; the string inside the source code block @@ -666,27 +666,27 @@ on two lines (check-eval "no-export" nil)))) (ert-deftest test-ob/noweb-expansion-1 () - (org-test-with-temp-text "#+begin_src sh :results output :tangle yes + (org-test-with-temp-text "#+begin_src shell :results output :tangle yes <> #+end_src #+name: foo -#+begin_src sh +#+begin_src shell bar #+end_src" (should (string= (org-babel-expand-noweb-references) "bar")))) (ert-deftest test-ob/noweb-expansion-2 () - (org-test-with-temp-text "#+begin_src sh :results output :tangle yes + (org-test-with-temp-text "#+begin_src shell :results output :tangle yes <> #+end_src #+name: foo -#+begin_src sh :noweb-sep \"\" +#+begin_src shell :noweb-sep \"\" bar #+end_src -#+begin_src sh :noweb-ref foo :noweb-sep \"\" +#+begin_src shell :noweb-ref foo :noweb-sep \"\" baz #+end_src" (should (string= (org-babel-expand-noweb-references) "barbaz")))) @@ -809,7 +809,7 @@ If not inserted correctly then the second evaluation will fail trying to find the :END: marker." (org-test-with-temp-text "- indented - #+begin_src sh :results file wrap + #+begin_src shell :results file wrap echo test.txt #+end_src" (org-babel-next-src-block 1) @@ -1137,7 +1137,7 @@ Paragraph" | 1 | bar | | 2 | baz | -#+begin_src sh :var data=input-table :exports results :colnames '(Rev Author) +#+begin_src shell :var data=input-table :exports results :colnames '(Rev Author) echo \"$data\" #+end_src @@ -1155,7 +1155,7 @@ echo \"$data\" | 1 | bar | | 2 | baz | -#+begin_src sh :var data=input-table :exports results :colnames '(Rev Author) +#+begin_src shell :var data=input-table :exports results :colnames '(Rev Author) echo \"$data\" #+end_src " -- 2.1.1