[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [BUG][babel] Tangling into directories does not add directories
From: |
Aaron Ecay |
Subject: |
Re: [O] [BUG][babel] Tangling into directories does not add directories to org file |
Date: |
Fri, 10 Oct 2014 12:34:25 -0400 |
User-agent: |
Notmuch/0.18.1+56~g6c9721a (http://notmuchmail.org) Emacs/24.4.50.2 (x86_64-unknown-linux-gnu) |
Hi Rainer,
2014ko urriak 10an, Rainer M Krug-ek idatzi zuen:
> It looks like this - but I am always shocked by the number of brackets
> in lisp.
It’s a bit of an adjustment. If you get into any serious lisp coding,
check out paredit – it forces you to always have balanced brackets in
the file, thus avoiding a whole class of silly but hard-to-spot mistakes
on lines ending with and avalanche of )))))
<http://www.emacswiki.org/emacs/ParEdit>
>
> 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.
Something like (file-name-directory (buffer-file-name)) should do the
trick, I think. It would be good if you could test tangling from a
remote (i.e. via TRAMP) org file to a local output file and vice versa
to make sure that this DTRT in those cases as well.
Don’t hesitate to ask if you have more questions!
--
Aaron Ecay