From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: [BUG][babel] Tangling into directories does not add directories to org file Date: Fri, 10 Oct 2014 12:34:25 -0400 Message-ID: <87iojrx4ry.fsf@gmail.com> References: <87iojsk28y.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xcd9U-000464-3X for emacs-orgmode@gnu.org; Fri, 10 Oct 2014 12:34:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xcd9O-0001fb-5Z for emacs-orgmode@gnu.org; Fri, 10 Oct 2014 12:34:48 -0400 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:37494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xcd9N-0001fV-VQ for emacs-orgmode@gnu.org; Fri, 10 Oct 2014 12:34:42 -0400 Received: by mail-wi0-f180.google.com with SMTP id em10so2628840wid.1 for ; Fri, 10 Oct 2014 09:34:41 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rainer M Krug , emacs-orgmode@gnu.org 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=E2=80=99s a bit of an adjustment. If you get into any serious lisp codi= ng, check out paredit =E2=80=93 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 ))))) >=20 > The "problem" is in the function =3Ddefun org-babel-spec-to-string (spec)= =3D > in the file =3Dlisp/ob-tangle.R=3D in the section >=20 > #+begin_src emacs-lisp=20 > (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 >=20 > 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.=20 >=20 > 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=E2=80=99t hesitate to ask if you have more questions! --=20 Aaron Ecay