emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble producing nicely aligned org tables from emacs-jupyter code


From: Richard H. Stanton
Subject: Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version
Date: Thu, 19 May 2022 12:22:20 -0700

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
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]