I would like to add snippets of code for several languages to my org files.
The code I enter has syntax highlighting, but does use correct indetation. One language I use is python, and I have seen here, that what I want is possible. In the linked video, referring to entering code snippets with the correct syntax highlighting and so fourth, Matthew says:
"... provided you have configured the appropriate settings...".
I am not sure what I could be missing as, for example, my python works just fine in a python buffer.
I always need to open a separate buffer to achieve this, as mentioned here. The OP in that answer pasted his code in from somewhere else, but I am writing mine on the fly. Also, I do not really wish to use the accepted answer there, which is the timed-running of a custom function
As a clear example, I enter the code here, leaving my cursor at the underscore, _ :
#+begin_src python
for i in range(1:23): _
∫ √
#+end_src
and when I press enter, I end up at the integral sign, ∫. I would of coursel ike to end up at the square root symbol (sorry for overkill on symbols!). That means 4-space indent.
My Emacs 24.5 (9.0) on Mac OSX automatically inserts the #+begin_src
and #+end_src
all in upper case. I have tried both out and it doesn't make a difference.
I know there are some parameters one can set in the opening line, after having written the mode, in my case python
is there. Is there a parameter to specify something like indentation in the code snippet?