The file name doesn't have to be a string constant, you can also call an Elisp function: (the org-prefix is recommended or you will have issues with HTML export)
I use this approach for example to generate different Emacs configurations for different platforms and use cases (private, work, ...) all from a single org file.
Uncommonly useful: I have a file with two functions that I want to not just see side-by-side, but with a diff.
`C-x 4 c' runs the command clone-indirect-buffer-other-window
Now you can narrow both buffers to the two different functions (mark and C-x n n) and do M-x ediff-buffers to get a diff
Usually you put a code block like this in the .org file and generate the actual source file with M-x org-babel-tangle.
The file name doesn't have to be a string constant, you can also call an Elisp function: (the org-prefix is recommended or you will have issues with HTML export) The function could look like this: ("no" means don't tangle this block) Or like this: (a more complex example using named, optional parameters) This will tangle to init.el on any system: This will tangle to init.el on Linux: This will tangle to foo.el on Windows: I use this approach for example to generate different Emacs configurations for different platforms and use cases (private, work, ...) all from a single org file.