From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jack Henahan Subject: Re: Specifying the tangle filename based on the source filename? Date: Sun, 28 Jan 2018 13:13:50 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1efrSq-0006vc-2q for emacs-orgmode@gnu.org; Sun, 28 Jan 2018 13:14:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1efrSm-00070T-Ts for emacs-orgmode@gnu.org; Sun, 28 Jan 2018 13:14:00 -0500 Received: from ms11p00im-qufv17100601.me.com ([17.58.37.33]:51445) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1efrSm-0006zi-NC for emacs-orgmode@gnu.org; Sun, 28 Jan 2018 13:13:56 -0500 Received: from process-dkim-sign-daemon.ms11p00im-qufv17100601.me.com by ms11p00im-qufv17100601.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P3A0060005JPS00@ms11p00im-qufv17100601.me.com> for emacs-orgmode@gnu.org; Sun, 28 Jan 2018 18:13:54 +0000 (GMT) Received: from icloud.com ([127.0.0.1]) by ms11p00im-qufv17100601.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P3A0094U2N2P110@ms11p00im-qufv17100601.me.com> for emacs-orgmode@gnu.org; Sun, 28 Jan 2018 18:13:54 +0000 (GMT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org I do something similar, and I use a snippet like this #+begin_src emacs-lisp (defun the-in-the-org-lib-p () (and (f-this-file) (f-child-of? (f-this-file) the-org-lib-directory))) (defun the-org-lib-hook () (if (the-in-the-org-lib-p) (progn (setq-local org-babel-default-header-args:emacs-lisp `((:tangle . ,(f-expand (f-swap-ext (f-filename (f-th= is-file)) "el") the-lib-directory)) (:noweb . "yes")))))) (add-hook 'org-mode-hook 'the-org-lib-hook) #+end_src `the-org-lib-directory' points to where all my Org config sources are, while `the-lib-directory' points to where the tangled files go. My Org files then have a structure like org/whatever.org * Configuring Whatever Features ** Requirements :noexport: #+begin_src emacs-lisp ;; -*- lexical-binding: t; -*- ;;; whatever.el --- Whatever functionality =20=20=20=20=20 (require 'whatever) #+end_src ** Some Subfeature Explain how we use the feature #+begin_src emacs-lisp (my-configuration 'stuff) #+end_src ** Provides :noexport: #+begin_src emacs-lisp (provide 'whatever) ;;; whatever.el ends here #+end_src I have some additional configuration to tangle my lib files on save, and to regenerate the top-level documentation so that (in theory) the README is always up to date with the configuration. The :noexport: tags remove the noise of require and provides when I export. Diego Zamboni writes: > Hi, > > I=E2=80=99ve been converting many of my configuration files to org-mode t= o better document them (examples: > https://github.com/zzamboni/dot_emacs/blob/master/init.org, https://githu= b.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 c= orresponding config file. I was wondering if it might be > possible to avoid hardcoding the output file (=E2=80=9Cinit.el=E2=80=9D i= n this example) and instead derive it from the source filename (=E2=80=9Cin= it.org=E2=80=9D in > this case). I=E2=80=99ve looked a bit through the manual and although I f= ound the {{{input-file}}} macro, I couldn=E2=80=99t get it to work. > > Thanks for any help, > =E2=80=94Diego