emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ob-shell-test, test-ob-shell and introduction
@ 2021-11-22 18:37 Matt
  2021-11-22 18:43 ` Timothy
  2021-11-22 19:08 ` Thomas S. Dye
  0 siblings, 2 replies; 6+ messages in thread
From: Matt @ 2021-11-22 18:37 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

I'm interested in getting async into ob-shell.el. Since I've never contributed before, I figure it'd be good to start with a few easy tasks.

It looks to me like the stdin and cmdline header args aren't documented anywhere (at least I couldn't find anything). To make sure I'm using them correctly before making a patch for the manual, here are some tests.

Please let me know if things look okay. It wasn't clear to me how to send along a message with git send-email, so I formatted these patches and included them as an attachment. Is that fine?

Thanks,
Matt

[-- Attachment #2: 0001-ob-shell-test.org-Add-example-for-stdin.patch --]
[-- Type: application/octet-stream, Size: 960 bytes --]

From b59ec4c2d949ca4c2d881238393a8de3851315db Mon Sep 17 00:00:00 2001
From: Matt <matt@excalamus.com>
Date: Mon, 22 Nov 2021 13:07:53 -0500
Subject: [PATCH 1/2] ob-shell-test.org:  Add example for stdin

* ob-shell-test.org Add section for testing header args.
---
 testing/examples/ob-shell-test.org | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/testing/examples/ob-shell-test.org b/testing/examples/ob-shell-test.org
index 2510f4f96..39539dc9f 100644
--- a/testing/examples/ob-shell-test.org
+++ b/testing/examples/ob-shell-test.org
@@ -86,3 +86,22 @@ echo ${table[spaghetti]}
 #+RESULTS:
 : 20 cm
 
+* Header arg tests
+  :PROPERTIES:
+  :ID:       cc56f3c6-13ec-4026-9d83-3106efd833e2
+  :END:
+
+** stdin
+#+name: an-org-reference
+org reference line 1
+org reference line 2
+
+#+begin_src sh :stdin an-org-reference :results output
+cat
+#+end_src
+
+#+RESULTS:
+: org reference line 1
+: org reference line 2
+
+
-- 
2.34.0


[-- Attachment #3: 0002-test-ob-shell.el-Add-tests-for-stdin-and-cmdline-hea.patch --]
[-- Type: application/octet-stream, Size: 1364 bytes --]

From b923d17679ba9c7cb88dd40312534c33eff74dd8 Mon Sep 17 00:00:00 2001
From: Matt <matt@excalamus.com>
Date: Mon, 22 Nov 2021 13:14:01 -0500
Subject: [PATCH 2/2] test-ob-shell.el: Add tests for stdin and cmdline header
 args

* test-ob-shell.el (test-ob-shell/stdin, test-ob-shell/cmdline) Add
tests.
---
 testing/lisp/test-ob-shell.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index 2f346f699..b9fcb3819 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -106,6 +106,19 @@ ob-comint.el, which was not previously tested."
 	   "#+BEGIN_SRC sh :results output :var l='(1 2)\necho ${l}\n#+END_SRC"
 	   (org-trim (org-babel-execute-src-block))))))
 
+(ert-deftest test-ob-shell/stdin ()
+  "Confirm stdin passes an org reference"
+  (org-test-at-id "cc56f3c6-13ec-4026-9d83-3106efd833e2"
+    (org-babel-next-src-block)
+    (should (equal "org reference line 1\norg reference line 2"
+                   (org-trim (org-babel-execute-src-block))))))
+
+(ert-deftest test-ob-shell/cmdline ()
+  "Confirm cmdline header gets passed in as an argument."
+  (let ((res (org-babel-execute:sh "echo $1;" '((:cmdline . "foo")))))
+    (should res)
+    (should (equal "foo" res))))
+
 (provide 'test-ob-shell)
 
 ;;; test-ob-shell.el ends here
-- 
2.34.0


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

* Re: [PATCH] ob-shell-test, test-ob-shell and introduction
  2021-11-22 18:37 [PATCH] ob-shell-test, test-ob-shell and introduction Matt
@ 2021-11-22 18:43 ` Timothy
  2021-11-24 18:48   ` Matt
  2021-11-22 19:08 ` Thomas S. Dye
  1 sibling, 1 reply; 6+ messages in thread
From: Timothy @ 2021-11-22 18:43 UTC (permalink / raw)
  To: Matt; +Cc: emacs-orgmode

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

Hi Matt,

> I’m interested in getting async into ob-shell.el. Since I’ve never contributed
>before, I figure it’d be good to start with a few easy tasks.

Fantastic! Great to hear from you, and I hope it goes well. Feel free to send
further emails for if you get stuck. If you intend to do more than just one or
two small tweaks (it sounds like you have bigger plans than that), you’ll need
what’s known as [FSF copyright assignment]. Have you done that yet?

> It looks to me like the stdin and cmdline header args aren’t documented anywhere
> (at least I couldn’t find anything). To make sure I’m using them correctly
> before making a patch for the manual, here are some tests.

Great! I’m not overly familiar with these, so I’ll leave other people to take a
look at the tests you’ve written, but your approach sounds good. 👍

> Please let me know if things look okay. It wasn’t clear to me how to send along
> a message with git send-email, so I formatted these patches and included them as
> an attachment. Is that fine?

Patches attached to an email are perfectly fine here.
Thanks for getting in touch, and I hope to see you around 🙂.

All the best,
Timothy


[FSF copyright assignment] <https://orgmode.org/contribute.html#copyright>

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

* Re: [PATCH] ob-shell-test, test-ob-shell and introduction
  2021-11-22 18:37 [PATCH] ob-shell-test, test-ob-shell and introduction Matt
  2021-11-22 18:43 ` Timothy
@ 2021-11-22 19:08 ` Thomas S. Dye
  2021-11-23  4:42   ` [PATCH] ob-doc-shell.org (was [PATCH] ob-shell-test, test-ob-shell and introduction) Matt
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2021-11-22 19:08 UTC (permalink / raw)
  To: emacs-orgmode

Aloha Matt,

Matt <matt@excalamus.com> writes:

> Hi,
>
> I'm interested in getting async into ob-shell.el. Since I've 
> never contributed before, I figure it'd be good to start with a 
> few easy tasks.
>
> It looks to me like the stdin and cmdline header args aren't 
> documented anywhere (at least I couldn't find anything). To make 
> sure I'm using them correctly before making a patch for the 
> manual, here are some tests.
>
> Please let me know if things look okay. It wasn't clear to me 
> how to send along a message with git send-email, so I formatted 
> these patches and included them as an attachment. Is that fine?
>
> Thanks,
> Matt

Unfortunately, there is no ob-doc-shell.org at 
worg/org-contrib/babel/languages/.

There is an ob-doc-template.org in case you'd like to contribute 
ob-doc-shell.org :)

All the best,
Tom
-- 
Thomas S. Dye
https://tsdye.online/tsdye


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

* [PATCH] ob-doc-shell.org (was [PATCH] ob-shell-test, test-ob-shell and introduction)
  2021-11-22 19:08 ` Thomas S. Dye
@ 2021-11-23  4:42   ` Matt
  2021-11-23  4:59     ` Thomas S. Dye
  0 siblings, 1 reply; 6+ messages in thread
From: Matt @ 2021-11-23  4:42 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

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

 > Unfortunately, there is no ob-doc-shell.org at 
 > worg/org-contrib/babel/languages/.
 > 
 > There is an ob-doc-template.org in case you'd like to contribute 
 > ob-doc-shell.org :)

I created one, along with a sourcehut account. However, it looks like I need to be granted some permissions to write to the worg website. Is Bastien the contact for that? I've attached a patch in the mean time.

[-- Attachment #2: 0001-org-contrib-babel-languages-ob-doc-shell.org-Create-.patch --]
[-- Type: application/octet-stream, Size: 4295 bytes --]

From 682eb6bd14d7d7246e3f13517adcd9ffb1a38ae0 Mon Sep 17 00:00:00 2001
From: Matt <matt@excalamus.com>
Date: Mon, 22 Nov 2021 22:57:38 -0500
Subject: [PATCH] org-contrib/babel/languages/ob-doc-shell.org: Create file

* ob-doc-shell.org Create file.  Fill out links and images.
---
 org-contrib/babel/languages/ob-doc-shell.org | 86 ++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 org-contrib/babel/languages/ob-doc-shell.org

diff --git a/org-contrib/babel/languages/ob-doc-shell.org b/org-contrib/babel/languages/ob-doc-shell.org
new file mode 100644
index 00000000..46ce0a6f
--- /dev/null
+++ b/org-contrib/babel/languages/ob-doc-shell.org
@@ -0,0 +1,86 @@
+#+OPTIONS:    H:3 num:nil toc:2 \n:nil ::t |:t ^:{} -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc broken-links:nil
+#+STARTUP:    align fold nodlcheck hidestars oddeven lognotestate hideblocks
+#+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
+#+TAGS:       Write(w) Update(u) Fix(f) Check(c) noexport(n)
+#+TITLE:      Shell Source Code Blocks in Org Mode
+#+AUTHOR:     Matt Trzcinski
+#+EMAIL:      matt[at]excalamus[dot]com
+#+LANGUAGE:   en
+#+HTML_LINK_UP:    index.html
+#+HTML_LINK_HOME:  https://orgmode.org/worg/
+#+EXCLUDE_TAGS: noexport
+
+#+name: banner
+#+begin_export html
+<div id="subtitle" style="float: center; text-align: center;">
+  <p>
+    Babel shell support, including: <a href="https://www.gnu.org/software/bash/">sh</a>,
+    <a href="https://www.gnu.org/software/bash/">bash</a>,
+    <a href="https://www.zsh.org/">zsh</a>,
+    <a href="https://fishshell.com/">fish</a>,
+    <a href="https://www.grymoire.com/unix/csh.html">csh</a>,
+    <a href="https://www.in-ulm.de/~mascheck/various/ash/">ash</a>,
+    <a href="http://gondor.apana.org.au/~herbert/dash/">dash</a>,
+    <a href="http://www.kornshell.org/">ksh</a>,
+    <a href="https://www.mirbsd.org/mksh.htm">mksh</a>, and
+    <a href="https://packages.qa.debian.org/p/posh.html">posh</a>.
+  </p>
+  <p>
+    <a href="https://www.gnu.org/software/bash/">
+      <img src="https://tiswww.case.edu/php/chet/img/bash-logo-web.png"/>
+    </a>
+    <a href="https://www.zsh.org/">zsh</a>,
+      <img src="https://zsh.sourceforge.io/Images/wizard.gif"/>
+    </a>
+    <a href="https://fishshell.com/">fish</a>,
+      <img src="https://fishshell.com/assets/img/Terminal_Logo2_CRT_Flat.png"/>
+    </a>
+    <a href="http://www.kornshell.org/">ksh</a>,
+      <img src="http://www.kornshell.org/kornshell.gif"/>
+    </a>
+    <a href="https://www.mirbsd.org/mksh.htm">mksh</a>, and
+      <img src="https://www.mirbsd.org/pics/logo-grey.png"/>
+    </a>
+  </p>
+</div>
+#+end_export
+
+* Template Checklist [4/12]                                        :noexport:
+  - [X] Revise #+TITLE:
+  - [X] Indicate #+AUTHOR:
+  - [X] Add #+EMAIL:
+  - [X] Revise banner source block [3/3]
+    - [X] Add link to a useful language web site
+    - [X] Replace "Language" with language name
+    - [X] Find a suitable graphic and use it to link to the language
+      web site
+  - [ ] Write an [[Introduction]]
+  - [ ] Describe [[Requirements and Setup][Requirements and Setup]]
+  - [ ] Replace "Language" with language name in [[Org Mode Features for Language Source Code Blocks][Babel Features for Language Source Code Blocks]]
+  - [ ] Describe [[Header Arguments][Header Arguments]]
+  - [ ] Describe support for [[Sessions]]
+  - [ ] Describe [[Result Types][Result Types]]
+  - [ ] Describe [[Other]] differences from supported languages
+  - [ ] Provide brief [[Examples of Use][Examples of Use]]
+* Introduction
+  - Brief description of language.
+  - Range of typical uses within Org Mode.
+* Requirements and Setup
+  - Installation and configuration of language software
+  - Emacs configuration
+  - Org-mode configuration (org-babel-do-load-languages)
+* Babel Features for Language Source Code Blocks
+** Header Arguments
+   - Language-specific default values
+   - Language-specific header arguments
+** Sessions
+   - Support or not
+   - Typical use for sessions
+** Result Types
+   - Which result types are supported?
+** Other
+   - Differences from other supported languages
+* Examples of Use
+  - Hello World!
+  - Common uses
+  - Links to tutorials and other resources
-- 
2.34.0


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

* Re: [PATCH] ob-doc-shell.org (was [PATCH] ob-shell-test, test-ob-shell and introduction)
  2021-11-23  4:42   ` [PATCH] ob-doc-shell.org (was [PATCH] ob-shell-test, test-ob-shell and introduction) Matt
@ 2021-11-23  4:59     ` Thomas S. Dye
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas S. Dye @ 2021-11-23  4:59 UTC (permalink / raw)
  To: Matt; +Cc: emacs-orgmode

Aloha Matt,
Matt <matt@excalamus.com> writes:

>  > Unfortunately, there is no ob-doc-shell.org at 
>  > worg/org-contrib/babel/languages/.
>  > 
>  > There is an ob-doc-template.org in case you'd like to 
>  > contribute 
>  > ob-doc-shell.org :)
>
> I created one, along with a sourcehut account. However, it looks 
> like I need to be granted some permissions to write to the worg 
> website. Is Bastien the contact for that? I've attached a patch 
> in the mean time.

That's a good start.  Thanks!

Yes, contact Bastien directly off list with your sourcehut user 
name and he'll set you up to push directly to Worg.

Let me know if you have questions.

All the best,
Tom

-- 
Thomas S. Dye
https://tsdye.online/tsdye


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

* Re: [PATCH] ob-shell-test, test-ob-shell and introduction
  2021-11-22 18:43 ` Timothy
@ 2021-11-24 18:48   ` Matt
  0 siblings, 0 replies; 6+ messages in thread
From: Matt @ 2021-11-24 18:48 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode


 > [FSF copyright assignment]. Have you done that yet?
 
I just verified with my employer that my contract grants an exception for this project.  Just emailed the request to assign@gnu.org.  Also, got access from Bastien for worg. I figure it's probably best to reserve any more changes 'til the paper work is done?
 



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

end of thread, other threads:[~2021-11-24 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 18:37 [PATCH] ob-shell-test, test-ob-shell and introduction Matt
2021-11-22 18:43 ` Timothy
2021-11-24 18:48   ` Matt
2021-11-22 19:08 ` Thomas S. Dye
2021-11-23  4:42   ` [PATCH] ob-doc-shell.org (was [PATCH] ob-shell-test, test-ob-shell and introduction) Matt
2021-11-23  4:59     ` Thomas S. Dye

Code repositories for project(s) associated with this 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).