emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Add ob-sclang.el for sclang Org-mode babel support in contrib/
@ 2017-06-09  0:43 numbchild
  2017-06-10  8:17 ` Nicolas Goaziou
  0 siblings, 1 reply; 26+ messages in thread
From: numbchild @ 2017-06-09  0:43 UTC (permalink / raw)
  To: Org-mode

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

Here is my branch
https://github.com/stardiviner/org-mode/tree/feature/ob-sclang
Merge this branch?

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

[-- Attachment #2: Type: text/html, Size: 928 bytes --]

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-09  0:43 Add ob-sclang.el for sclang Org-mode babel support in contrib/ numbchild
@ 2017-06-10  8:17 ` Nicolas Goaziou
  2017-06-11  2:02   ` numbchild
  0 siblings, 1 reply; 26+ messages in thread
From: Nicolas Goaziou @ 2017-06-10  8:17 UTC (permalink / raw)
  To: numbchild@gmail.com; +Cc: Org-mode

Hello,

"numbchild@gmail.com" <numbchild@gmail.com> writes:

> Here is my branch
> https://github.com/stardiviner/org-mode/tree/feature/ob-sclang
> Merge this branch?

Thank you for your work.

I'd like to refrain more packages to contrib, unless the intent is to
eventually merge them into core later.

However, I think this can go into core. Would you like to clean it up
a bit, activate lexical-binding, provide some tests, and send a patch
(using git format-patch)?

You will need to sign FSF papers to do that, if you haven't done
already. If you are willing to do this, we can also move your library to
"contrib/" temporarily.

Regards,

-- 
Nicolas Goaziou

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-10  8:17 ` Nicolas Goaziou
@ 2017-06-11  2:02   ` numbchild
  2017-06-14 14:02     ` Nicolas Goaziou
  0 siblings, 1 reply; 26+ messages in thread
From: numbchild @ 2017-06-11  2:02 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

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

Yeah, I have used to contrib to org-mode, but need to sign FSF papers spend
my time, and I don't know how. So I decide to move code in `contrib/`.
When I back home, I will try to sign FSF papers, because I have time and
fixed location.
If I move code into `contrib/`, do I need to do more in this code?
I will add `lexical-binding`, but don't know how to write test for this.
Could org-mode team pull branch code on my github repo directory? Or should
I send a patch from `git format-patch`?

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Sat, Jun 10, 2017 at 4:17 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > Here is my branch
> > https://github.com/stardiviner/org-mode/tree/feature/ob-sclang
> > Merge this branch?
>
> Thank you for your work.
>
> I'd like to refrain more packages to contrib, unless the intent is to
> eventually merge them into core later.
>
> However, I think this can go into core. Would you like to clean it up
> a bit, activate lexical-binding, provide some tests, and send a patch
> (using git format-patch)?
>
> You will need to sign FSF papers to do that, if you haven't done
> already. If you are willing to do this, we can also move your library to
> "contrib/" temporarily.
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 2880 bytes --]

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-11  2:02   ` numbchild
@ 2017-06-14 14:02     ` Nicolas Goaziou
  2017-06-15  6:21       ` Bastien Guerry
  2017-06-15 11:14       ` numbchild
  0 siblings, 2 replies; 26+ messages in thread
From: Nicolas Goaziou @ 2017-06-14 14:02 UTC (permalink / raw)
  To: numbchild@gmail.com; +Cc: Bastien Guerry, Org-mode

Hello,

"numbchild@gmail.com" <numbchild@gmail.com> writes:

> Yeah, I have used to contrib to org-mode, but need to sign FSF papers spend
> my time, and I don't know how.

See <http://orgmode.org/worg/org-contribute.html>, in particular
"Copyright issues when contributing to Emacs Org mode".

> So I decide to move code in `contrib/`.
> When I back home, I will try to sign FSF papers, because I have time and
> fixed location.

> If I move code into `contrib/`, do I need to do more in this code?

If you we move it into "contrib/" until FSF papers are ready, you need
to have access to repository. Thus, you will be able to update the
library whenever you see fit. I'm Cc'ing Bastien about it.

> I will add `lexical-binding`, but don't know how to write test for
> this.

You don't need to write a test for that.

> Could org-mode team pull branch code on my github repo directory? Or should
> I send a patch from `git format-patch`?

Please send a patch.

Regards,

-- 
Nicolas Goaziou

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-14 14:02     ` Nicolas Goaziou
@ 2017-06-15  6:21       ` Bastien Guerry
  2017-06-15  7:53         ` numbchild
  2017-06-15 11:14       ` numbchild
  1 sibling, 1 reply; 26+ messages in thread
From: Bastien Guerry @ 2017-06-15  6:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Hi,

if you need commit access to org-mode to add code to contrib/,
please send me your public key (the one in ~/.ssh/id...).

Best,

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-15  6:21       ` Bastien Guerry
@ 2017-06-15  7:53         ` numbchild
  2017-06-15  7:56           ` numbchild
  0 siblings, 1 reply; 26+ messages in thread
From: numbchild @ 2017-06-15  7:53 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode, Nicolas Goaziou

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

@Bastien my SSH public key is:
```
ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQDIXnylmZoh1WzQnEx0Cf/bpeqfuXVTLXza2jtRTDNYzIgZpRATsRhnSkdFC+t8bgkt7vTur1PiAzFgXYQKTs5BNYsiMFc3j2dnxLWzRCQfVi7DhPJ/VfgyyL4tv3LkMbx7vzOUlRJrIRWsnnxiY31rx5xaJbKiF8t9GEz5ycqgW3D5lp60TE/sYCcSTlhRvenJYTcFr1+KFFIGPps5yMayyIZQgEumqln7z7Ar+xz3wA2FKRqbkv1DtaTJj9SbE1MFSYcSel8sX7kIw6Xzze5UMTgFjIEavIMN2LMsvwGdrgI98em+dtjXUjSSA/VNEfdm0JKLRl1tEBCOOZ/all7R
/home/stardiviner/.ssh/id_rsa
```

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Thu, Jun 15, 2017 at 2:21 PM, Bastien Guerry <bzg@gnu.org> wrote:

> Hi,
>
> if you need commit access to org-mode to add code to contrib/,
> please send me your public key (the one in ~/.ssh/id...).
>
> Best,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1898 bytes --]

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-15  7:53         ` numbchild
@ 2017-06-15  7:56           ` numbchild
  2017-06-15  8:26             ` Bastien Guerry
  0 siblings, 1 reply; 26+ messages in thread
From: numbchild @ 2017-06-15  7:56 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode, Nicolas Goaziou

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

Sorry, update SSH public key:
The previous message ssh public key is generated from command: `ssh-add -L`.
This one is from `cat ~/.ssh/id_rsa.pub`
```
ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQDIXnylmZoh1WzQnEx0Cf/bpeqfuXVTLXza2jtRTDNYzIgZpRATsRhnSkdFC+t8bgkt7vTur1PiAzFgXYQKTs5BNYsiMFc3j2dnxLWzRCQfVi7DhPJ/VfgyyL4tv3LkMbx7vzOUlRJrIRWsnnxiY31rx5xaJbKiF8t9GEz5ycqgW3D5lp60TE/sYCcSTlhRvenJYTcFr1+KFFIGPps5yMayyIZQgEumqln7z7Ar+xz3wA2FKRqbkv1DtaTJj9SbE1MFSYcSel8sX7kIw6Xzze5UMTgFjIEavIMN2LMsvwGdrgI98em+dtjXUjSSA/VNEfdm0JKLRl1tEBCOOZ/all7R
stardiviner@dark
```

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Thu, Jun 15, 2017 at 3:53 PM, numbchild@gmail.com <numbchild@gmail.com>
wrote:

> @Bastien my SSH public key is:
> ```
> ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIXnylmZoh1WzQnEx0Cf/
> bpeqfuXVTLXza2jtRTDNYzIgZpRATsRhnSkdFC+t8bgkt7vTur1PiAzFgXYQKTs5BNYsi
> MFc3j2dnxLWzRCQfVi7DhPJ/VfgyyL4tv3LkMbx7vzOUlRJrIRWsnn
> xiY31rx5xaJbKiF8t9GEz5ycqgW3D5lp60TE/sYCcSTlhRvenJYTcFr1+
> KFFIGPps5yMayyIZQgEumqln7z7Ar+xz3wA2FKRqbkv1DtaTJj9SbE1MFSYc
> Sel8sX7kIw6Xzze5UMTgFjIEavIMN2LMsvwGdrgI98em+dtjXUjSSA/VNEfdm0JKLRl1tEBCOOZ/all7R
> /home/stardiviner/.ssh/id_rsa
> ```
>
> [stardiviner]           <Hack this world!>      GPG key ID: 47C32433
> IRC(freeenode): stardiviner                     Twitter:  @numbchild
> Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
> Blog: http://stardiviner.github.io/
>
> On Thu, Jun 15, 2017 at 2:21 PM, Bastien Guerry <bzg@gnu.org> wrote:
>
>> Hi,
>>
>> if you need commit access to org-mode to add code to contrib/,
>> please send me your public key (the one in ~/.ssh/id...).
>>
>> Best,
>>
>> --
>>  Bastien
>>
>
>

[-- Attachment #2: Type: text/html, Size: 4073 bytes --]

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-15  7:56           ` numbchild
@ 2017-06-15  8:26             ` Bastien Guerry
  2017-06-15 11:19               ` numbchild
  0 siblings, 1 reply; 26+ messages in thread
From: Bastien Guerry @ 2017-06-15  8:26 UTC (permalink / raw)
  To: numbchild@gmail.com; +Cc: Org-mode, Nicolas Goaziou

"numbchild@gmail.com" <numbchild@gmail.com> writes:

> Sorry, update SSH public key:

Please resend it as an attachment in a private email.

Thanks,

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-14 14:02     ` Nicolas Goaziou
  2017-06-15  6:21       ` Bastien Guerry
@ 2017-06-15 11:14       ` numbchild
  2017-06-15 12:38         ` Bastien Guerry
  1 sibling, 1 reply; 26+ messages in thread
From: numbchild @ 2017-06-15 11:14 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien Guerry, Org-mode


[-- Attachment #1.1: Type: text/plain, Size: 5356 bytes --]

Here is the patch

#+BEGIN_SRC diff
From 8bea0293ae22046bd4878a0ef9add5acd074bfde Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Thu, 8 Jun 2017 18:24:53 +0800
Subject: [PATCH] add ob-sclang for sclang Org-mode babel support

---
 contrib/lisp/ob-sclang.el | 102
++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 contrib/lisp/ob-sclang.el

diff --git a/contrib/lisp/ob-sclang.el b/contrib/lisp/ob-sclang.el
new file mode 100644
index 000000000..763799533
--- /dev/null
+++ b/contrib/lisp/ob-sclang.el
@@ -0,0 +1,102 @@
+;;; ob-sclang.el --- SCLang support for Org-mode Babel -*-
lexical-binding: t; -*-
+;;; -*- coding: utf-8 -*-
+
+;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
+
+;; Authors: stardiviner <numbchild@gmail.com>
+;; Package-Version: 0.1
+;; Keywords: babel sclang
+
+;; This file is not part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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:
+
+;; `ob-sclang' requires `sclang-interp' from SuperCollider.
+;; Usually SuperCollider dependencies for Emacs are at
/usr/share/emacs/site-lisp/SuperCollider/
+;; You can install SuperCollider following this article:
+;; https://github.com/supercollider/supercollider#building-the-source-code
+
+;; Usage:
+
+;; Support to evaluate sclang Org-mode src block with function
`sclang-eval-string'.
+
+;; For example:
+
+;; #+BEGIN_SRC sclang :results none
+;; "Hello World".postln;
+;; #+END_SRC
+;;
+;; *NOTE* Temporary output to org-babel result output is not supported.
+;; Because `sclang-eval-string' will send output to Sclang Post Buffer.
+;; And command line `sclang' execute will not automatically stop after
finished execution.
+;;
+;; #+BEGIN_SRC sclang :results none
+;; // modulate a sine frequency and a noise amplitude with another sine
+;; // whose frequency depends on the horizontal mouse pointer position
+;; {
+;; var x = SinOsc.ar(MouseX.kr(1, 100));
+;; SinOsc.ar(300 * x + 800, 0, 0.1)
+;; +
+;; PinkNoise.ar(0.1 * x + 0.1)
+;; }.play;
+;; #+END_SRC
+
+
+;;; Code:
+;;;
----------------------------------------------------------------------------
+(require 'org)
+(require 'ob)
+
+(require 'sclang-interp)
+
+(defgroup ob-sclang nil
+  "org-mode blocks for SuperCollider SCLang."
+  :group 'org)
+
+;;;###autoload
+(defun org-babel-execute:sclang (body params)
+  "Org-mode Babel sclang hook for evaluate `BODY' with `PARAMS'."
+  (unless (or (equal (buffer-name) sclang-post-buffer)
+              (sclang-get-process))
+    (sclang-start))
+
+  ;; (let* ((db (or (cdr (assoc :db params))
+  ;;                ob-mongo:default-db))
+  ;;        (cmd (mapconcat 'identity (list "mongo" "--quiet" db) " ")))
+  ;;   (org-babel-eval cmd body))
+
+  (sclang-eval-string body t)
+
+  ;; (let ((cmd "sclang -r -s -D"))
+  ;;   (org-babel-eval cmd body))
+  )
+
+(defvar org-babel-default-header-args:sclang nil)
+
+(setq org-babel-default-header-args:sclang
+      '((:session . "*SCLang:Workspace*")
+        (:output . "none")) ; TODO: temporary can't find way to let sclang
output to stdout for org-babel.
+      )
+
+;;;###autoload
+(with-eval-after-load "org"
+  (add-to-list 'org-src-lang-modes '("sclang" . sclang)))
+
+;;;
----------------------------------------------------------------------------
+
+(provide 'ob-sclang)
+
+;;; ob-sclang.el ends here
-- 
2.13.1
#+END_SRC

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Wed, Jun 14, 2017 at 10:02 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > Yeah, I have used to contrib to org-mode, but need to sign FSF papers
> spend
> > my time, and I don't know how.
>
> See <http://orgmode.org/worg/org-contribute.html>, in particular
> "Copyright issues when contributing to Emacs Org mode".
>
> > So I decide to move code in `contrib/`.
> > When I back home, I will try to sign FSF papers, because I have time and
> > fixed location.
>
> > If I move code into `contrib/`, do I need to do more in this code?
>
> If you we move it into "contrib/" until FSF papers are ready, you need
> to have access to repository. Thus, you will be able to update the
> library whenever you see fit. I'm Cc'ing Bastien about it.
>
> > I will add `lexical-binding`, but don't know how to write test for
> > this.
>
> You don't need to write a test for that.
>
> > Could org-mode team pull branch code on my github repo directory? Or
> should
> > I send a patch from `git format-patch`?
>
> Please send a patch.
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #1.2: Type: text/html, Size: 16542 bytes --]

[-- Attachment #2: 0001-add-ob-sclang-for-sclang-Org-mode-babel-support.patch --]
[-- Type: text/x-patch, Size: 3934 bytes --]

From 8bea0293ae22046bd4878a0ef9add5acd074bfde Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Thu, 8 Jun 2017 18:24:53 +0800
Subject: [PATCH] add ob-sclang for sclang Org-mode babel support

---
 contrib/lisp/ob-sclang.el | 102 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 contrib/lisp/ob-sclang.el

diff --git a/contrib/lisp/ob-sclang.el b/contrib/lisp/ob-sclang.el
new file mode 100644
index 000000000..763799533
--- /dev/null
+++ b/contrib/lisp/ob-sclang.el
@@ -0,0 +1,102 @@
+;;; ob-sclang.el --- SCLang support for Org-mode Babel -*- lexical-binding: t; -*-
+;;; -*- coding: utf-8 -*-
+
+;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
+
+;; Authors: stardiviner <numbchild@gmail.com>
+;; Package-Version: 0.1
+;; Keywords: babel sclang
+
+;; This file is not part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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:
+
+;; `ob-sclang' requires `sclang-interp' from SuperCollider.
+;; Usually SuperCollider dependencies for Emacs are at /usr/share/emacs/site-lisp/SuperCollider/
+;; You can install SuperCollider following this article:
+;; https://github.com/supercollider/supercollider#building-the-source-code
+
+;; Usage:
+
+;; Support to evaluate sclang Org-mode src block with function `sclang-eval-string'.
+
+;; For example:
+
+;; #+BEGIN_SRC sclang :results none
+;; "Hello World".postln;
+;; #+END_SRC
+;;
+;; *NOTE* Temporary output to org-babel result output is not supported.
+;; Because `sclang-eval-string' will send output to Sclang Post Buffer.
+;; And command line `sclang' execute will not automatically stop after finished execution.
+;;
+;; #+BEGIN_SRC sclang :results none
+;; // modulate a sine frequency and a noise amplitude with another sine
+;; // whose frequency depends on the horizontal mouse pointer position
+;; {
+;; var x = SinOsc.ar(MouseX.kr(1, 100));
+;; SinOsc.ar(300 * x + 800, 0, 0.1)
+;; +
+;; PinkNoise.ar(0.1 * x + 0.1)
+;; }.play;
+;; #+END_SRC
+
+
+;;; Code:
+;;; ----------------------------------------------------------------------------
+(require 'org)
+(require 'ob)
+
+(require 'sclang-interp)
+
+(defgroup ob-sclang nil
+  "org-mode blocks for SuperCollider SCLang."
+  :group 'org)
+
+;;;###autoload
+(defun org-babel-execute:sclang (body params)
+  "Org-mode Babel sclang hook for evaluate `BODY' with `PARAMS'."
+  (unless (or (equal (buffer-name) sclang-post-buffer)
+              (sclang-get-process))
+    (sclang-start))
+  
+  ;; (let* ((db (or (cdr (assoc :db params))
+  ;;                ob-mongo:default-db))
+  ;;        (cmd (mapconcat 'identity (list "mongo" "--quiet" db) " ")))
+  ;;   (org-babel-eval cmd body))
+  
+  (sclang-eval-string body t)
+
+  ;; (let ((cmd "sclang -r -s -D"))
+  ;;   (org-babel-eval cmd body))
+  )
+
+(defvar org-babel-default-header-args:sclang nil)
+
+(setq org-babel-default-header-args:sclang
+      '((:session . "*SCLang:Workspace*")
+        (:output . "none")) ; TODO: temporary can't find way to let sclang output to stdout for org-babel.
+      )
+
+;;;###autoload
+(with-eval-after-load "org"
+  (add-to-list 'org-src-lang-modes '("sclang" . sclang)))
+
+;;; ----------------------------------------------------------------------------
+
+(provide 'ob-sclang)
+
+;;; ob-sclang.el ends here
-- 
2.13.1


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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-15  8:26             ` Bastien Guerry
@ 2017-06-15 11:19               ` numbchild
  0 siblings, 0 replies; 26+ messages in thread
From: numbchild @ 2017-06-15 11:19 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode, Nicolas Goaziou

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

I have resend it to your privately in email attachment. Thanks.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Thu, Jun 15, 2017 at 4:26 PM, Bastien Guerry <bzg@gnu.org> wrote:

> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > Sorry, update SSH public key:
>
> Please resend it as an attachment in a private email.
>
> Thanks,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1398 bytes --]

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-15 11:14       ` numbchild
@ 2017-06-15 12:38         ` Bastien Guerry
  2017-06-16 23:25           ` numbchild
  0 siblings, 1 reply; 26+ messages in thread
From: Bastien Guerry @ 2017-06-15 12:38 UTC (permalink / raw)
  To: numbchild@gmail.com; +Cc: Org-mode, Nicolas Goaziou

"numbchild@gmail.com" <numbchild@gmail.com> writes:

> Here is the patch

The patch needs to have a proper changelog.  You can read
http://orgmode.org/worg/org-contribute.html#patches carefully
for details.

Thanks!

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-15 12:38         ` Bastien Guerry
@ 2017-06-16 23:25           ` numbchild
  2017-06-17 10:53             ` Bastien Guerry
  0 siblings, 1 reply; 26+ messages in thread
From: numbchild @ 2017-06-16 23:25 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode, Nicolas Goaziou


[-- Attachment #1.1: Type: text/plain, Size: 4734 bytes --]

I regenerated commit and patch by following changelog formats.

```
From 9f0b5051bda5ae458242e37923ad18e3189663d9 Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Thu, 8 Jun 2017 18:24:53 +0800
Subject: [PATCH] ob-sclang.el: add ob-sclang for sclang Org-mode babel
support

* ob-sclang.el (org-babel-execute:sclang): support evaluating sclang
  code in Org-mode Babel.

Support sclang evaluation in Org-mode Babel.

TINYCHANGE
---
 contrib/lisp/ob-sclang.el | 102
++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 contrib/lisp/ob-sclang.el

diff --git a/contrib/lisp/ob-sclang.el b/contrib/lisp/ob-sclang.el
new file mode 100644
index 000000000..763799533
--- /dev/null
+++ b/contrib/lisp/ob-sclang.el
@@ -0,0 +1,102 @@
+;;; ob-sclang.el --- SCLang support for Org-mode Babel -*-
lexical-binding: t; -*-
+;;; -*- coding: utf-8 -*-
+
+;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
+
+;; Authors: stardiviner <numbchild@gmail.com>
+;; Package-Version: 0.1
+;; Keywords: babel sclang
+
+;; This file is not part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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:
+
+;; `ob-sclang' requires `sclang-interp' from SuperCollider.
+;; Usually SuperCollider dependencies for Emacs are at
/usr/share/emacs/site-lisp/SuperCollider/
+;; You can install SuperCollider following this article:
+;; https://github.com/supercollider/supercollider#building-the-source-code
+
+;; Usage:
+
+;; Support to evaluate sclang Org-mode src block with function
`sclang-eval-string'.
+
+;; For example:
+
+;; #+BEGIN_SRC sclang :results none
+;; "Hello World".postln;
+;; #+END_SRC
+;;
+;; *NOTE* Temporary output to org-babel result output is not supported.
+;; Because `sclang-eval-string' will send output to Sclang Post Buffer.
+;; And command line `sclang' execute will not automatically stop after
finished execution.
+;;
+;; #+BEGIN_SRC sclang :results none
+;; // modulate a sine frequency and a noise amplitude with another sine
+;; // whose frequency depends on the horizontal mouse pointer position
+;; {
+;; var x = SinOsc.ar(MouseX.kr(1, 100));
+;; SinOsc.ar(300 * x + 800, 0, 0.1)
+;; +
+;; PinkNoise.ar(0.1 * x + 0.1)
+;; }.play;
+;; #+END_SRC
+
+
+;;; Code:
+;;;
----------------------------------------------------------------------------
+(require 'org)
+(require 'ob)
+
+(require 'sclang-interp)
+
+(defgroup ob-sclang nil
+  "org-mode blocks for SuperCollider SCLang."
+  :group 'org)
+
+;;;###autoload
+(defun org-babel-execute:sclang (body params)
+  "Org-mode Babel sclang hook for evaluate `BODY' with `PARAMS'."
+  (unless (or (equal (buffer-name) sclang-post-buffer)
+              (sclang-get-process))
+    (sclang-start))
+
+  ;; (let* ((db (or (cdr (assoc :db params))
+  ;;                ob-mongo:default-db))
+  ;;        (cmd (mapconcat 'identity (list "mongo" "--quiet" db) " ")))
+  ;;   (org-babel-eval cmd body))
+
+  (sclang-eval-string body t)
+
+  ;; (let ((cmd "sclang -r -s -D"))
+  ;;   (org-babel-eval cmd body))
+  )
+
+(defvar org-babel-default-header-args:sclang nil)
+
+(setq org-babel-default-header-args:sclang
+      '((:session . "*SCLang:Workspace*")
+        (:output . "none")) ; TODO: temporary can't find way to let sclang
output to stdout for org-babel.
+      )
+
+;;;###autoload
+(with-eval-after-load "org"
+  (add-to-list 'org-src-lang-modes '("sclang" . sclang)))
+
+;;;
----------------------------------------------------------------------------
+
+(provide 'ob-sclang)
+
+;;; ob-sclang.el ends here
-- 
2.13.1
```

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Thu, Jun 15, 2017 at 8:38 PM, Bastien Guerry <bzg@gnu.org> wrote:

> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > Here is the patch
>
> The patch needs to have a proper changelog.  You can read
> http://orgmode.org/worg/org-contribute.html#patches carefully
> for details.
>
> Thanks!
>
> --
>  Bastien
>

[-- Attachment #1.2: Type: text/html, Size: 16159 bytes --]

[-- Attachment #2: 0001-ob-sclang.el-add-ob-sclang-for-sclang-Org-mode-babel.patch --]
[-- Type: text/x-patch, Size: 4101 bytes --]

From 9f0b5051bda5ae458242e37923ad18e3189663d9 Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Thu, 8 Jun 2017 18:24:53 +0800
Subject: [PATCH] ob-sclang.el: add ob-sclang for sclang Org-mode babel support

* ob-sclang.el (org-babel-execute:sclang): support evaluating sclang
  code in Org-mode Babel.

Support sclang evaluation in Org-mode Babel.

TINYCHANGE
---
 contrib/lisp/ob-sclang.el | 102 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 contrib/lisp/ob-sclang.el

diff --git a/contrib/lisp/ob-sclang.el b/contrib/lisp/ob-sclang.el
new file mode 100644
index 000000000..763799533
--- /dev/null
+++ b/contrib/lisp/ob-sclang.el
@@ -0,0 +1,102 @@
+;;; ob-sclang.el --- SCLang support for Org-mode Babel -*- lexical-binding: t; -*-
+;;; -*- coding: utf-8 -*-
+
+;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
+
+;; Authors: stardiviner <numbchild@gmail.com>
+;; Package-Version: 0.1
+;; Keywords: babel sclang
+
+;; This file is not part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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:
+
+;; `ob-sclang' requires `sclang-interp' from SuperCollider.
+;; Usually SuperCollider dependencies for Emacs are at /usr/share/emacs/site-lisp/SuperCollider/
+;; You can install SuperCollider following this article:
+;; https://github.com/supercollider/supercollider#building-the-source-code
+
+;; Usage:
+
+;; Support to evaluate sclang Org-mode src block with function `sclang-eval-string'.
+
+;; For example:
+
+;; #+BEGIN_SRC sclang :results none
+;; "Hello World".postln;
+;; #+END_SRC
+;;
+;; *NOTE* Temporary output to org-babel result output is not supported.
+;; Because `sclang-eval-string' will send output to Sclang Post Buffer.
+;; And command line `sclang' execute will not automatically stop after finished execution.
+;;
+;; #+BEGIN_SRC sclang :results none
+;; // modulate a sine frequency and a noise amplitude with another sine
+;; // whose frequency depends on the horizontal mouse pointer position
+;; {
+;; var x = SinOsc.ar(MouseX.kr(1, 100));
+;; SinOsc.ar(300 * x + 800, 0, 0.1)
+;; +
+;; PinkNoise.ar(0.1 * x + 0.1)
+;; }.play;
+;; #+END_SRC
+
+
+;;; Code:
+;;; ----------------------------------------------------------------------------
+(require 'org)
+(require 'ob)
+
+(require 'sclang-interp)
+
+(defgroup ob-sclang nil
+  "org-mode blocks for SuperCollider SCLang."
+  :group 'org)
+
+;;;###autoload
+(defun org-babel-execute:sclang (body params)
+  "Org-mode Babel sclang hook for evaluate `BODY' with `PARAMS'."
+  (unless (or (equal (buffer-name) sclang-post-buffer)
+              (sclang-get-process))
+    (sclang-start))
+  
+  ;; (let* ((db (or (cdr (assoc :db params))
+  ;;                ob-mongo:default-db))
+  ;;        (cmd (mapconcat 'identity (list "mongo" "--quiet" db) " ")))
+  ;;   (org-babel-eval cmd body))
+  
+  (sclang-eval-string body t)
+
+  ;; (let ((cmd "sclang -r -s -D"))
+  ;;   (org-babel-eval cmd body))
+  )
+
+(defvar org-babel-default-header-args:sclang nil)
+
+(setq org-babel-default-header-args:sclang
+      '((:session . "*SCLang:Workspace*")
+        (:output . "none")) ; TODO: temporary can't find way to let sclang output to stdout for org-babel.
+      )
+
+;;;###autoload
+(with-eval-after-load "org"
+  (add-to-list 'org-src-lang-modes '("sclang" . sclang)))
+
+;;; ----------------------------------------------------------------------------
+
+(provide 'ob-sclang)
+
+;;; ob-sclang.el ends here
-- 
2.13.1


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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-16 23:25           ` numbchild
@ 2017-06-17 10:53             ` Bastien Guerry
  2017-06-17 12:23               ` numbchild
  2017-06-17 14:27               ` Nicolas Goaziou
  0 siblings, 2 replies; 26+ messages in thread
From: Bastien Guerry @ 2017-06-17 10:53 UTC (permalink / raw)
  To: numbchild@gmail.com; +Cc: Org-mode, Nicolas Goaziou

Applied, thanks!

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-17 10:53             ` Bastien Guerry
@ 2017-06-17 12:23               ` numbchild
  2017-06-17 12:46                 ` Bastien Guerry
  2017-06-17 14:27               ` Nicolas Goaziou
  1 sibling, 1 reply; 26+ messages in thread
From: numbchild @ 2017-06-17 12:23 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode, Nicolas Goaziou

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

Did my SSH public key add to org-mode repository?
After added, if I want to update my `ob-sclang.el`. Command `git push
upstream` (upstream: git://orgmode.org/org-mode.git) will allow my access?

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Sat, Jun 17, 2017 at 6:53 PM, Bastien Guerry <bzg@gnu.org> wrote:

> Applied, thanks!
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1391 bytes --]

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-17 12:23               ` numbchild
@ 2017-06-17 12:46                 ` Bastien Guerry
  2017-06-17 13:14                   ` numbchild
  0 siblings, 1 reply; 26+ messages in thread
From: Bastien Guerry @ 2017-06-17 12:46 UTC (permalink / raw)
  To: numbchild@gmail.com; +Cc: Org-mode, Nicolas Goaziou

"numbchild@gmail.com" <numbchild@gmail.com> writes:

> Did my SSH public key add to org-mode repository?

Now yes.

You first need to pull org-mode again like this:

~$ git clone orgmode@orgmode.org:org-mode.git

Then you will be able to push commits.

Do not commit changes outside of the contrib/ repository.

If you have signed the FSF copyright papers, please let me
know under what name.

Best,

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-17 12:46                 ` Bastien Guerry
@ 2017-06-17 13:14                   ` numbchild
  0 siblings, 0 replies; 26+ messages in thread
From: numbchild @ 2017-06-17 13:14 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode, Nicolas Goaziou

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

I see, thanks very much.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Sat, Jun 17, 2017 at 8:46 PM, Bastien Guerry <bzg@gnu.org> wrote:

> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > Did my SSH public key add to org-mode repository?
>
> Now yes.
>
> You first need to pull org-mode again like this:
>
> ~$ git clone orgmode@orgmode.org:org-mode.git
>
> Then you will be able to push commits.
>
> Do not commit changes outside of the contrib/ repository.
>
> If you have signed the FSF copyright papers, please let me
> know under what name.
>
> Best,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1670 bytes --]

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-17 10:53             ` Bastien Guerry
  2017-06-17 12:23               ` numbchild
@ 2017-06-17 14:27               ` Nicolas Goaziou
  2017-06-18  8:34                 ` Bastien Guerry
  1 sibling, 1 reply; 26+ messages in thread
From: Nicolas Goaziou @ 2017-06-17 14:27 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode

Hello,

Bastien Guerry <bzg@gnu.org> writes:

> Applied, thanks!

I'm not sure to understand commit
a023d670eceb9121ef6a511b108fd82265e6d6a8. In particular, why did you
remove lexical binding? It really should be active in every library, and
is the default when you create a new one.

Regards,

-- 
Nicolas Goaziou

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-17 14:27               ` Nicolas Goaziou
@ 2017-06-18  8:34                 ` Bastien Guerry
  2017-06-18  9:31                   ` Nicolas Goaziou
  0 siblings, 1 reply; 26+ messages in thread
From: Bastien Guerry @ 2017-06-18  8:34 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Hi Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> I'm not sure to understand commit
> a023d670eceb9121ef6a511b108fd82265e6d6a8.  In particular, why did
> you remove lexical binding? It really should be active in every
> library, and is the default when you create a new one.

I didn't know lexical binding was now the default when creating a
library.

Still: when it is not used, why adding it?

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-18  8:34                 ` Bastien Guerry
@ 2017-06-18  9:31                   ` Nicolas Goaziou
  2017-06-18 19:45                     ` Bastien Guerry
  0 siblings, 1 reply; 26+ messages in thread
From: Nicolas Goaziou @ 2017-06-18  9:31 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode

Hello,

Bastien Guerry <bzg@gnu.org> writes:

> Still: when it is not used, why adding it?

We are not adding it since it is in the file by default; you removed
it :)

This is an odd question, however. The thing is: how is Emacs-lisp
scoping, dynamic or lexical? We ought not consider it to be both
throughout the code base (even though one file still uses dynamic
scoping) as it is just confusing for developers. Since lexical scoping
prevents a whole class of (vicious) bugs, it is the most common type of
scoping among modern languages, by large. As of Emacs 24.1, let's just
consider Elisp to be lexically scoped.

In a nutshell, "-*- lexical-binding:t ; -*-" ought to be a mandatory
cookie in every Elisp file.

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-18  9:31                   ` Nicolas Goaziou
@ 2017-06-18 19:45                     ` Bastien Guerry
  2017-06-18 20:37                       ` Nicolas Goaziou
  0 siblings, 1 reply; 26+ messages in thread
From: Bastien Guerry @ 2017-06-18 19:45 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Hi Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Bastien Guerry <bzg@gnu.org> writes:
>
>> Still: when it is not used, why adding it?
>
> We are not adding it since it is in the file by default; you removed
> it :)

I guess it is in the file by default because the odds are good that
lexical scoping will be actually used.

> This is an odd question, however. The thing is: how is Emacs-lisp
> scoping, dynamic or lexical? We ought not consider it to be both
> throughout the code base (even though one file still uses dynamic
> scoping) as it is just confusing for developers. Since lexical scoping
> prevents a whole class of (vicious) bugs, it is the most common type of
> scoping among modern languages, by large. As of Emacs 24.1, let's just
> consider Elisp to be lexically scoped.

I agree it's good to have lexical scoping, but I don't consider Elisp
to be lexical scopped -- I consider Elisp to let the user pick up the
constraints he wants, with dynamic binding still being the default.

> In a nutshell, "-*- lexical-binding:t ; -*-" ought to be a mandatory
> cookie in every Elisp file.

Maybe lexical binding will be the default behavior one day, but in the
meantime, I would suggest to use "-*- lexical-binding:t ; -*-" only if
lexical binding is actually used in the file.

Best,

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-18 19:45                     ` Bastien Guerry
@ 2017-06-18 20:37                       ` Nicolas Goaziou
  2017-06-18 21:32                         ` Bastien Guerry
  0 siblings, 1 reply; 26+ messages in thread
From: Nicolas Goaziou @ 2017-06-18 20:37 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode

Bastien Guerry <bzg@gnu.org> writes:

> I agree it's good to have lexical scoping, but I don't consider Elisp
> to be lexical scopped -- I consider Elisp to let the user pick up the
> constraints he wants, with dynamic binding still being the default.

Not at all. Lexical binding is still the way to go. If you need dynamic
binding, use a global variable, e.g., a defvar, so at least this is
explicit.

> Maybe lexical binding will be the default behavior one day, but in the
> meantime, I would suggest to use "-*- lexical-binding:t ; -*-" only if
> lexical binding is actually used in the file.

This is really not a good idea. Firstly, if lexical-binding is nil, no
code can use it (obviously). You will not get a warning saying "Hey,
your code would really benefit from lexical binding", either. You really
don't want to ponder about it at every non-trivial change you make in
the file. Secondly, when active, the compiler can reason (a bit) about
the code and report more informative errors. The code is more readable,
and therefore easier to debug, too.

There is absolutely no drawback in using lexical binding. Since Emacs
24.1, it _is_ the default for Elisp: every Elisp file created activates
it, the other binding being for compatibility with older libraries.
Please, pretty please, don't suggest it is different.

Regards,

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-18 20:37                       ` Nicolas Goaziou
@ 2017-06-18 21:32                         ` Bastien Guerry
  2017-06-19  9:20                           ` Nicolas Goaziou
  0 siblings, 1 reply; 26+ messages in thread
From: Bastien Guerry @ 2017-06-18 21:32 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Hi Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> There is absolutely no drawback in using lexical binding. Since Emacs
> 24.1, it _is_ the default for Elisp: every Elisp file created activates
> it, the other binding being for compatibility with older libraries.

Maybe I miss something: when I create a file with C-x C-f whatever.el RET
it does not use a template or does not get created with lexical binding on.

What are you referring to when you say "every Elisp file created activates it"?

> Please, pretty please, don't suggest it is different.

Quoting the Emacs Lisp manual:

  This is the ‘GNU Emacs Lisp Reference Manual’ corresponding to Emacs
  version 26.0.50.

  ...

  Scoping Rules for Variable Bindings

  * Dynamic Binding::         The default for binding local variables in Emacs.
  * Dynamic Binding Tips::    Avoiding problems with dynamic binding.
  * Lexical Binding::         A different type of local variable binding.

  ...

  12.10.1 Dynamic Binding
  -----------------------
  
  By default, the local variable bindings made by Emacs are dynamic
  bindings.  When a variable is dynamically bound, its current binding at
  any point in the execution of the Lisp program is simply the most
  recently-created dynamic local binding for that symbol, or the global
  binding if there is no such local binding.

To me the manual clearly says dynamic binding is the default, and
that's why using lexical binding requires additional info in the file.

Whether lexical binding is a good default or not is another question,
and whether lexical-binding:t makes sense in a file with no binding
yet another, third one.

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-18 21:32                         ` Bastien Guerry
@ 2017-06-19  9:20                           ` Nicolas Goaziou
  2017-06-19 10:14                             ` Kaushal Modi
  2017-06-19 10:37                             ` Bastien Guerry
  0 siblings, 2 replies; 26+ messages in thread
From: Nicolas Goaziou @ 2017-06-19  9:20 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode

Hello,

Bastien Guerry <bzg@gnu.org> writes:

> Maybe I miss something: when I create a file with C-x C-f whatever.el RET
> it does not use a template or does not get created with lexical
> binding on.
> What are you referring to when you say "every Elisp file created
> activates it"?

It requires to activate `autoinsert' feature, which is bundled with
Emacs.

>   * Dynamic Binding::         The default for binding local variables in Emacs.

OK. I stand corrected. Let me rephrase this then:

  There is absolutely no drawback in using lexical binding. Since Org
  9.0, it _is_ the default for Org core: almost every Org library
  activates it nowadays. Please, pretty please, don't suggest it is
  different.

> Whether lexical binding is a good default or not is another question,
> and whether lexical-binding:t makes sense in a file with no binding
> yet another, third one.

Let's consider this a non-starter. 

Again, lexical binding has _no_ drawback and makes life of developers
easier (e.g., code is more readable, compiler reports more errors).
I moved almost every library in Org to lexical binding, some changes
being trivial, some painful, for a reason. I don't want to do a step
backward in that area without a very strong reason–to tell the truth,
even a strong reason wouldn't convince me.

In particular, I don't want to introduce scoping bugs in a library
because, at its creation, lexical binding wasn't activated and nobody
cared to check the first line of the file before introducing a dubious
binding.

I sincerely hope we can agree on the topic, hic et nunc, and move on to
actual coding.


Regards,

-- 
Nicolas Goaziou

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-19  9:20                           ` Nicolas Goaziou
@ 2017-06-19 10:14                             ` Kaushal Modi
  2017-06-19 10:37                             ` Bastien Guerry
  1 sibling, 0 replies; 26+ messages in thread
From: Kaushal Modi @ 2017-06-19 10:14 UTC (permalink / raw)
  To: Nicolas Goaziou, Bastien Guerry; +Cc: Org-mode

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

On Mon, Jun 19, 2017, 5:21 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

>   There is absolutely no drawback in using lexical binding. Since Org
>   9.0, it _is_ the default for Org core: almost every Org library
>   activates it nowadays.
>
> Again, lexical binding has _no_ drawback and makes life of developers
> easier (e.g., code is more readable, compiler reports more errors).
> I moved almost every library in Org to lexical binding, some changes
> being trivial, some painful, for a reason. I don't want to do a step
> backward in that area without a very strong reason–to tell the truth,
> even a strong reason wouldn't convince me.
>

Here are some of my observations on the topic of lexical-binding by
following emacs-devel closely for the past few years.

It has become a norm to write new elisp code that is lexical-binding
friendly.

I have seen this movement started on emacs master for a long time now
(since 2011), and still there is a continuous effort to enable
lexical-binding on more and more emacs core files:
http://git.savannah.gnu.org/cgit/emacs.git/log/?qt=grep&q=lexical-binding

The same applies to Magit and many other external emacs packages (
https://github.com/search?q=lexical-binding+language%3A"Emacs+Lisp"&type=commits
).

The idea is that once almost all the elisp code out there is
lexical-binding compatible, the default of emacs can be changed to that and
dynamic binding can be obsoleted.

I have also seen how a lexically bound package is more portable as there is
no implicit reliance on global variables from multiple other packages.

> --

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3077 bytes --]

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-19  9:20                           ` Nicolas Goaziou
  2017-06-19 10:14                             ` Kaushal Modi
@ 2017-06-19 10:37                             ` Bastien Guerry
  2017-06-19 14:44                               ` numbchild
  1 sibling, 1 reply; 26+ messages in thread
From: Bastien Guerry @ 2017-06-19 10:37 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Hi Nicolas,

I'm all for lexical-binding, and it's good to have it in Org's core.

The author of ob-sclang.el used "2011-2017" for the copyright years,
which was obviously a typo and tells that the header was simply copied
from another file (which is 100% fine btw).

From that, I inferred that the "lexical-binding:t" was also copied
without further thinking, especially since there is no binding at all
in this file.

I think Stardiviner is the one who should make the decision, but I
don't see what "lexical-binding:t" would add to his actual code.

For the more general concern: again, I'm all for lexical binding and
I'm well aware of its numerous advantages, but I don't think we should
rule dynamic binding from contributed Org code.  Dynamic binding has
it's limitations, but when used carefully, it also has the advantage
of being easier to grok for beginners.  We want to welcome beginner's
contributions.  So I simply recommand lexical binding for Org's core,
and what fits developers best for Org's contributions.

And I agree we can move on to something else :)

-- 
 Bastien

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

* Re: Add ob-sclang.el for sclang Org-mode babel support in contrib/
  2017-06-19 10:37                             ` Bastien Guerry
@ 2017-06-19 14:44                               ` numbchild
  0 siblings, 0 replies; 26+ messages in thread
From: numbchild @ 2017-06-19 14:44 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org-mode, Nicolas Goaziou

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

After you two's discussion, I have some understanding about lexical scope
and dynamic scope. I will add lexical binding if my code use it.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Mon, Jun 19, 2017 at 6:37 PM, Bastien Guerry <bzg@gnu.org> wrote:

> Hi Nicolas,
>
> I'm all for lexical-binding, and it's good to have it in Org's core.
>
> The author of ob-sclang.el used "2011-2017" for the copyright years,
> which was obviously a typo and tells that the header was simply copied
> from another file (which is 100% fine btw).
>
> From that, I inferred that the "lexical-binding:t" was also copied
> without further thinking, especially since there is no binding at all
> in this file.
>
> I think Stardiviner is the one who should make the decision, but I
> don't see what "lexical-binding:t" would add to his actual code.
>
> For the more general concern: again, I'm all for lexical binding and
> I'm well aware of its numerous advantages, but I don't think we should
> rule dynamic binding from contributed Org code.  Dynamic binding has
> it's limitations, but when used carefully, it also has the advantage
> of being easier to grok for beginners.  We want to welcome beginner's
> contributions.  So I simply recommand lexical binding for Org's core,
> and what fits developers best for Org's contributions.
>
> And I agree we can move on to something else :)
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 2442 bytes --]

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

end of thread, other threads:[~2017-06-19 14:45 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09  0:43 Add ob-sclang.el for sclang Org-mode babel support in contrib/ numbchild
2017-06-10  8:17 ` Nicolas Goaziou
2017-06-11  2:02   ` numbchild
2017-06-14 14:02     ` Nicolas Goaziou
2017-06-15  6:21       ` Bastien Guerry
2017-06-15  7:53         ` numbchild
2017-06-15  7:56           ` numbchild
2017-06-15  8:26             ` Bastien Guerry
2017-06-15 11:19               ` numbchild
2017-06-15 11:14       ` numbchild
2017-06-15 12:38         ` Bastien Guerry
2017-06-16 23:25           ` numbchild
2017-06-17 10:53             ` Bastien Guerry
2017-06-17 12:23               ` numbchild
2017-06-17 12:46                 ` Bastien Guerry
2017-06-17 13:14                   ` numbchild
2017-06-17 14:27               ` Nicolas Goaziou
2017-06-18  8:34                 ` Bastien Guerry
2017-06-18  9:31                   ` Nicolas Goaziou
2017-06-18 19:45                     ` Bastien Guerry
2017-06-18 20:37                       ` Nicolas Goaziou
2017-06-18 21:32                         ` Bastien Guerry
2017-06-19  9:20                           ` Nicolas Goaziou
2017-06-19 10:14                             ` Kaushal Modi
2017-06-19 10:37                             ` Bastien Guerry
2017-06-19 14:44                               ` numbchild

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).