millejoh / emacs-ipython-notebook

Jupyter notebook client in Emacs
http://millejoh.github.io/emacs-ipython-notebook/
GNU General Public License v3.0
1.47k stars 122 forks source link

line numbers in input versus output cells #616

Closed psteinb closed 4 years ago

psteinb commented 5 years ago

Hi, thank you for providing ein to the emacs community. I really enjoy having a decent editor under my fingers while working with notebooks. Keep up the good work. I have a small question. I am using ein based on this configuration:

(use-package ein
  :init
  :after python
  :config
  ;;;http://millejoh.github.io/emacs-ipython-notebook/#subpackages
  (setq ein:completion-backend 'ein:use-company-backend)
  (setq ein:polymode t)
  )

There is one aspect that irritates me. Depending on whether I am in an input cell: emacs-ein input-cell My line numbers are visible. As soon as the curser moves through an output cell, the line numbers are gone: emacs-ein output-cell This makes the notebook move constantly from left to right and back. I checked the ein-poly.el file for help, but couldn't find anything straight away. I'd appreciate if anyone could lend a hand and suggest a solution or at least help me find one. I am using GNU Emacs 26.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.8) of 2019-04-30 on fc30.

Thanks

yatsky commented 5 years ago

That's what happens with me as well after I turned on polymode. What I do is just turn on display-line-numbers-mode in when I move out of the input cells. There is still some inconsistencies regarding line breaks in input cells when I move between these different cells but it's way less annoying and something I can live with.

millejoh commented 5 years ago

Thanks @yatsky, you beat me to this comment - polymode works by creating multiple indirect buffers, one for each different major mode, which means you have to enable line numbering for each indirect buffer. That means, if you have a notebook with python and markdown cells you would need to go to apython cell, to a markdown cell, and anywhere outside the cell and enable line numbering in each place.

dickmao commented 4 years ago

I would recommend turning off display-line-numbers-mode generally.