emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ken Mankoff <mankoff@gmail.com>
To: Ethan Ligon <ligon@berkeley.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: Adding information to tangled code regarding org-source
Date: Tue, 03 May 2016 21:23:49 -0400	[thread overview]
Message-ID: <m2bn4msjiy.fsf@gmail.com> (raw)
In-Reply-To: <loom.20160503T232411-815@post.gmane.org>


How about ":comments link" header arg?

https://org-babel.readthedocs.io/en/latest/header-args/#comments

  -k.

On 2016-05-03 at 17:33, Ethan Ligon <ligon@berkeley.edu> wrote:
> 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

      reply	other threads:[~2016-05-04  1:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 21:33 Adding information to tangled code regarding org-source Ethan Ligon
2016-05-04  1:23 ` Ken Mankoff [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2bn4msjiy.fsf@gmail.com \
    --to=mankoff@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ligon@berkeley.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).