Ah, this is exactly what I was looking for. Thanks!

—Diego

On 28 Jan 2018, at 21:47, Grant Rettke <gcr@wisdomandwonder.com> wrote:

On Sun, Jan 28, 2018 at 7:54 AM, Diego Zamboni <diego@zzamboni.org> wrote:
Hi,

I’ve been converting many of my configuration files to org-mode to better document them (examples: https://github.com/zzamboni/dot_emacs/blob/master/init.orghttps://github.com/zzamboni/dot_elvish/blob/master/rc.org). Usually I have a line like the following at the top of each org file:

#+PROPERTY: header-args:emacs-lisp :tangle init.el

So that all the code blocks in the file are, by default, tangled to the corresponding config file. I was wondering if it might be possible to avoid hardcoding the output file (“init.el” in this example) and instead derive it from the source filename (“init.org” in this case). I’ve looked a bit through the manual and although I found the macro, I couldn’t get it to work.

#+PROPERTY: header-args :tangle (concat (file-name-sans-extension (buffer-file-name)) ".el")

#+NAME: org_gcr_2018-01-25_mara_5AA14ABD-5F82-4515-893A-B2370B6F4321
#+BEGIN_SRC emacs-lisp
(message "Text")
#+END_SRC