You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand I could use #+BEGIN_SRC emacs-lisp :tangle filename, but if OrgTangle could parse the :tangle yes attribute my setup would be simpler.
If this is not possible, an alternative would be to be able to get this information as a property of the file, like this:
I really won't have time to do this anytime soon, but it should be really easy if you know some basic Python. If you're interested in implementing it, here's a quick starting point:
Create a dict somewhere associating languages names to extensions: eg {"python": "py", "c++": "cpp"} etc.
Somewhere around here, handle yes case: use fileinput.filename() to get the name of the org file being read. Handle the case where the script is reading from stdin with fileinput.isstdin(); abort with an error message. (real org would prompt, but Emacs is interactive) [Question: would "t" be valid too?]
Somewhere around here, read language name from line[1]. The language name will be all lowercase.
Find new extension in this dict, make new file name by replacing extension of input file name only if .org, otherwise append. Nicely handle KeyError (nicely = crash, but explain why)
I understand I could use
#+BEGIN_SRC emacs-lisp :tangle filename
, but if OrgTangle could parse the:tangle yes
attribute my setup would be simpler.If this is not possible, an alternative would be to be able to get this information as a property of the file, like this:
#+PROPERTY: header-args:emacs-lisp :tangle filename
The text was updated successfully, but these errors were encountered: