Different background in current Python cell reddit / emacs ---------------------------------------------------------------------- wehrad · 2022-05-01 22:06 Hi everyone, I use the simple but very convenient [code- cells](https://github.com/astoff/code-cells.el) package to run python cells. E.g. with the Spyder IDE, the cell where the cursor is currently in has a different background color, and I'd love to have that in emacs. Would you have any idea on how to do that? I guess one idea is to find the closest "# %%" pattern up and down from cursor and change background color in that region, but I have no idea how to implement this, also for it to change back to the normal background when the cursor is not in the cell anymore... Thank you a lot in advance for your help! ---------------------------------------------------------------------- dpoggio · 2022-05-02 00:10 Check this: https://www.emacswiki.org/emacs/HighlightLibrary Then you just need to set the region and use `hlt-highlight-region` or `hlt-unhighlight-region`. ---------------------------------------------------------------------- ainstr · 2022-05-02 01:55 To start, you probably want to look at [code-cells-- bounds](https://github.com/astoff/code- cells.el/blob/8660bdeedee360e5eb632f1eb1356eb09d7dfbee/code- cells.el#L107), which integrates those cell start/end patterns.