astoff / code-cells.el

Emacs utilities for code split into cells, including Jupyter notebooks
GNU General Public License v3.0
190 stars 12 forks source link

INFO - Alternative solution for editing the markdown blocks #28

Open mbarton98 opened 6 months ago

mbarton98 commented 6 months ago

I wanted something like Org Mode's special edit for the markdown cells. I then found poporg while searching for a solution. It will auto detect the comment prefix to strip off when editing the text and then when you exit it puts the prefix back in with the updated text. This solves another problem for me outside of code-cells, so I prefer this over the triple quote solution for now. Below is how I configured the binding to be the same as org special edit but not conflict with it.

(use-package poporg
  :ensure t
  :bind
  (:map prog-mode-map
    ("C-c '" . poporg-dwim)
    )
  (:map poporg-mode-map
    ("C-c '" . poporg-dwim)
    )
)
dmolina commented 5 months ago

Thank you a lot. Code-cells is great for running/editing notebooks, the part of source code is great, better in my opinion than other options like ein. However, editing markdown cells is not good. Your suggestion is great. I think it could be indicated in the README in order to inform users of code-cells, because it is a great improvement for editing the markdown cells.

mbarton98 commented 5 months ago

@dmolina Yes, I have been really happy working with code-cells. I have been using Jupytext for years, so when I needed to refactor code or use a copy of a notebook as a template for a new reporting project, I would edit the .py file to use eglot and pylsp to make it easy to rename variables and use Ruff for formatting and linting. Code-cells brings that exploration of the notebook, where it is easy to navigate cells and send code to the ipython repl back to Emacs, so now I just use Jupyter Lab for presenting to others and not so much with the development.