Timeline for How do I define default language for org-mode source code blocks?
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 28, 2023 at 15:13 | answer | added | crocefisso | timeline score: 4 | |
| May 10, 2022 at 12:33 | answer | added | ruby_object | timeline score: 2 | |
| May 10, 2022 at 12:23 | comment | added | ruby_object | I have seen some vague document written years ago suggesting I could have the language argument defined once at the top of the file. | |
| May 10, 2022 at 12:18 | comment | added | dalanicolai | Indeed, therefore I did not post it as an answer. Can you tell me what C-c , s does? With yasnippet keys you can e.g. insert 'p' followed by your shortcut for yas-maybe-expand to insert a python code block, and 'r' + the shortcut, to enter a ruby code block. I am not sure why you think your approach is more flexible, but you should use the solution that you prefer of course. I just wasn't sure about the advice you had already digested. At least, now it is clear that this advice does not include a satisfactory solution. | |
| May 10, 2022 at 12:16 | comment | added | ruby_object | emacsdocs.org/docs/org/Structure-of-Code-Blocks#language says the language is mandatory. So there must have been a change in the org mode. Please correct me if I am wrong. | |
| May 10, 2022 at 11:46 | comment | added | ruby_object | Your advice does not answer my question. If I understand you correctly you suggest something like typing scb and using emacs to expand it into a source code block with declared language. I can press a shortcut C-c , s to get a generated source code block. I want it to leave it as it is without adding any headers to the block. there seems to be a possibility to do what I need in the properties at the top of the org file. Doing it that way would be more flexible if I wanted different literate files for different langiages. | |
| May 10, 2022 at 11:35 | comment | added | dalanicolai | I am not sure what kind of contradicting advice you have 'digested', but I would advise you to either use org-babel-demarcate-block (using some handy shortcut), or create useful snippets with yasnippet (using either a shortcut, or maybe even handier keys + expansion). You might use snippets you find on the web, but it is easy enough to create custom snippets yourself. | |
| May 10, 2022 at 11:11 | history | asked | ruby_object | CC BY-SA 4.0 |