I have a python code file with a large multiline string comment that I'm using as a sort of checklist for tests that I'm implementing.

Is it possible to have just that portion of the buffer be in org mode so I can have checkboxes and heading and stuff?

python code

large text block
that I would like to be
in org mode

more python code implementing tests

Note that this is org that I want to embed in a python file. Not vice versa.


Sure thing!

Just add this here to your init:

(use-package poporg
    :ensure t
    :bind ("C-c \\" . poporg-dwim))

Then place your cursor in the comment you want to insert Org and press C-c \.

Here's more info about it: https://github.com/QBobWatson/poporg

And here's a thread on Emacs Reddit about it: https://www.reddit.com/r/emacs/comments/aadbf6/poporg_is_great/


I'll look into poporg like @dangom said but one thing that I managed to figure out.

I could clone-indirect-buffer to another window then narrow that buffer to just the area in question by using a region, then enable mmm-mode on each one. Then finally run mmm-parse-buffer on each. It then seems to guess that my main buffer is python-mode and the buffer narrowed to just org is org-mode!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.