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