all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
@ 2022-05-18 20:05 Richard Stanton
  2022-05-18 20:16 ` John Kitchin
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stanton @ 2022-05-18 20:05 UTC (permalink / raw)
  To: orgmode

I’m running Emacs 28.1 under macOS 12.4 and want to create tables from Python code blocks that can be exported to either LaTeX or HTML. The simplest way to do this seems to be to generate the output as an org table, and using the built-in version of org (9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fine using either a python or emacs-jupyter code block:

#+begin_src jupyter-python
[
    ["Wide a", "b", "c"],
    None,
    [1, 2, 3],
    [4, 5, 6],
    None,
    [7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|--------+---+---|
|      1 | 2 | 3 |
|      4 | 5 | 6 |
|--------+---+---|
|      7 | 8 | 9 |

#+begin_src python 
return [
    ["Wide a", "b", "c"],
    None,
    [1, 2, 3],
    [4, 5, 6],
    None,
    [7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|--------+---+---|
|      1 | 2 | 3 |
|      4 | 5 | 6 |
|--------+---+---|
|      7 | 8 | 9 |


To use the latest version of org, I change just two lines in my init.el from

(straight-use-package '(org :type built-in))
(straight-use-package '(org-contrib :type built-in))

to

(straight-use-package '(org :type git :repo "https://code.orgmode.org/bzg/org-mode.git"))
(straight-use-package '(org-contrib :type git :repo "https://git.sr.ht/~bzg/org-contrib”))

Having done this, the python block still works fine, but the horizontal lines in the jupyter-python block are no longer properly aligned with the text:

#+begin_src jupyter-python
[
    ["Wide a", "b", "c"],
    None,
    [1, 2, 3],
    [4, 5, 6],
    None,
    [7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
|---+---+---|
| 7 | 8 | 9 |

#+begin_src python 
return [
    ["Wide a", "b", "c"],
    None,
    [1, 2, 3],
    [4, 5, 6],
    None,
    [7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|--------+---+---|
|      1 | 2 | 3 |
|      4 | 5 | 6 |
|--------+---+---|
|      7 | 8 | 9 |

By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @ /Users/stanton/.emacs.d/straight/build/org/).

The table exports OK, but isn’t much fun to look at in the org file itself.

Since I like to use emacs-jupyter, any suggestions would be appreciated. I know this worked fine just a few weeks ago.

Thanks!

Richard Stanton






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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-18 20:05 Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version Richard Stanton
@ 2022-05-18 20:16 ` John Kitchin
  2022-05-18 20:56   ` Richard Stanton
  0 siblings, 1 reply; 13+ messages in thread
From: John Kitchin @ 2022-05-18 20:16 UTC (permalink / raw)
  To: Richard Stanton; +Cc: orgmode

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

I use a function in an after execute hook for this:
https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205

This works on a subtree, which has been fine for me. You could adapt it to
only work in the results section.

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Wed, May 18, 2022 at 4:07 PM Richard Stanton <rhstanton@berkeley.edu>
wrote:

> I’m running Emacs 28.1 under macOS 12.4 and want to create tables from
> Python code blocks that can be exported to either LaTeX or HTML. The
> simplest way to do this seems to be to generate the output as an org table,
> and using the built-in version of org (9.4.6
> (9.4.6-798-g738759.dirty-elpaplus @
> /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fine
> using either a python or emacs-jupyter code block:
>
> #+begin_src jupyter-python
> [
>     ["Wide a", "b", "c"],
>     None,
>     [1, 2, 3],
>     [4, 5, 6],
>     None,
>     [7, 8, 9]
> ]
> #+end_src
>
> #+RESULTS:
> | Wide a | b | c |
> |--------+---+---|
> |      1 | 2 | 3 |
> |      4 | 5 | 6 |
> |--------+---+---|
> |      7 | 8 | 9 |
>
> #+begin_src python
> return [
>     ["Wide a", "b", "c"],
>     None,
>     [1, 2, 3],
>     [4, 5, 6],
>     None,
>     [7, 8, 9]
> ]
> #+end_src
>
> #+RESULTS:
> | Wide a | b | c |
> |--------+---+---|
> |      1 | 2 | 3 |
> |      4 | 5 | 6 |
> |--------+---+---|
> |      7 | 8 | 9 |
>
>
> To use the latest version of org, I change just two lines in my init.el
> from
>
> (straight-use-package '(org :type built-in))
> (straight-use-package '(org-contrib :type built-in))
>
> to
>
> (straight-use-package '(org :type git :repo "
> https://code.orgmode.org/bzg/org-mode.git"))
> (straight-use-package '(org-contrib :type git :repo "
> https://git.sr.ht/~bzg/org-contrib”))
>
> Having done this, the python block still works fine, but the horizontal
> lines in the jupyter-python block are no longer properly aligned with the
> text:
>
> #+begin_src jupyter-python
> [
>     ["Wide a", "b", "c"],
>     None,
>     [1, 2, 3],
>     [4, 5, 6],
>     None,
>     [7, 8, 9]
> ]
> #+end_src
>
> #+RESULTS:
> | Wide a | b | c |
> |---+---+---|
> | 1 | 2 | 3 |
> | 4 | 5 | 6 |
> |---+---+---|
> | 7 | 8 | 9 |
>
> #+begin_src python
> return [
>     ["Wide a", "b", "c"],
>     None,
>     [1, 2, 3],
>     [4, 5, 6],
>     None,
>     [7, 8, 9]
> ]
> #+end_src
>
> #+RESULTS:
> | Wide a | b | c |
> |--------+---+---|
> |      1 | 2 | 3 |
> |      4 | 5 | 6 |
> |--------+---+---|
> |      7 | 8 | 9 |
>
> By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @
> /Users/stanton/.emacs.d/straight/build/org/).
>
> The table exports OK, but isn’t much fun to look at in the org file itself.
>
> Since I like to use emacs-jupyter, any suggestions would be appreciated. I
> know this worked fine just a few weeks ago.
>
> Thanks!
>
> Richard Stanton
>
>
>
>
>
>

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

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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-18 20:16 ` John Kitchin
@ 2022-05-18 20:56   ` Richard Stanton
  2022-05-18 21:00     ` John Kitchin
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stanton @ 2022-05-18 20:56 UTC (permalink / raw)
  To: John Kitchin; +Cc: orgmode

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

Thanks for the suggestion, John. I’ve tried playing around with this, and am I right that it seems to have trouble when execution is asynchronous?

> On May 18, 2022, at 1:16 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> 
> I use a function in an after execute hook for this: https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205 <https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205>
> 
> This works on a subtree, which has been fine for me. You could adapt it to only work in the results section.
> 
> John
> 
> -----------------------------------
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>
> 
> 
> 
> On Wed, May 18, 2022 at 4:07 PM Richard Stanton <rhstanton@berkeley.edu <mailto:rhstanton@berkeley.edu>> wrote:
> I’m running Emacs 28.1 under macOS 12.4 and want to create tables from Python code blocks that can be exported to either LaTeX or HTML. The simplest way to do this seems to be to generate the output as an org table, and using the built-in version of org (9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fine using either a python or emacs-jupyter code block:
> 
> #+begin_src jupyter-python
> [
>     ["Wide a", "b", "c"],
>     None,
>     [1, 2, 3],
>     [4, 5, 6],
>     None,
>     [7, 8, 9]
> ]
> #+end_src
> 
> #+RESULTS:
> | Wide a | b | c |
> |--------+---+---|
> |      1 | 2 | 3 |
> |      4 | 5 | 6 |
> |--------+---+---|
> |      7 | 8 | 9 |
> 
> #+begin_src python 
> return [
>     ["Wide a", "b", "c"],
>     None,
>     [1, 2, 3],
>     [4, 5, 6],
>     None,
>     [7, 8, 9]
> ]
> #+end_src
> 
> #+RESULTS:
> | Wide a | b | c |
> |--------+---+---|
> |      1 | 2 | 3 |
> |      4 | 5 | 6 |
> |--------+---+---|
> |      7 | 8 | 9 |
> 
> 
> To use the latest version of org, I change just two lines in my init.el from
> 
> (straight-use-package '(org :type built-in))
> (straight-use-package '(org-contrib :type built-in))
> 
> to
> 
> (straight-use-package '(org :type git :repo "https://code.orgmode.org/bzg/org-mode.git <https://code.orgmode.org/bzg/org-mode.git>"))
> (straight-use-package '(org-contrib :type git :repo "https://git.sr.ht/~bzg/org-contrib <https://git.sr.ht/~bzg/org-contrib>”))
> 
> Having done this, the python block still works fine, but the horizontal lines in the jupyter-python block are no longer properly aligned with the text:
> 
> #+begin_src jupyter-python
> [
>     ["Wide a", "b", "c"],
>     None,
>     [1, 2, 3],
>     [4, 5, 6],
>     None,
>     [7, 8, 9]
> ]
> #+end_src
> 
> #+RESULTS:
> | Wide a | b | c |
> |---+---+---|
> | 1 | 2 | 3 |
> | 4 | 5 | 6 |
> |---+---+---|
> | 7 | 8 | 9 |
> 
> #+begin_src python 
> return [
>     ["Wide a", "b", "c"],
>     None,
>     [1, 2, 3],
>     [4, 5, 6],
>     None,
>     [7, 8, 9]
> ]
> #+end_src
> 
> #+RESULTS:
> | Wide a | b | c |
> |--------+---+---|
> |      1 | 2 | 3 |
> |      4 | 5 | 6 |
> |--------+---+---|
> |      7 | 8 | 9 |
> 
> By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @ /Users/stanton/.emacs.d/straight/build/org/).
> 
> The table exports OK, but isn’t much fun to look at in the org file itself.
> 
> Since I like to use emacs-jupyter, any suggestions would be appreciated. I know this worked fine just a few weeks ago.
> 
> Thanks!
> 
> Richard Stanton
> 
> 
> 
> 
> 


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

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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-18 20:56   ` Richard Stanton
@ 2022-05-18 21:00     ` John Kitchin
  2022-05-18 21:12       ` Richard Stanton
  0 siblings, 1 reply; 13+ messages in thread
From: John Kitchin @ 2022-05-18 21:00 UTC (permalink / raw)
  To: Richard Stanton; +Cc: orgmode

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

I would guess it could. I don't do anything asynchronous, and I am not sure
when org-babel-after-execute-hook runs, if it is immediately there is no
table to clean up I suppose. It is not necessary to run on  a subtree, but
on a very large document you probably don't want to do org-element-parse
often.


John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Wed, May 18, 2022 at 4:57 PM Richard Stanton <rhstanton@berkeley.edu>
wrote:

> Thanks for the suggestion, John. I’ve tried playing around with this, and
> am I right that it seems to have trouble when execution is asynchronous?
>
> On May 18, 2022, at 1:16 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>
> I use a function in an after execute hook for this:
> https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205
>
> This works on a subtree, which has been fine for me. You could adapt it to
> only work in the results section.
>
> John
>
> -----------------------------------
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Wed, May 18, 2022 at 4:07 PM Richard Stanton <rhstanton@berkeley.edu>
> wrote:
>
>> I’m running Emacs 28.1 under macOS 12.4 and want to create tables from
>> Python code blocks that can be exported to either LaTeX or HTML. The
>> simplest way to do this seems to be to generate the output as an org table,
>> and using the built-in version of org (9.4.6
>> (9.4.6-798-g738759.dirty-elpaplus @
>> /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fine
>> using either a python or emacs-jupyter code block:
>>
>> #+begin_src jupyter-python
>> [
>>     ["Wide a", "b", "c"],
>>     None,
>>     [1, 2, 3],
>>     [4, 5, 6],
>>     None,
>>     [7, 8, 9]
>> ]
>> #+end_src
>>
>> #+RESULTS:
>> | Wide a | b | c |
>> |--------+---+---|
>> |      1 | 2 | 3 |
>> |      4 | 5 | 6 |
>> |--------+---+---|
>> |      7 | 8 | 9 |
>>
>> #+begin_src python
>> return [
>>     ["Wide a", "b", "c"],
>>     None,
>>     [1, 2, 3],
>>     [4, 5, 6],
>>     None,
>>     [7, 8, 9]
>> ]
>> #+end_src
>>
>> #+RESULTS:
>> | Wide a | b | c |
>> |--------+---+---|
>> |      1 | 2 | 3 |
>> |      4 | 5 | 6 |
>> |--------+---+---|
>> |      7 | 8 | 9 |
>>
>>
>> To use the latest version of org, I change just two lines in my init.el
>> from
>>
>> (straight-use-package '(org :type built-in))
>> (straight-use-package '(org-contrib :type built-in))
>>
>> to
>>
>> (straight-use-package '(org :type git :repo "
>> https://code.orgmode.org/bzg/org-mode.git"))
>> (straight-use-package '(org-contrib :type git :repo "
>> https://git.sr.ht/~bzg/org-contrib”))
>>
>> Having done this, the python block still works fine, but the horizontal
>> lines in the jupyter-python block are no longer properly aligned with the
>> text:
>>
>> #+begin_src jupyter-python
>> [
>>     ["Wide a", "b", "c"],
>>     None,
>>     [1, 2, 3],
>>     [4, 5, 6],
>>     None,
>>     [7, 8, 9]
>> ]
>> #+end_src
>>
>> #+RESULTS:
>> | Wide a | b | c |
>> |---+---+---|
>> | 1 | 2 | 3 |
>> | 4 | 5 | 6 |
>> |---+---+---|
>> | 7 | 8 | 9 |
>>
>> #+begin_src python
>> return [
>>     ["Wide a", "b", "c"],
>>     None,
>>     [1, 2, 3],
>>     [4, 5, 6],
>>     None,
>>     [7, 8, 9]
>> ]
>> #+end_src
>>
>> #+RESULTS:
>> | Wide a | b | c |
>> |--------+---+---|
>> |      1 | 2 | 3 |
>> |      4 | 5 | 6 |
>> |--------+---+---|
>> |      7 | 8 | 9 |
>>
>> By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @
>> /Users/stanton/.emacs.d/straight/build/org/).
>>
>> The table exports OK, but isn’t much fun to look at in the org file
>> itself.
>>
>> Since I like to use emacs-jupyter, any suggestions would be appreciated.
>> I know this worked fine just a few weeks ago.
>>
>> Thanks!
>>
>> Richard Stanton
>>
>>
>>
>>
>>
>>
>

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

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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-18 21:00     ` John Kitchin
@ 2022-05-18 21:12       ` Richard Stanton
  2022-05-19 13:37         ` Ihor Radchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stanton @ 2022-05-18 21:12 UTC (permalink / raw)
  To: John Kitchin; +Cc: orgmode

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

A bit more experimenting shows that asynchronous execution is actually a part of my original problem. By default, I have jupyter-python blocks running asynchronously. In that case, the tables don’t format quite right, as I noted. But if I add the header ":async nil", the table comes out fine. Table formatting is OK in python blocks with or without asynchronous execution. 

> On May 18, 2022, at 2:00 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> 
> I would guess it could. I don't do anything asynchronous, and I am not sure when org-babel-after-execute-hook runs, if it is immediately there is no table to clean up I suppose. It is not necessary to run on  a subtree, but on a very large document you probably don't want to do org-element-parse often.
> 
> 
> John
> 
> -----------------------------------
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>
> 
> 
> 
> On Wed, May 18, 2022 at 4:57 PM Richard Stanton <rhstanton@berkeley.edu <mailto:rhstanton@berkeley.edu>> wrote:
> Thanks for the suggestion, John. I’ve tried playing around with this, and am I right that it seems to have trouble when execution is asynchronous?
> 
>> On May 18, 2022, at 1:16 PM, John Kitchin <jkitchin@andrew.cmu.edu <mailto:jkitchin@andrew.cmu.edu>> wrote:
>> 
>> I use a function in an after execute hook for this: https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205 <https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205>
>> 
>> This works on a subtree, which has been fine for me. You could adapt it to only work in the results section.
>> 
>> John
>> 
>> -----------------------------------
>> Professor John Kitchin (he/him/his)
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>
>> 
>> 
>> 
>> On Wed, May 18, 2022 at 4:07 PM Richard Stanton <rhstanton@berkeley.edu <mailto:rhstanton@berkeley.edu>> wrote:
>> I’m running Emacs 28.1 under macOS 12.4 and want to create tables from Python code blocks that can be exported to either LaTeX or HTML. The simplest way to do this seems to be to generate the output as an org table, and using the built-in version of org (9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fine using either a python or emacs-jupyter code block:
>> 
>> #+begin_src jupyter-python
>> [
>>     ["Wide a", "b", "c"],
>>     None,
>>     [1, 2, 3],
>>     [4, 5, 6],
>>     None,
>>     [7, 8, 9]
>> ]
>> #+end_src
>> 
>> #+RESULTS:
>> | Wide a | b | c |
>> |--------+---+---|
>> |      1 | 2 | 3 |
>> |      4 | 5 | 6 |
>> |--------+---+---|
>> |      7 | 8 | 9 |
>> 
>> #+begin_src python 
>> return [
>>     ["Wide a", "b", "c"],
>>     None,
>>     [1, 2, 3],
>>     [4, 5, 6],
>>     None,
>>     [7, 8, 9]
>> ]
>> #+end_src
>> 
>> #+RESULTS:
>> | Wide a | b | c |
>> |--------+---+---|
>> |      1 | 2 | 3 |
>> |      4 | 5 | 6 |
>> |--------+---+---|
>> |      7 | 8 | 9 |
>> 
>> 
>> To use the latest version of org, I change just two lines in my init.el from
>> 
>> (straight-use-package '(org :type built-in))
>> (straight-use-package '(org-contrib :type built-in))
>> 
>> to
>> 
>> (straight-use-package '(org :type git :repo "https://code.orgmode.org/bzg/org-mode.git <https://code.orgmode.org/bzg/org-mode.git>"))
>> (straight-use-package '(org-contrib :type git :repo "https://git.sr.ht/~bzg/org-contrib <https://git.sr.ht/~bzg/org-contrib>”))
>> 
>> Having done this, the python block still works fine, but the horizontal lines in the jupyter-python block are no longer properly aligned with the text:
>> 
>> #+begin_src jupyter-python
>> [
>>     ["Wide a", "b", "c"],
>>     None,
>>     [1, 2, 3],
>>     [4, 5, 6],
>>     None,
>>     [7, 8, 9]
>> ]
>> #+end_src
>> 
>> #+RESULTS:
>> | Wide a | b | c |
>> |---+---+---|
>> | 1 | 2 | 3 |
>> | 4 | 5 | 6 |
>> |---+---+---|
>> | 7 | 8 | 9 |
>> 
>> #+begin_src python 
>> return [
>>     ["Wide a", "b", "c"],
>>     None,
>>     [1, 2, 3],
>>     [4, 5, 6],
>>     None,
>>     [7, 8, 9]
>> ]
>> #+end_src
>> 
>> #+RESULTS:
>> | Wide a | b | c |
>> |--------+---+---|
>> |      1 | 2 | 3 |
>> |      4 | 5 | 6 |
>> |--------+---+---|
>> |      7 | 8 | 9 |
>> 
>> By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @ /Users/stanton/.emacs.d/straight/build/org/).
>> 
>> The table exports OK, but isn’t much fun to look at in the org file itself.
>> 
>> Since I like to use emacs-jupyter, any suggestions would be appreciated. I know this worked fine just a few weeks ago.
>> 
>> Thanks!
>> 
>> Richard Stanton
>> 
>> 
>> 
>> 
>> 
> 


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

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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-18 21:12       ` Richard Stanton
@ 2022-05-19 13:37         ` Ihor Radchenko
  2022-05-19 18:16           ` Richard H. Stanton
  0 siblings, 1 reply; 13+ messages in thread
From: Ihor Radchenko @ 2022-05-19 13:37 UTC (permalink / raw)
  To: Richard Stanton; +Cc: John Kitchin, orgmode

Richard Stanton <rhstanton@berkeley.edu> writes:

> A bit more experimenting shows that asynchronous execution is actually a part of my original problem. By default, I have jupyter-python blocks running asynchronously. In that case, the tables don’t format quite right, as I noted. But if I add the header ":async nil", the table comes out fine. Table formatting is OK in python blocks with or without asynchronous execution. 

Can you also see the problem without using jupyter-python?
A detailed recipe starting from emacs -Q would help (see
https://orgmode.org/manual/Feedback.html)

Best,
Ihor


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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-19 13:37         ` Ihor Radchenko
@ 2022-05-19 18:16           ` Richard H. Stanton
  2022-05-19 19:22             ` Richard H. Stanton
  2022-05-19 23:22             ` Mark Barton
  0 siblings, 2 replies; 13+ messages in thread
From: Richard H. Stanton @ 2022-05-19 18:16 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: John Kitchin, orgmode

After a lot of bisecting my init.el to create the simplest possible example that shows the problem, I found that removing the package beacon makes everything work OK, both in sync and async mode.



> On May 19, 2022, at 6:37 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
> 
> Richard Stanton <rhstanton@berkeley.edu> writes:
> 
>> A bit more experimenting shows that asynchronous execution is actually a part of my original problem. By default, I have jupyter-python blocks running asynchronously. In that case, the tables don’t format quite right, as I noted. But if I add the header ":async nil", the table comes out fine. Table formatting is OK in python blocks with or without asynchronous execution. 
> 
> Can you also see the problem without using jupyter-python?
> A detailed recipe starting from emacs -Q would help (see
> https://orgmode.org/manual/Feedback.html)
> 
> Best,
> Ihor



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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-19 18:16           ` Richard H. Stanton
@ 2022-05-19 19:22             ` Richard H. Stanton
  2022-05-20  8:57               ` Ihor Radchenko
  2022-05-19 23:22             ` Mark Barton
  1 sibling, 1 reply; 13+ messages in thread
From: Richard H. Stanton @ 2022-05-19 19:22 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: John Kitchin, orgmode

Here’s a simple init.el that shows the problem (most of it is just boilerplate code to use straight.el to manage packages, and you may need to edit the python executable path).

-------------------

;;; straight
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

;;  Replace use-package with straight-use-package
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(setq use-package-verbose t)
(straight-use-package 'use-package-ensure-system-package)


;;; Which org-mode to use?

; (straight-use-package '(org :type git :repo "https://code.orgmode.org/bzg/org-mode.git"))
(straight-use-package '(org :type built-in))

;;; Find python executable
(setq exec-path (append '("/Users/stanton/anaconda3/bin") exec-path))

(use-package org
  :after (jupyter)
  :straight t
  :config
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((python . t)
     (jupyter . t))))

(use-package jupyter)

;; Make cursor more visible when you move a long distance
(use-package beacon :config (beacon-mode 1))

——————————

Now execute the following source block and you’ll see the misaligned table.

#+begin_src jupyter-python :async yes :session py
[['aaaaaaa', 'a'], None, ['b', 'b']]
#+end_src

Commenting out the last line of init.el, thus not loading the beacon package, gets things to work OK. But so does changing which version of org mode is loaded by commenting out one of the lines and uncommenting the other, so this is not only about the beacon package.

Best,

Richard





> On May 19, 2022, at 11:16 AM, Richard H. Stanton <rhstanton@berkeley.edu> wrote:
> 
> After a lot of bisecting my init.el to create the simplest possible example that shows the problem, I found that removing the package beacon makes everything work OK, both in sync and async mode.
> 
> 
> 
>> On May 19, 2022, at 6:37 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
>> 
>> Richard Stanton <rhstanton@berkeley.edu> writes:
>> 
>>> A bit more experimenting shows that asynchronous execution is actually a part of my original problem. By default, I have jupyter-python blocks running asynchronously. In that case, the tables don’t format quite right, as I noted. But if I add the header ":async nil", the table comes out fine. Table formatting is OK in python blocks with or without asynchronous execution. 
>> 
>> Can you also see the problem without using jupyter-python?
>> A detailed recipe starting from emacs -Q would help (see
>> https://orgmode.org/manual/Feedback.html)
>> 
>> Best,
>> Ihor
> 



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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-19 18:16           ` Richard H. Stanton
  2022-05-19 19:22             ` Richard H. Stanton
@ 2022-05-19 23:22             ` Mark Barton
  1 sibling, 0 replies; 13+ messages in thread
From: Mark Barton @ 2022-05-19 23:22 UTC (permalink / raw)
  To: Richard H. Stanton; +Cc: Ihor Radchenko, John Kitchin, orgmode

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

Richard,

You might want to check to see if pulsar is a good replacement for beacon. I had been using beacon for a while and switched recently. I don’t use Jupiter-python blocks any more because of some compatibility issues I experienced because I chose to compile Emacs from the master branch. I found the python blocks met my needs. He is the link to the pulsar package if you are interested. I found it much easier to config what actions cause the line to pulse to find point.
https://github.com/protesilaos/pulsar <https://github.com/protesilaos/pulsar>

Mark

> On May 19, 2022, at 11:16 AM, Richard H. Stanton <rhstanton@berkeley.edu> wrote:
> 
> After a lot of bisecting my init.el to create the simplest possible example that shows the problem, I found that removing the package beacon makes everything work OK, both in sync and async mode.
> 
> 
> 
>> On May 19, 2022, at 6:37 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
>> 
>> Richard Stanton <rhstanton@berkeley.edu> writes:
>> 
>>> A bit more experimenting shows that asynchronous execution is actually a part of my original problem. By default, I have jupyter-python blocks running asynchronously. In that case, the tables don’t format quite right, as I noted. But if I add the header ":async nil", the table comes out fine. Table formatting is OK in python blocks with or without asynchronous execution. 
>> 
>> Can you also see the problem without using jupyter-python?
>> A detailed recipe starting from emacs -Q would help (see
>> https://orgmode.org/manual/Feedback.html)
>> 
>> Best,
>> Ihor
> 
> 


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

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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-19 19:22             ` Richard H. Stanton
@ 2022-05-20  8:57               ` Ihor Radchenko
  2022-05-22 13:05                 ` Richard Stanton
  0 siblings, 1 reply; 13+ messages in thread
From: Ihor Radchenko @ 2022-05-20  8:57 UTC (permalink / raw)
  To: Richard H. Stanton; +Cc: John Kitchin, orgmode

"Richard H. Stanton" <rhstanton@berkeley.edu> writes:

> Here’s a simple init.el that shows the problem (most of it is just boilerplate code to use straight.el to manage packages, and you may need to edit the python executable path).
> ...
> ——————————
>
> Now execute the following source block and you’ll see the misaligned table.
>
> #+begin_src jupyter-python :async yes :session py
> [['aaaaaaa', 'a'], None, ['b', 'b']]
> #+end_src

I am unable to reproduce the problem using Emacs 28.1 on Linux.
I ran Emacs in a clean .emacs.d environment using
https://github.com/alphapapa/with-emacs.sh:

$ with-emacs.sh -e emacs -OPR -- -Q -l /tmp/bug.el /tmp/bug.org

with bug.el containing your script with latest Org line uncommented and
built-in Org line commented and bug.org containing the example source
block.

Best,
Ihor


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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-20  8:57               ` Ihor Radchenko
@ 2022-05-22 13:05                 ` Richard Stanton
  2022-05-26  4:27                   ` Ihor Radchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stanton @ 2022-05-22 13:05 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: John Kitchin, orgmode

Odd. Invoking it as you do on my Mac, I get the same results I noted earlier. 

> On May 20, 2022, at 1:57 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
> 
> "Richard H. Stanton" <rhstanton@berkeley.edu> writes:
> 
>> Here’s a simple init.el that shows the problem (most of it is just boilerplate code to use straight.el to manage packages, and you may need to edit the python executable path).
>> ...
>> ——————————
>> 
>> Now execute the following source block and you’ll see the misaligned table.
>> 
>> #+begin_src jupyter-python :async yes :session py
>> [['aaaaaaa', 'a'], None, ['b', 'b']]
>> #+end_src
> 
> I am unable to reproduce the problem using Emacs 28.1 on Linux.
> I ran Emacs in a clean .emacs.d environment using
> https://github.com/alphapapa/with-emacs.sh:
> 
> $ with-emacs.sh -e emacs -OPR -- -Q -l /tmp/bug.el /tmp/bug.org
> 
> with bug.el containing your script with latest Org line uncommented and
> built-in Org line commented and bug.org containing the example source
> block.
> 
> Best,
> Ihor



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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-22 13:05                 ` Richard Stanton
@ 2022-05-26  4:27                   ` Ihor Radchenko
  2022-05-26  8:42                     ` Richard Stanton
  0 siblings, 1 reply; 13+ messages in thread
From: Ihor Radchenko @ 2022-05-26  4:27 UTC (permalink / raw)
  To: Richard Stanton; +Cc: John Kitchin, orgmode

Richard Stanton <rhstanton@berkeley.edu> writes:

> Odd. Invoking it as you do on my Mac, I get the same results I noted earlier. 

Then, can you ask some other Mac user to reproduce? It is hard to fix
something not reproducible on my system :(

Or maybe we can arrange a live screensharing to directly debug the issue
on your system.

Best,
Ihor


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

* Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
  2022-05-26  4:27                   ` Ihor Radchenko
@ 2022-05-26  8:42                     ` Richard Stanton
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Stanton @ 2022-05-26  8:42 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: John Kitchin, orgmode

I’d be happy to do a live debug, but since this seems to involve an interaction between three packages, only one of which is org, and it’s quite easy to find an alternative way to achieve what I’m trying to do, I‘d probably suggest just ignoring this for now.

> On May 25, 2022, at 9:27 PM, Ihor Radchenko <yantar92@gmail.com> wrote:
> 
> Richard Stanton <rhstanton@berkeley.edu> writes:
> 
>> Odd. Invoking it as you do on my Mac, I get the same results I noted earlier. 
> 
> Then, can you ask some other Mac user to reproduce? It is hard to fix
> something not reproducible on my system :(
> 
> Or maybe we can arrange a live screensharing to directly debug the issue
> on your system.
> 
> Best,
> Ihor



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

end of thread, other threads:[~2022-05-26  8:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-18 20:05 Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version Richard Stanton
2022-05-18 20:16 ` John Kitchin
2022-05-18 20:56   ` Richard Stanton
2022-05-18 21:00     ` John Kitchin
2022-05-18 21:12       ` Richard Stanton
2022-05-19 13:37         ` Ihor Radchenko
2022-05-19 18:16           ` Richard H. Stanton
2022-05-19 19:22             ` Richard H. Stanton
2022-05-20  8:57               ` Ihor Radchenko
2022-05-22 13:05                 ` Richard Stanton
2022-05-26  4:27                   ` Ihor Radchenko
2022-05-26  8:42                     ` Richard Stanton
2022-05-19 23:22             ` Mark Barton

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.