[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [BUG][babel] Tangling into directories does not add directories
From: |
Rainer M Krug |
Subject: |
Re: [O] [BUG][babel] Tangling into directories does not add directories to org file |
Date: |
Fri, 10 Oct 2014 10:45:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) |
Aaron Ecay <address@hidden> writes:
> Hi Rainer,
>
> 2014ko urriak 9an, Rainer M Krug-ek idatzi zuen:
>>
>> I'd like to ping this as I think it
>> is an important bug. It e.g. make debugging of R packages, whose source
>> is in org, more difficult, (the .R files are tangled into ./R/) as ess
>> does not find the source of the R code in R as it uses the links in the
>> comments to find the org file.
>
> FWIW, I agree with you, but personally it’s hard to see myself having
> time to address this in the near future. Maybe you could try making a
> patch yourself. It sounds like the sort of thing that should be
> self-contained and easy to fix (famous last words, I know...)
It looks like this - but I am always shocked by the number of brackets
in lisp.
The "problem" is in the function =defun org-babel-spec-to-string (spec)=
in the file =lisp/ob-tangle.R= in the section
#+begin_src emacs-lisp
(file (if org-babel-tangle-use-relative-file-links
(file-relative-name (nth 1 spec))
(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))
(concat type path)))
link)))
#+end_src
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.
Rainer
--
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
pgpw5FmP5Bb6T.pgp
Description: PGP signature