emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Chris Maier <christopher.maier@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org, "Charles C. Berry" <cberry@tajo.ucsd.edu>,
	Rainer M Krug <r.m.krug@gmail.com>
Subject: Re: [BABEL] Tangling to a hierarchy of files?
Date: Wed, 19 Jan 2011 13:18:45 -0500	[thread overview]
Message-ID: <AANLkTi=DJsosp-PSTRn7KycP8DJoOF7YjHEgOFGu8tC1@mail.gmail.com> (raw)
In-Reply-To: <87vd1k3i62.fsf@gmail.com>

On Wed, Jan 19, 2011 at 12:41 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> Chris Maier <christopher.maier@gmail.com> writes:
>>
>> Is there a place where this and the eval-on-startup trick Charles
>> posted are documented?  If so, I missed it, and these are both really
>> useful to know.
>>
>
> We don't currently have a good place in which to collect such tricks,
> probably the closest is a file called scraps.org which I use for
> stubbing out examples when responding to mailing list questions or doing
> development.  Each subheading is a short self-contained example.  I do
> plan on transforming this at some point into either a page on Worg
> "Babel Tricks" or into a "Babel a Day" series or some such.  The page is
> available at the following (notice this dir. trick is at the top)
> https://github.com/eschulte/babel-dev/raw/master/scraps.org

Thanks for the link.

>>> Would it be possible, to include this into tangling, i.e. if the folder
>>> in which the source file should be created does not exist, create it?
>>>
>>> I remember vaguely a discussion along these lines some time ago, but I
>>> don't remember the outcome?
>>
>> This would be a great feature to have.  Eric's embedded Lisp code
>> trick will do the job, but I can imagine that it would get cumbersome
>> for more complex projects.
>>
>
> This issue has come up recently -- also raised (I believe) by a
> Clojurian most likely wanted to create a lein directory layout.
>
> The reason that I push back against this, is that I often times
> accidentally use a tangle path in which the directory does not exist and
> the error notification serves as a useful warning that I either
> mis-typed the directory or need to create it.
>
> I would suggest either using the pre-tangle hook, or using my trick
> above, which could be made more graceful with the following function
> defined...
>
> #+begin_src emacs-lisp
>  (defun mkdir-p (file &optional dir)
>    "Create any parent directories of FILE if missing and return FILE."
>    (make-directory (file-name-directory file) (or dir ".")) file)
> #+end_src
>
> However given that there seems to be some wide support for this maybe a
> customization variable should be introduce,
> e.g. org-babel-tangle-mkdirs-p or somesuch...
>
> Cheers -- Eric

A customization variable would be fantastic.  Could it be done such
that it could be applied (or not applied, according to taste) to a
sub-tree of your Org file?  That way you could have it disabled on
whatever code you might be currently working on so you still see the
error messages if you mistype.  Then, when you're satisfied with all
your tangle paths, you could flip the switch on that sub-tree and have
Org do everything for you.

Chris

  reply	other threads:[~2011-01-19 18:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19  4:02 [BABEL] Tangling to a hierarchy of files? Christopher Maier
2011-01-19  6:45 ` Charles C. Berry
2011-01-19  7:22   ` Eric Schulte
2011-01-19 10:05     ` Rainer M Krug
2011-01-19 11:59       ` Chris Maier
2011-01-19 12:06         ` Rainer M Krug
2011-01-19 16:20         ` Charles C. Berry
2011-01-19 16:27           ` Chris Maier
2011-01-19 17:41         ` Eric Schulte
2011-01-19 18:18           ` Chris Maier [this message]
2011-01-20  3:37             ` Eric Schulte
2011-01-20 10:06               ` Rainer M Krug
2011-01-21  2:11               ` Chris Maier
2011-01-20  9:09           ` Christopher Witte
2011-01-20 16:11             ` Eric Schulte

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='AANLkTi=DJsosp-PSTRn7KycP8DJoOF7YjHEgOFGu8tC1@mail.gmail.com' \
    --to=christopher.maier@gmail.com \
    --cc=cberry@tajo.ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=r.m.krug@gmail.com \
    --cc=schulte.eric@gmail.com \
    /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).