From acb8bcfba7023b362a7fbe9615bb167a046ad26d Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 13 Jul 2010 12:53:47 +0200 Subject: [PATCH] Fix relative path creation when making a file link * lisp/org.el (org-insert-link): Correctly determine if we should use a relative path. Aidan Gauland writes: > If I create a link with C-c C-l and give it a relative "file:" link, a > link is created with an absolute path. For example, C-c C-l > file:../foo.org foo puts > [[file:~/path/to/working-directory/foo.org][foo]] in the buffer. I was > expecting [[file:../foo.org][foo]]. --- lisp/org.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index df511e7c0..a2c6359cd 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8704,8 +8704,9 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (t (save-match-data (if (string-match (concat "^" (regexp-quote - (file-name-as-directory - default-directory))) + (expand-file-name + (file-name-as-directory + default-directory)))) (expand-file-name path)) ;; We are linking a file with relative path name. (setq path (substring (expand-file-name path)