فهرست منبع

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 <RET> foo puts
> [[file:~/path/to/working-directory/foo.org][foo]] in the buffer.  I was
> expecting [[file:../foo.org][foo]].
Carsten Dominik 14 سال پیش
والد
کامیت
acb8bcfba7
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      lisp/org.el

+ 3 - 2
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)