Already one year ago, I described a problem on github with polymode and unexpected indents. Since there was no answer there so far and the problem is really annoying, I ask here for ideas for a workaround of the problem:
I am using polymode like this for
pycode
environments in latex documents:(defcustom pm-inner/python (pm-inner-chunkmode "python" :head-matcher "\\\\begin{\\(pycode\\|pythontexcustomcode\\|sagecode\\)}" :tail-matcher "\\\\end{\\(pycode\\|pythontexcustomcode\\|sagecode\\)}" :mode 'python-mode) "python typical chunk." :group 'innermodes :type 'object) (defcustom pm-poly/latex-python (pm-polymode "latex-python" :hostmode 'pm-host/latex :innermodes '(pm-inner/python)) "latex-python typical polymode." :group 'polymodes :type 'object) (define-polymode poly-latex+python-mode pm-poly/latex-python) (add-to-list 'auto-mode-alist '("\\.tex$" . poly-latex+python-mode))
Now the pycode environment may have an optional argument for the python session name, for example
\begin{pycode}[SessionName] a = 2 \end{pycode}
If I hit Enter at the end of a line, in the next line it automatically adds some unwanted tabs like in the following screen cast:
In a
pycode
environment without optional argument however it works as expected.My polymode version is 20190624.1927 in emacs 26.1