Question

I really like the org-babel that enables me to organize my scripts in org-mode, however, i found there are some issues with the org src buffer when i edit the source code in a separate buffer (using keybinding C-c ').

first thing is, even i explicitly run write-file, and then specifies the file path and name to save, the buffer is not saved to that file, but the source code block in the .org file gets updated and the .org -file is saved.

second thing is, whenever i run save-buffer in org src buffer, the buffer screen will automatically scroll down till current mouse position is the last line in the buffer. this is annoying because sometimes i lose tracking my scripts. i am not so familiar with elisp, and can only do simple work like define-key or add-hook, i hope i can get help from here. thanks

Was it helpful?

Solution

Org-babel is not meant for organizing scripts, but for including source code as part of your document.

You may be interested in tangling, which allows to join and extract source code blocks from your orgmode document into separate files.

The following example will merge 2 source code fragments into the file test.m when tangling (org-babel-tangle, bound to C-c C-v t):

* Tangling example

Set up a vector:

#+begin_src octave :tangle test.m
  a = 1:10;
#+end_src

Then find out squares

#+begin_src octave :tangle test.m
  b = a.^2
#+end_src
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top