jupyter icon indicating copy to clipboard operation
jupyter copied to clipboard

Indentation broken with latest 9.7.x/9.8 org mode

Open danielpopescu opened this issue 1 year ago • 6 comments

When using python code.

Using both emacs 30.1 and 29.1 on macos or linux.

Makes writing even small pieces of code frustrating now in python...

If revert to ob-python, all works well....

Ty.

danielpopescu avatar Aug 02 '24 00:08 danielpopescu

No one else has this issue? Or if yes, what's the workaround if any? Ty

danielpopescu avatar Aug 21 '24 12:08 danielpopescu

Have you figured it out? I'm having similar issue on emacs-29.4, org-9.7.19 on linux. Haven't tried other versions yet.

....

UPDATE: I think I found the which causes the issue in my case. I have following line in my init.el. Removing it fixes my issue of indentation. I'm still not sure why exactly.

(setq major-mode-remap-alist
      '((bash-mode   . bash-ts-mode)
        (python-mode . python-ts-mode)))

garid3000 avatar Jan 15 '25 03:01 garid3000

Have you figured it out? I'm having similar issue on emacs-29.4, org-9.7.19 on linux. Haven't tried other versions yet.

....

UPDATE: I think I found the which causes the issue in my case. I have following line in my init.el. Removing it fixes my issue of indentation. I'm still not sure why exactly.

(setq major-mode-remap-alist
      '((bash-mode   . bash-ts-mode)
        (python-mode . python-ts-mode)))

Unfortunately no. I use both emacs 29.4 and 30.1 (work and home, Linux and Mac), native compilation + treesit, with either org 9.7.x or org 9.8.x and it doesnt work in any combination. For now, I mostly stopped using jupyter (just use ob-python) and If I do use it, I am not writing any complex code inside it (just mostly few lines, no indentation).

When did it start happening for you? Was after an update? A new package install?

It's too bad because it used to work great for a while....

danielpopescu avatar Jan 15 '25 11:01 danielpopescu

When did it start happening for you? Was after an update? A new package install?

No, This is my first time experimenting with this package. Also I found out that following works: (It seems my issue was something like org-babel was confusing between python, python-ts)

(setq major-mode-remap-alist
      '((bash-mode   . bash-ts-mode)
        (python-mode . python-ts-mode)))

(setf (alist-get "python" org-src-lang-modes nil nil #'equal) 'python-ts) ;; <-- check this line

garid3000 avatar Jan 15 '25 11:01 garid3000

When did it start happening for you? Was after an update? A new package install?

No, This is my first time experimenting with this package. Also I found out that following works: (It seems my issue was something like org-babel was confusing between python, python-ts)

(setq major-mode-remap-alist
      '((bash-mode   . bash-ts-mode)
        (python-mode . python-ts-mode)))

(setf (alist-get "python" org-src-lang-modes nil nil #'equal) 'python-ts) ;; <-- check this line

Interesting! I already have that but it did not fix it for me. Where do u have

(setf (alist-get "python" org-src-lang-modes nil nil #'equal) 'python-ts) ;; <-- check this line

? I had it before and after loading jupyter and it did not do anything for me... It may be some ordering issue...

danielpopescu avatar Jan 15 '25 18:01 danielpopescu

I also think this may be a jupyter issue rather than org. ob-python works with python-ts-mode... My guess is that jupyter has to be updated to work with either mode. A lot of people are switching to ts-modes, I am surprised this is not a more common issue...

danielpopescu avatar Jan 15 '25 18:01 danielpopescu