* [PATCH] Add support for Babel with Eshell, and some questions @ 2018-04-22 2:00 stardiviner 2018-04-22 2:01 ` stardiviner 0 siblings, 1 reply; 15+ messages in thread From: stardiviner @ 2018-04-22 2:00 UTC (permalink / raw) To: org-mode -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 I added ob-eshell.el and documentation. I got some questions: When I run `make test`, found some babel languages are missing dependency. What does that mean? and my ob-eshell is missing dependency too. ,---- | Code block evaluation complete. | passed 136/796 ob-vala/static-output (0.803677 sec) | failed 137/796 org-missing-dependency/test-ob-R (0.000377 sec) | failed 138/796 org-missing-dependency/test-ob-eshell (0.000403 sec) | failed 139/796 org-missing-dependency/test-ob-lua (0.000460 sec) | failed 140/796 org-missing-dependency/test-ob-maxima (0.000320 sec) | failed 141/796 org-missing-dependency/test-ob-plantuml (0.000304 sec) | failed 142/796 org-missing-dependency/test-ob-ruby (0.000354 sec) | failed 143/796 org-missing-dependency/test-ob-scheme (0.000307 sec) | failed 144/796 org-missing-dependency/test-ob-sqlite (0.000320 sec) | failed 145/796 org-missing-dependency/test-org-protocol (0.000304 sec) | passed 146/796 test-ob-exp/org-babel-exp-src-blocks/w-no-file (0.034372 sec) | passed 147/796 test-ob-exp/org-babel-exp-src-blocks/w-no-headers (0.031144 sec) | passed 148/796 test-ob-exp/org-babel-exp-src-blocks/w-no-headers2 (0.665415 sec) `---- I have not found place for write doc for a specific Babel langauge for ob-eshell under "* Languages" or other places. So I write document for ob-eshell in Worg. Will push after this PATCH merged. Question does all Babel languages document goes to Worg? - -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrb7KwACgkQG13xyVro msMzhQgAupTo7ARKakj5jUwhDIU2VBJkFIWg48kwaEKGItL5rPehsI4t4oWe3xEY FMqwUtXePbOP0cTipwECspURda4i3tbhQQRvsj+eB9csK7EBojNJYZE9oZPEezmE TgY/1fmgXkdMcbBe+4ZO9yS6/nepPO1AjsrFCN5vWyf2/AQDvVVi0VUFeXmNbPdd HxY55oP8X99EDiJW6NB+matWa/fwX47Yd/86L+WRdtTSVNRFg0QBD3hDxi3vwTF6 aG1Fd8bBj30Wu3zxNDnRZJCJkRWb5rA3R/h7AP4o33HkI5Ob1ALpR2loiLAU9Pg1 2jpmBjfMmyorSSvqE39dCTlzonv2sg== =w16j -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, and some questions 2018-04-22 2:00 [PATCH] Add support for Babel with Eshell, and some questions stardiviner @ 2018-04-22 2:01 ` stardiviner 2018-04-22 2:31 ` [PATCH] Add support for Babel with Eshell, (updated PATCH) stardiviner 0 siblings, 1 reply; 15+ messages in thread From: stardiviner @ 2018-04-22 2:01 UTC (permalink / raw) To: org-mode [-- Attachment #1.1: Type: text/plain, Size: 33 bytes --] Ahh, forgot include my patches. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-ob-eshell.el-Add-Eshell-support-for-Babel.patch --] [-- Type: text/x-patch, Size: 7641 bytes --] From 132c94b9b40fd9ba694fa4338f325582771c53ec Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Sun, 22 Apr 2018 09:37:40 +0800 Subject: [PATCH] ob-eshell.el: Add Eshell support for Babel. * lisp/ob-eshell.el (org-babel-execute:eshell): Execute Eshell code in Babel. (org-babel-prep-session:eshell): (ob-eshell-session-live-p): (org-babel-eshell-initiate-session): (org-babel-variable-assignments:eshell): (org-babel-load-session:eshell): * testing/test-ob-eshell.el: Write test for ob-eshell. * doc/org-manual.org (Languages): Add document for ob-eshell. --- doc/org-manual.org | 1 + lisp/ob-eshell.el | 98 ++++++++++++++++++++++++++++++++++ testing/lisp/test-ob-eshell.el | 73 +++++++++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 lisp/ob-eshell.el create mode 100644 testing/lisp/test-ob-eshell.el diff --git a/doc/org-manual.org b/doc/org-manual.org index 0ffa73911..38a6e8fa4 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17579,6 +17579,7 @@ Code blocks in the following languages are supported. | D | d | ditaa | ditaa | | Graphviz | dot | Emacs Calc | calc | | Emacs Lisp | emacs-lisp | Fortran | fortran | +| Shell | sh | Eshell | eshell | | Gnuplot | gnuplot | Haskell | haskell | | Java | java | Javascript | js | | LaTeX | latex | Ledger | ledger | diff --git a/lisp/ob-eshell.el b/lisp/ob-eshell.el new file mode 100644 index 000000000..25e52e9e8 --- /dev/null +++ b/lisp/ob-eshell.el @@ -0,0 +1,98 @@ +;;; ob-eshell.el --- Babel Functions for Eshell -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2018 Free Software Foundation, Inc. + +;; Author: stardiviner <numbchild@gmail.com> +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is 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 <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Org-Babel support for evaluating Eshell source code. + +;;; Code: +(require 'ob) +(require 'eshell) + +(defvar org-babel-default-header-args:eshell '()) + +(defun org-babel-execute:eshell (body params) + "Execute a block of Eshell code. +This function is called by `org-babel-execute-src-block'." + (let* ((session (org-babel-eshell-initiate-session + (cdr (assq :session params)))) + (full-body (org-babel-expand-body:generic + body params (org-babel-variable-assignments:eshell params)))) + (if session + (progn + (with-current-buffer session + (goto-char eshell-last-output-end) + (dolist (line (split-string full-body)) + (insert line)) + (eshell-send-input) + ;; get output of last input + (goto-char eshell-last-input-end) + (buffer-substring-no-properties (point) eshell-last-output-start))) + (with-temp-buffer + (eshell-command full-body t) + (buffer-string))))) + +(defun org-babel-prep-session:eshell (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((session (org-babel-eshell-initiate-session session)) + ;; Eshell session buffer is read from variable `eshell-buffer-name'. + (eshell-buffer-name session) + (var-lines (org-babel-variable-assignments:eshell params))) + (call-interactively 'eshell) + (dolist (var-line var-lines) + (eshell-command var-line)) + session)) + +(defun ob-eshell-session-live-p (session) + "Detect Eshell SESSION exist." + (and (get-buffer session) t)) + +(defun org-babel-eshell-initiate-session (&optional session params) + "Initiate a session named SESSION according to PARAMS." + (when (and session (not (string= session "none"))) + (save-window-excursion + (or (ob-eshell-session-live-p session) + (progn + (let ((eshell-buffer-name session)) + (eshell)) + (get-buffer (current-buffer))))))) + +(defun org-babel-variable-assignments:eshell (params) + "Convert ob-eshell :var specified variables into Eshell variables assignments." + (mapcar + (lambda (pair) + (format "(setq %s %S)" (car pair) (cdr pair))) + (org-babel--get-vars params))) + +(defun org-babel-load-session:eshell (session body params) + "Load BODY into SESSION with PARAMS." + (save-window-excursion + (let ((buffer (org-babel-prep-session:eshell session params))) + (with-current-buffer buffer + (goto-char (point-max)) + (insert (org-babel-chomp body))) + buffer))) + +(provide 'ob-eshell) + +;;; ob-eshell.el ends here diff --git a/testing/lisp/test-ob-eshell.el b/testing/lisp/test-ob-eshell.el new file mode 100644 index 000000000..77a750f0e --- /dev/null +++ b/testing/lisp/test-ob-eshell.el @@ -0,0 +1,73 @@ +;;; test-ob-eshell.el + +;; Copyright (c) 2010-2014 Eric Schulte +;; Authors: stardiviner + +;; 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/>. + +;;; Comment: + +;; Template test file for Org tests + +;;; Code: +(unless (featurep 'ob-eshell) + (signal 'missing-test-dependency "Support for Eshell code blocks")) + +(ert-deftest ob-eshell/execute () + "Test ob-eshell execute." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell +echo 2 +#+end_src" + (org-babel-execute-src-block)) + ": 2"))) + +(ert-deftest ob-eshell/variables-assignment () + "Test ob-eshell variables assignment." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell :var hi=\"hello, world\" +echo $hi +#+end_src" + (org-babel-execute-src-block)) + ": hello, world"))) + +(ert-deftest ob-eshell/session () + "Test ob-eshell session." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell :session +(setq hi \"hello, world\") +#+end_src + +#+begin_src eshell :session +echo $hi +#+end_src" + (org-babel-execute-src-block) + (org-babel-next-src-block) + (org-babel-execute-src-block) + (goto-char (org-babel-where-is-src-block-result)) + (forward-line) + (buffer-substring-no-properties (point) (line-end-position))) + ": hello, world"))) + +(provide 'test-ob-eshell) + +;;; test-ob-eshell.el ends here -- 2.17.0 [-- Attachment #1.3: Type: text/plain, Size: 202 bytes --] -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-22 2:01 ` stardiviner @ 2018-04-22 2:31 ` stardiviner 2018-04-23 9:34 ` Nicolas Goaziou 0 siblings, 1 reply; 15+ messages in thread From: stardiviner @ 2018-04-22 2:31 UTC (permalink / raw) To: org-mode [-- Attachment #1.1: Type: text/plain, Size: 83 bytes --] In this latest PATCH, contains fix of ob-shell :session initialize and execution. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-ob-eshell.el-Add-Eshell-support-for-Babel.patch --] [-- Type: text/x-patch, Size: 7735 bytes --] From 596da7b0384d64f3c1c22a49bc9bced8d0d8abf8 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Sun, 22 Apr 2018 09:37:40 +0800 Subject: [PATCH] ob-eshell.el: Add Eshell support for Babel. * lisp/ob-eshell.el (org-babel-execute:eshell): Execute Eshell code in Babel. (org-babel-prep-session:eshell): (ob-eshell-session-live-p): (org-babel-eshell-initiate-session): (org-babel-variable-assignments:eshell): (org-babel-load-session:eshell): * testing/test-ob-eshell.el: Write test for ob-eshell. * doc/org-manual.org (Languages): Add document for ob-eshell. --- doc/org-manual.org | 1 + lisp/ob-eshell.el | 100 +++++++++++++++++++++++++++++++++ testing/lisp/test-ob-eshell.el | 73 ++++++++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 lisp/ob-eshell.el create mode 100644 testing/lisp/test-ob-eshell.el diff --git a/doc/org-manual.org b/doc/org-manual.org index 0ffa73911..38a6e8fa4 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17579,6 +17579,7 @@ Code blocks in the following languages are supported. | D | d | ditaa | ditaa | | Graphviz | dot | Emacs Calc | calc | | Emacs Lisp | emacs-lisp | Fortran | fortran | +| Shell | sh | Eshell | eshell | | Gnuplot | gnuplot | Haskell | haskell | | Java | java | Javascript | js | | LaTeX | latex | Ledger | ledger | diff --git a/lisp/ob-eshell.el b/lisp/ob-eshell.el new file mode 100644 index 000000000..1553ebdb2 --- /dev/null +++ b/lisp/ob-eshell.el @@ -0,0 +1,100 @@ +;;; ob-eshell.el --- Babel Functions for Eshell -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2018 Free Software Foundation, Inc. + +;; Author: stardiviner <numbchild@gmail.com> +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is 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 <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Org-Babel support for evaluating Eshell source code. + +;;; Code: +(require 'ob) +(require 'eshell) + +(defvar org-babel-default-header-args:eshell '()) + +(defun org-babel-execute:eshell (body params) + "Execute a block of Eshell code. +This function is called by `org-babel-execute-src-block'." + (let* ((session (org-babel-eshell-initiate-session + (cdr (assq :session params)))) + (full-body (org-babel-expand-body:generic + body params (org-babel-variable-assignments:eshell params)))) + (if session + (progn + (with-current-buffer session + (dolist (line (split-string full-body "\n")) + (goto-char eshell-last-output-end) + (insert line) + (eshell-send-input)) + ;; get output of last input + ;; TODO: collect all output instead of last command's output. + (goto-char eshell-last-input-end) + (buffer-substring-no-properties (point) eshell-last-output-start))) + (with-temp-buffer + (eshell-command full-body t) + (buffer-string))))) + +(defun org-babel-prep-session:eshell (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((session (org-babel-eshell-initiate-session session)) + ;; Eshell session buffer is read from variable `eshell-buffer-name'. + (eshell-buffer-name session) + (var-lines (org-babel-variable-assignments:eshell params))) + (call-interactively 'eshell) + (dolist (var-line var-lines) + (eshell-command var-line)) + session)) + +(defun ob-eshell-session-live-p (session) + "Detect Eshell SESSION exist." + (and (get-buffer session) t)) + +(defun org-babel-eshell-initiate-session (&optional session params) + "Initiate a session named SESSION according to PARAMS." + (when (and session (not (string= session "none"))) + (save-window-excursion + (or (ob-eshell-session-live-p session) + (progn + (let ((eshell-buffer-name session)) + (eshell)) + (get-buffer (current-buffer))))) + session)) + +(defun org-babel-variable-assignments:eshell (params) + "Convert ob-eshell :var specified variables into Eshell variables assignments." + (mapcar + (lambda (pair) + (format "(setq %s %S)" (car pair) (cdr pair))) + (org-babel--get-vars params))) + +(defun org-babel-load-session:eshell (session body params) + "Load BODY into SESSION with PARAMS." + (save-window-excursion + (let ((buffer (org-babel-prep-session:eshell session params))) + (with-current-buffer buffer + (goto-char (point-max)) + (insert (org-babel-chomp body))) + buffer))) + +(provide 'ob-eshell) + +;;; ob-eshell.el ends here diff --git a/testing/lisp/test-ob-eshell.el b/testing/lisp/test-ob-eshell.el new file mode 100644 index 000000000..77a750f0e --- /dev/null +++ b/testing/lisp/test-ob-eshell.el @@ -0,0 +1,73 @@ +;;; test-ob-eshell.el + +;; Copyright (c) 2010-2014 Eric Schulte +;; Authors: stardiviner + +;; 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/>. + +;;; Comment: + +;; Template test file for Org tests + +;;; Code: +(unless (featurep 'ob-eshell) + (signal 'missing-test-dependency "Support for Eshell code blocks")) + +(ert-deftest ob-eshell/execute () + "Test ob-eshell execute." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell +echo 2 +#+end_src" + (org-babel-execute-src-block)) + ": 2"))) + +(ert-deftest ob-eshell/variables-assignment () + "Test ob-eshell variables assignment." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell :var hi=\"hello, world\" +echo $hi +#+end_src" + (org-babel-execute-src-block)) + ": hello, world"))) + +(ert-deftest ob-eshell/session () + "Test ob-eshell session." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell :session +(setq hi \"hello, world\") +#+end_src + +#+begin_src eshell :session +echo $hi +#+end_src" + (org-babel-execute-src-block) + (org-babel-next-src-block) + (org-babel-execute-src-block) + (goto-char (org-babel-where-is-src-block-result)) + (forward-line) + (buffer-substring-no-properties (point) (line-end-position))) + ": hello, world"))) + +(provide 'test-ob-eshell) + +;;; test-ob-eshell.el ends here -- 2.17.0 [-- Attachment #1.3: Type: text/plain, Size: 202 bytes --] -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-22 2:31 ` [PATCH] Add support for Babel with Eshell, (updated PATCH) stardiviner @ 2018-04-23 9:34 ` Nicolas Goaziou 2018-04-23 13:22 ` stardiviner 0 siblings, 1 reply; 15+ messages in thread From: Nicolas Goaziou @ 2018-04-23 9:34 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > From 596da7b0384d64f3c1c22a49bc9bced8d0d8abf8 Mon Sep 17 00:00:00 2001 > From: stardiviner <numbchild@gmail.com> > Date: Sun, 22 Apr 2018 09:37:40 +0800 > Subject: [PATCH] ob-eshell.el: Add Eshell support for Babel. Thank you. This could go into master branch once Org 9.2 is out. > | D | d | ditaa | ditaa | > | Graphviz | dot | Emacs Calc | calc | > | Emacs Lisp | emacs-lisp | Fortran | fortran | > +| Shell | sh | Eshell | eshell | > | Gnuplot | gnuplot | Haskell | haskell | > | Java | java | Javascript | js | > | LaTeX | latex | Ledger | ledger | Shell sh pair is already defined later in the table (ordered alphabetically). Those are spurious. > +;; Org-Babel support for evaluating Eshell source code. Org Babel support.... > +(defvar org-babel-default-header-args:eshell '()) > + > +(defun org-babel-execute:eshell (body params) > + "Execute a block of Eshell code. > +This function is called by `org-babel-execute-src-block'." Could you expound a bit and explain what are the arguments, i.e., BODY and PARAMS? > +(defun org-babel-prep-session:eshell (session params) > + "Prepare SESSION according to the header arguments specified in PARAMS." > + (let* ((session (org-babel-eshell-initiate-session session)) > + ;; Eshell session buffer is read from variable `eshell-buffer-name'. > + (eshell-buffer-name session) > + (var-lines (org-babel-variable-assignments:eshell params))) > + (call-interactively 'eshell) #'eshell > + (dolist (var-line var-lines) > + (eshell-command var-line)) (mapc #'eshell-command var-lines) > + session)) > + > +(defun ob-eshell-session-live-p (session) > + "Detect Eshell SESSION exist." "Non-nil if Eshell SESSION exists." > + (and (get-buffer session) t)) Simply: (get-buffer session) > +;;; test-ob-eshell.el > + > +;; Copyright (c) 2010-2014 Eric Schulte I don't think so ;) Barring the minor comments above, it looks good. Could you send an updated patch? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-23 9:34 ` Nicolas Goaziou @ 2018-04-23 13:22 ` stardiviner 2018-04-23 21:35 ` Nicolas Goaziou 0 siblings, 1 reply; 15+ messages in thread From: stardiviner @ 2018-04-23 13:22 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > stardiviner <numbchild@gmail.com> writes: > >> From 596da7b0384d64f3c1c22a49bc9bced8d0d8abf8 Mon Sep 17 00:00:00 2001 >> From: stardiviner <numbchild@gmail.com> >> Date: Sun, 22 Apr 2018 09:37:40 +0800 >> Subject: [PATCH] ob-eshell.el: Add Eshell support for Babel. > > Thank you. This could go into master branch once Org 9.2 is out. It's fine to be merged later. Hi, Nicolas, thank you always review my Org-mode patches. Yesterday, I ask Bastein about Worg ox-org question. He mentioned I should at least say "Hi" in message. I'm not good at English culture of something else. But I just want to say, I'm glad you reviewed my patches. Really. Thanks and that means a lot to me. > >> | D | d | ditaa | ditaa | >> | Graphviz | dot | Emacs Calc | calc | >> | Emacs Lisp | emacs-lisp | Fortran | fortran | >> +| Shell | sh | Eshell | eshell | >> | Gnuplot | gnuplot | Haskell | haskell | >> | Java | java | Javascript | js | >> | LaTeX | latex | Ledger | ledger | > > Shell sh pair is already defined later in the table (ordered > alphabetically). Those are spurious. Aha, I found it, is there a way to auto sort this table automatically? (Maybe format it into two columns instead of four columns even though it looks short and better.) Adding one language into this table, then move following languages in table one by one is awful. > >> +;; Org-Babel support for evaluating Eshell source code. > > Org Babel support.... > >> +(defvar org-babel-default-header-args:eshell '()) >> + >> +(defun org-babel-execute:eshell (body params) >> + "Execute a block of Eshell code. >> +This function is called by `org-babel-execute-src-block'." > > Could you expound a bit and explain what are the arguments, i.e., BODY > and PARAMS? > >> +(defun org-babel-prep-session:eshell (session params) >> + "Prepare SESSION according to the header arguments specified in PARAMS." >> + (let* ((session (org-babel-eshell-initiate-session session)) >> + ;; Eshell session buffer is read from variable `eshell-buffer-name'. >> + (eshell-buffer-name session) >> + (var-lines (org-babel-variable-assignments:eshell params))) >> + (call-interactively 'eshell) > > #'eshell > >> + (dolist (var-line var-lines) >> + (eshell-command var-line)) > > (mapc #'eshell-command var-lines) I previously patches, you mentioned to use `dolist`, so I used it this time, what's the difference between mapc and dolist? I thought might be performance or something else. Maybe looks cleaner? > >> + session)) >> + >> +(defun ob-eshell-session-live-p (session) >> + "Detect Eshell SESSION exist." > > "Non-nil if Eshell SESSION exists." > >> + (and (get-buffer session) t)) > > Simply: > > (get-buffer session) > >> +;;; test-ob-eshell.el >> + >> +;; Copyright (c) 2010-2014 Eric Schulte > > I don't think so ;) I copy form other test-ob-*.el file template. forgot to change copyright name. should I use my own name "stardiviner"? > > Barring the minor comments above, it looks good. > > Could you send an updated patch? > > Regards, I will update patch, and resend later after those question answer fixed. And thanks again. :) :) :) - -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrd3iAACgkQG13xyVro msMvOwf8DDLfUSJrdaS7mvBhNm8mYJhlpSbiWMnBTMGcMDr8afmzpT9JsSXEjtW3 RyiMPF9dBjNIoKbqCMkTU18DnFEfT7mNcB5nasI0gxxfPgF/3Ueb/xDcoKm9GLyB NXmei4WwXqLnyRSmBfXocp/tbuX4GmdzQi5Yv8ITMsceb+/LCoWxvw0gHH1QFjeB sPA0LsMeSZpEdCNe2L6q2/y13D00yAjIi8ufBSO4KQProLOKVmZhU7i3iz+8acLJ QxLDsLDpYHCV1RK29WWhHfBcHe2Sx9SXLhOOgUAQLaUuhKSncnLQu5sjVfe8GMBL 5KD+bZxvyvDkKBCfDwCtM6cvlu3lKA== =F76/ -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-23 13:22 ` stardiviner @ 2018-04-23 21:35 ` Nicolas Goaziou 2018-04-24 2:39 ` stardiviner 0 siblings, 1 reply; 15+ messages in thread From: Nicolas Goaziou @ 2018-04-23 21:35 UTC (permalink / raw) To: stardiviner; +Cc: org-mode stardiviner <numbchild@gmail.com> writes: > Hi, Nicolas, thank you always review my Org-mode patches. Yesterday, I > ask Bastein about Worg ox-org question. He mentioned I should at least > say "Hi" in message. I'm not good at English culture of something else. > But I just want to say, I'm glad you reviewed my patches. Really. Thanks > and that means a lot to me. You're welcome. > Aha, I found it, is there a way to auto sort this table automatically? > (Maybe format it into two columns instead of four columns even though it > looks short and better.) Adding one language into this table, then move > following languages in table one by one is awful. True. I usually define a quick Emacs macro when I need to shift a substantial part of this table. I'm not sure it is faster in the end, but it sure is more interesting. >> (mapc #'eshell-command var-lines) > > I previously patches, you mentioned to use `dolist`, so I used it this > time, what's the difference between mapc and dolist? I thought might be > performance or something else. Maybe looks cleaner? What I said it `mapc' + `lambda' => `dolist'. This is because calling lambda is somewhat inefficient in Emacs Lisp. So, instead of (mapc (lambda (e) (do stuff on e))), it is better to write (dolist (e ...) (do stuff on e)) since there is one level of indirection less. In the example above, there is no `lambda'. So (mapc #'function ...) is shorter and better. > I copy form other test-ob-*.el file template. forgot to change copyright > name. should I use my own name "stardiviner"? Sure. Regards, ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-23 21:35 ` Nicolas Goaziou @ 2018-04-24 2:39 ` stardiviner 2018-04-25 8:31 ` Nicolas Goaziou 0 siblings, 1 reply; 15+ messages in thread From: stardiviner @ 2018-04-24 2:39 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > stardiviner <numbchild@gmail.com> writes: > >> Hi, Nicolas, thank you always review my Org-mode patches. Yesterday, I >> ask Bastein about Worg ox-org question. He mentioned I should at least >> say "Hi" in message. I'm not good at English culture of something else. >> But I just want to say, I'm glad you reviewed my patches. Really. Thanks >> and that means a lot to me. > > You're welcome. > >> Aha, I found it, is there a way to auto sort this table automatically? >> (Maybe format it into two columns instead of four columns even though it >> looks short and better.) Adding one language into this table, then move >> following languages in table one by one is awful. > > True. I usually define a quick Emacs macro when I need to shift > a substantial part of this table. I'm not sure it is faster in the end, > but it sure is more interesting. After some thinking, I think the following table sort might better, because Org Table support insert a field below is easy when has new entry need to add. No need to move a lot of fields. WDYT? ,---- | | Language | Identifier | Language | Identifier | | |------------+------------+----------------+------------| | -| Asymptote | asymptote | Awk | awk | | -| C | C | C++ | C++ | | -| Clojure | clojure | CSS | css | | -| D | d | ditaa | ditaa | | -| Graphviz | dot | Emacs Calc | calc | | -| Emacs Lisp | emacs-lisp | Fortran | fortran | | -| Shell | sh | Eshell | eshell | | -| Gnuplot | gnuplot | Haskell | haskell | | -| Java | java | Javascript | js | | -| LaTeX | latex | Ledger | ledger | | -| Lisp | lisp | Lilypond | lilypond | | -| Lua | lua | MATLAB | matlab | | -| Mscgen | mscgen | Objective Caml | ocaml | | -| Octave | octave | Org mode | org | | -| Oz | oz | Perl | perl | | -| Plantuml | plantuml | Processing.js | processing | | -| Python | python | R | R | | -| Ruby | ruby | Sass | sass | | -| Scheme | scheme | GNU Screen | screen | | -| Sed | sed | shell | sh | | -| SQL | sql | SQLite | sqlite | | -| Vala | vala | | | | +| Asymptote | asymptote | Lisp | lisp | | +| Awk | awk | Lua | lua | | +| C | C | MATLAB | matlab | | +| C++ | C++ | Mscgen | mscgen | | +| Clojure | clojure | Objective Caml | ocaml | | +| CSS | css | Octave | octave | | +| D | d | Org mode | org | | +| ditaa | ditaa | Oz | oz | | +| Emacs Calc | calc | Perl | perl | | +| Emacs Lisp | emacs-lisp | Plantuml | plantuml | | +| Eshell | eshell | Processing.js | processing | | +| Fortran | fortran | Python | python | | +| Gnuplot | gnuplot | R | R | | +| GNU Screen | screen | Ruby | ruby | | +| Graphviz | dot | Sass | sass | | +| Haskell | haskell | Scheme | scheme | | +| Java | java | Sed | sed | | +| Javascript | js | shell | sh | | +| LaTeX | latex | SQL | sql | | +| Ledger | ledger | SQLite | sqlite | | +| Lilypond | lilypond | Vala | vala | | + `---- - -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlremM0ACgkQG13xyVro msOb0wgAmta0pUsn0qeULTN1BFpFwb6TaI2DMbukpuZSauuM8DJoP2KkeKSIQ3bq kE/T0lvhdmM7AROskaqODI6ZnJlUIbaKYF+yvqNmiXvD6aPoQiuAxibeTYTEux5+ nWnlG2sCDAIWlkRrLQRN2jawVOZShIQpBFGmq9JqmK7XqFmMJIcytBPBGToboeBj H1v5FSMOdCNzFlHmI8BPA2iaE/du6vdWM6ci6hDIwR6IvgxqaOGmVceR3blYswQ/ SrnDoHquLCd60hF0mUWIaHXjC8qGOL0P1j3iQCXjhXuapt6XP3nunFu2Khn4bQvG iYx4uM+87PDfO1LbbwhdLgstXGLoZQ== =SSwK -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-24 2:39 ` stardiviner @ 2018-04-25 8:31 ` Nicolas Goaziou 2018-04-26 10:53 ` stardiviner 0 siblings, 1 reply; 15+ messages in thread From: Nicolas Goaziou @ 2018-04-25 8:31 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > After some thinking, I think the following table sort might better, > because Org Table support insert a field below is easy when has new > entry need to add. No need to move a lot of fields. > > WDYT? I'm not convinced this is less work to edit, but I changed it anyway. It makes it easier to follow alphabetical order. I also wrapped identifiers within verbatim markup. Thank you. Regards, -- Nicolas Goaziou 0x80A93738 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-25 8:31 ` Nicolas Goaziou @ 2018-04-26 10:53 ` stardiviner 2018-05-02 14:53 ` stardiviner 2018-05-31 21:13 ` Nicolas Goaziou 0 siblings, 2 replies; 15+ messages in thread From: stardiviner @ 2018-04-26 10:53 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode [-- Attachment #1.1: Type: text/plain, Size: 330 bytes --] Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > I'm not convinced this is less work to edit, but I changed it anyway. It > makes it easier to follow alphabetical order. I also wrapped > identifiers within verbatim markup. > You're right, still not improved a lot. Anyway, thanks. And I updated patch inclued in attachment. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-ob-eshell.el-Add-Eshell-support-for-Babel.patch --] [-- Type: text/x-patch, Size: 9880 bytes --] From bea5c4454ee53307578f4c6e10e2b8e06f9bb70b Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Sun, 22 Apr 2018 09:37:40 +0800 Subject: [PATCH] ob-eshell.el: Add Eshell support for Babel. * lisp/ob-eshell.el (org-babel-execute:eshell): Execute Eshell code in Babel. (org-babel-prep-session:eshell): (ob-eshell-session-live-p): (org-babel-eshell-initiate-session): (org-babel-variable-assignments:eshell): (org-babel-load-session:eshell): * testing/test-ob-eshell.el: Write test for ob-eshell. * doc/org-manual.org (Languages): Add Babel language eshell identity. --- doc/org-manual.org | 27 +++++---- lisp/ob-eshell.el | 105 +++++++++++++++++++++++++++++++++ testing/lisp/test-ob-eshell.el | 73 +++++++++++++++++++++++ 3 files changed, 192 insertions(+), 13 deletions(-) create mode 100644 lisp/ob-eshell.el create mode 100644 testing/lisp/test-ob-eshell.el diff --git a/doc/org-manual.org b/doc/org-manual.org index bdef9f61b..de62d15d2 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17573,8 +17573,8 @@ code block header arguments: Code blocks in the following languages are supported. -| Language | Identifier | Language | Identifier | -|------------+--------------+----------------+--------------| +| Language | Identifier | Language | Identifier | +|------------+------------+----------------+------------| | Asymptote | =asymptote= | Lua | =lua= | | Awk | =awk= | MATLAB | =matlab= | | C | =C= | Mscgen | =mscgen= | @@ -17585,17 +17585,18 @@ Code blocks in the following languages are supported. | ditaa | =ditaa= | Perl | =perl= | | Emacs Calc | =calc= | Plantuml | =plantuml= | | Emacs Lisp | =emacs-lisp= | Processing.js | =processing= | -| Fortran | =fortran= | Python | =python= | -| Gnuplot | =gnuplot= | R | =R= | -| GNU Screen | =screen= | Ruby | =ruby= | -| Graphviz | =dot= | Sass | =sass= | -| Haskell | =haskell= | Scheme | =scheme= | -| Java | =java= | Sed | =sed= | -| Javascript | =js= | shell | =sh= | -| LaTeX | =latex= | SQL | =sql= | -| Ledger | =ledger= | SQLite | =sqlite= | -| Lilypond | =lilypond= | Vala | =vala= | -| Lisp | =lisp= | | | +| Eshell | =eshell= | Python | =python= | +| Fortran | =fortran= | R | =R= | +| Gnuplot | =gnuplot= | Ruby | =ruby= | +| GNU Screen | =screen= | Sass | =sass= | +| Graphviz | =dot= | Scheme | =scheme= | +| Haskell | =haskell= | Sed | =sed= | +| Java | =java= | shell | =sh= | +| Javascript | =js= | SQL | =sql= | +| LaTeX | =latex= | SQLite | =sqlite= | +| Ledger | =ledger= | Vala | =vala= | +| Lilypond | =lilypond= | | | +| Lisp | =lisp= | | | Additional documentation for some languages is at https://orgmode.org/worg/org-contrib/babel/languages.html. diff --git a/lisp/ob-eshell.el b/lisp/ob-eshell.el new file mode 100644 index 000000000..f1cd859a4 --- /dev/null +++ b/lisp/ob-eshell.el @@ -0,0 +1,105 @@ +;;; ob-eshell.el --- Babel Functions for Eshell -*- lexical-binding: t; -*- + +;; Copyright (C) 2009-2018 Free Software Foundation, Inc. + +;; Author: stardiviner <numbchild@gmail.com> +;; Keywords: literate programming, reproducible research +;; Homepage: https://orgmode.org + +;; This file is 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 <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Org Babel support for evaluating Eshell source code. + +;;; Code: +(require 'ob) +(require 'eshell) + +(defvar org-babel-default-header-args:eshell '()) + +(defun org-babel-execute:eshell (body params) + "Execute a block of Eshell code BODY with PARAMS. +This function is called by `org-babel-execute-src-block'. + +The BODY can be any code which allowed executed in Eshell. +Eshell allow to execute normal shell command and Elisp code. +More details please reference Eshell Info. + +The PARAMS are variables assignments." + (let* ((session (org-babel-eshell-initiate-session + (cdr (assq :session params)))) + (full-body (org-babel-expand-body:generic + body params (org-babel-variable-assignments:eshell params)))) + (if session + (progn + (with-current-buffer session + (dolist (line (split-string full-body "\n")) + (goto-char eshell-last-output-end) + (insert line) + (eshell-send-input)) + ;; get output of last input + ;; TODO: collect all output instead of last command's output. + (goto-char eshell-last-input-end) + (buffer-substring-no-properties (point) eshell-last-output-start))) + (with-temp-buffer + (eshell-command full-body t) + (buffer-string))))) + +(defun org-babel-prep-session:eshell (session params) + "Prepare SESSION according to the header arguments specified in PARAMS." + (let* ((session (org-babel-eshell-initiate-session session)) + ;; Eshell session buffer is read from variable `eshell-buffer-name'. + (eshell-buffer-name session) + (var-lines (org-babel-variable-assignments:eshell params))) + (call-interactively #'eshell) + (mapc #'eshell-command var-lines) + session)) + +(defun ob-eshell-session-live-p (session) + "Non-nil if Eshell SESSION exists." + (get-buffer session)) + +(defun org-babel-eshell-initiate-session (&optional session params) + "Initiate a session named SESSION according to PARAMS." + (when (and session (not (string= session "none"))) + (save-window-excursion + (or (ob-eshell-session-live-p session) + (progn + (let ((eshell-buffer-name session)) + (eshell)) + (get-buffer (current-buffer))))) + session)) + +(defun org-babel-variable-assignments:eshell (params) + "Convert ob-eshell :var specified variables into Eshell variables assignments." + (mapcar + (lambda (pair) + (format "(setq %s %S)" (car pair) (cdr pair))) + (org-babel--get-vars params))) + +(defun org-babel-load-session:eshell (session body params) + "Load BODY into SESSION with PARAMS." + (save-window-excursion + (let ((buffer (org-babel-prep-session:eshell session params))) + (with-current-buffer buffer + (goto-char (point-max)) + (insert (org-babel-chomp body))) + buffer))) + +(provide 'ob-eshell) + +;;; ob-eshell.el ends here diff --git a/testing/lisp/test-ob-eshell.el b/testing/lisp/test-ob-eshell.el new file mode 100644 index 000000000..21e7484cd --- /dev/null +++ b/testing/lisp/test-ob-eshell.el @@ -0,0 +1,73 @@ +;;; test-ob-eshell.el + +;; Copyright (c) 2018-2022 stardiviner +;; Authors: stardiviner + +;; 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/>. + +;;; Comment: + +;; Template test file for Org tests + +;;; Code: +(unless (featurep 'ob-eshell) + (signal 'missing-test-dependency "Support for Eshell code blocks")) + +(ert-deftest ob-eshell/execute () + "Test ob-eshell execute." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell +echo 2 +#+end_src" + (org-babel-execute-src-block)) + ": 2"))) + +(ert-deftest ob-eshell/variables-assignment () + "Test ob-eshell variables assignment." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell :var hi=\"hello, world\" +echo $hi +#+end_src" + (org-babel-execute-src-block)) + ": hello, world"))) + +(ert-deftest ob-eshell/session () + "Test ob-eshell session." + (should + (string= + (org-test-with-temp-text + "#+begin_src eshell :session +(setq hi \"hello, world\") +#+end_src + +#+begin_src eshell :session +echo $hi +#+end_src" + (org-babel-execute-src-block) + (org-babel-next-src-block) + (org-babel-execute-src-block) + (goto-char (org-babel-where-is-src-block-result)) + (forward-line) + (buffer-substring-no-properties (point) (line-end-position))) + ": hello, world"))) + +(provide 'test-ob-eshell) + +;;; test-ob-eshell.el ends here -- 2.17.0 [-- Attachment #1.3: Type: text/plain, Size: 187 bytes --] -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-26 10:53 ` stardiviner @ 2018-05-02 14:53 ` stardiviner 2018-05-31 21:13 ` Nicolas Goaziou 1 sibling, 0 replies; 15+ messages in thread From: stardiviner @ 2018-05-02 14:53 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi, Nicolas. Now Org 9.1.12 is released. Maybe it's time to merge this ob-eshell PATCH? If still has some places need modified, please tell me. Thanks. - -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrp0PwACgkQG13xyVro msOxVwf8DLQcDrUggiVBBCxxav1rFdVw0eKOaQUnHXVXCoK+2Quz1+WYtxv0LftC J6lLl4I7m/ix34DjrI29ro+ZrtoWwhS7A9gP1zIe/5AaJBBnmrJveA9mkVN2dglI wcwYUDeY6Oq91omzSGstCCIhQqAtoECQ1K3wDhDHYF17/f3EEQbqzildcHwdKpbE tw4GZ6fULdckyrW53cxmgmT1Yym0O/OxLQhaqLtpDi4MPRAdHOegX7dKp/JqF7MY iIETFzX6XK6BQLiPEJsLnXlg6yTM2sUst/p6CsQBebVSQ8kseYFAfAHy5vgGtCwU zXQ8cZ6oHkx2ALa70lD081Ql0tURRA== =CuOW -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-04-26 10:53 ` stardiviner 2018-05-02 14:53 ` stardiviner @ 2018-05-31 21:13 ` Nicolas Goaziou 2018-06-01 6:26 ` stardiviner 1 sibling, 1 reply; 15+ messages in thread From: Nicolas Goaziou @ 2018-05-31 21:13 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > Subject: [PATCH] ob-eshell.el: Add Eshell support for Babel. Applied on "next" branch. Thank you. Regards, -- Nicolas Goaziou 0x80A93738 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-05-31 21:13 ` Nicolas Goaziou @ 2018-06-01 6:26 ` stardiviner 2018-06-02 10:16 ` Nicolas Goaziou 0 siblings, 1 reply; 15+ messages in thread From: stardiviner @ 2018-06-01 6:26 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > stardiviner <numbchild@gmail.com> writes: > >> Subject: [PATCH] ob-eshell.el: Add Eshell support for Babel. > > Applied on "next" branch. Thank you. Aha, Thanks, Nicolas, I almost forget this patch. That's great! > > Regards, -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-06-01 6:26 ` stardiviner @ 2018-06-02 10:16 ` Nicolas Goaziou 2018-06-04 2:11 ` stardiviner 0 siblings, 1 reply; 15+ messages in thread From: Nicolas Goaziou @ 2018-06-02 10:16 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > Aha, Thanks, Nicolas, I almost forget this patch. That's great! Speaking of which, there's an issue in `org-babel-eshell-initiate-session'. First, it uses (get-buffer (current-buffer)), which is equivalent to (current-buffer). But, more importantly, it doesn't do anything with it? So what is the point of the `progn' in that function? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-06-02 10:16 ` Nicolas Goaziou @ 2018-06-04 2:11 ` stardiviner 2018-06-14 19:12 ` Nicolas Goaziou 0 siblings, 1 reply; 15+ messages in thread From: stardiviner @ 2018-06-04 2:11 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > stardiviner <numbchild@gmail.com> writes: > >> Aha, Thanks, Nicolas, I almost forget this patch. That's great! > > Speaking of which, there's an issue in > `org-babel-eshell-initiate-session'. > > First, it uses (get-buffer (current-buffer)), which is equivalent to > (current-buffer). But, more importantly, it doesn't do anything with it? > So what is the point of the `progn' in that function? You're right. It originally suppose to return the Eshell session buffer (return value) to be used by other functions. But at last function `org-babel-eshell-initiate-session` seems still return `session`. So this `(get-buffer (current-buffer))` seems not necessary. Can you remove it? Regenerate patches on my side is little kind of trouble. > > Regards, -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Add support for Babel with Eshell, (updated PATCH) 2018-06-04 2:11 ` stardiviner @ 2018-06-14 19:12 ` Nicolas Goaziou 0 siblings, 0 replies; 15+ messages in thread From: Nicolas Goaziou @ 2018-06-14 19:12 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > Can you remove it? Regenerate patches on my side is little kind of > trouble. Done. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2018-06-14 19:12 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-04-22 2:00 [PATCH] Add support for Babel with Eshell, and some questions stardiviner 2018-04-22 2:01 ` stardiviner 2018-04-22 2:31 ` [PATCH] Add support for Babel with Eshell, (updated PATCH) stardiviner 2018-04-23 9:34 ` Nicolas Goaziou 2018-04-23 13:22 ` stardiviner 2018-04-23 21:35 ` Nicolas Goaziou 2018-04-24 2:39 ` stardiviner 2018-04-25 8:31 ` Nicolas Goaziou 2018-04-26 10:53 ` stardiviner 2018-05-02 14:53 ` stardiviner 2018-05-31 21:13 ` Nicolas Goaziou 2018-06-01 6:26 ` stardiviner 2018-06-02 10:16 ` Nicolas Goaziou 2018-06-04 2:11 ` stardiviner 2018-06-14 19:12 ` Nicolas Goaziou
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).