From: Aaron Ecay <aaronecay@gmail.com>
To: Rainer M Krug <Rainer@krugs.de>, emacs-orgmode@gnu.org
Subject: Re: [BUG][babel] Tangling into directories does not add directories to org file
Date: Fri, 10 Oct 2014 12:55:37 -0400 [thread overview]
Message-ID: <878uknx3sm.fsf@gmail.com> (raw)
In-Reply-To: <87iojrx4ry.fsf@gmail.com>
Hi Rainer,
2014ko urriak 10an, Aaron Ecay-ek idatzi zuen:
[...]
>> the function file-relative-name (file-relative-name FILENAME &optional
>> DIRECTORY). If I am not mistaken, the optional argument DIRECTORY
>> needs to be set to the directory of the tangled file. I assume it is
>> not set at the moment.
>>
>> But I have no idea how to get this path and how to pass it to the
>> function.
>
> Something like (file-name-directory (buffer-file-name)) should do the
> trick, I think.
I just (re)-read the “...and pass it to the function” part. The lisp
convention is that function calls look like:
(FUNCTION ARG1 ARG2 ... ARGN)
So you’d want something like:
(file (if org-babel-tangle-use-relative-file-links
(file-relative-name (nth 1 spec) (file-name-directory (buffer-file-name))) ;;; <- addition here
(nth 1 spec)))
(link (let ((link (nth 2 spec)))
(if org-babel-tangle-use-relative-file-links
(when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link)
(let* ((type (match-string 1 link))
(path (match-string 2 link))
(origpath path)
(case-fold-search nil))
(setq path (file-relative-name path (file-name-directory (buffer-file-name)))) ;;; <- addition here
(concat type path)))
link)))
Apologies if this is too basic an explanation, or otherwise unclear...
--
Aaron Ecay
prev parent reply other threads:[~2014-10-10 16:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-08 13:21 [BUG][babel] Tangling into directories does not add directories to org file Rainer M Krug
2014-10-09 12:37 ` Rainer M Krug
2014-10-10 2:13 ` Grant Rettke
2014-10-10 8:24 ` Rainer M Krug
2014-10-10 14:41 ` Grant Rettke
2014-10-10 3:55 ` Aaron Ecay
2014-10-10 8:45 ` Rainer M Krug
2014-10-10 16:34 ` Aaron Ecay
2014-10-10 16:50 ` Thorsten Jolitz
2014-10-10 18:37 ` Grant Rettke
2014-10-10 16:55 ` Aaron Ecay [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=878uknx3sm.fsf@gmail.com \
--to=aaronecay@gmail.com \
--cc=Rainer@krugs.de \
--cc=emacs-orgmode@gnu.org \
/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).