When I try to write code in source block in Org mode, pressing return once acts as expected while hitting it a second time increases the indentation to two levels if it's currently less than that. Here's an example of how the cursor moves when I press return at various initial indentation levels:
#+begin_src python def my_function(): # Each "." shows where the cursor goes after pressing RET. . . . . def internal_function(): # Same thing from here. . . . . def double_internal_function(): # Same thing from here. . . . . # Same thing from here. . . . . #+end_src
(org-return electric-indent-mode) that is being called when I press return, and I'm able to reproduce this behavior by calling this myself. Some other function calls that don't exhibit the same behavior are
(newline-and-indent). If I disable
electric-indent-mode, then the second return eliminates all indentation entirely. Ideally, I would want repeatedly pressing return to maintain the same indentation level.