From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ethan Ligon Subject: Adding information to tangled code regarding org-source Date: Tue, 3 May 2016 21:33:37 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axhxG-0003OX-4i for emacs-orgmode@gnu.org; Tue, 03 May 2016 17:34:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axhx4-0004YP-GM for emacs-orgmode@gnu.org; Tue, 03 May 2016 17:34:00 -0400 Received: from plane.gmane.org ([80.91.229.3]:37328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axhx4-0004WQ-9w for emacs-orgmode@gnu.org; Tue, 03 May 2016 17:33:54 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1axhwt-000749-6u for emacs-orgmode@gnu.org; Tue, 03 May 2016 23:33:43 +0200 Received: from dhcp-128-32-175-220.lips.berkeley.edu ([128.32.175.220]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 May 2016 23:33:43 +0200 Received: from ligon by dhcp-128-32-175-220.lips.berkeley.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 May 2016 23:33:43 +0200 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 When one exports from org to, say, latex the resulting *.tex file includes a comment at the top indicating the time of creation. This is useful in part because it lets the user know that the *.tex file isn't the original source. The same isn't true of tangled code from a source block, and I've been repeatedly bitten by editing a file of python code that was tangled from a source org file. I'd like to deal with this by making tangle emit a comment with information about the org-source file. The :prologue header argument is well suited to this; e.g., #+begin_src python :tangle /tmp/test.py :prologue (format "# Tangled from %s on %s" (buffer-file-name) (current-time-string)) print "Hello, world!" #+end_src produces what one would want. I'd like to make this header argument be applied automatically. The variable org-babel-default-header-args looks like just the ticket, but my lame efforts to write the necessary emacs-lisp aren't working: #+BEGIN_SRC emacs-lisp (add-to-list 'org-babel-default-header-args:python '((:prologue . (format "# Tangled from %s on %s" (buffer- file-name) (current-time-string))))) #+END_SRC What am I doing wrong? Thanks for any help, -Ethan