0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-20 08:48:39 +00:00

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]].
This commit is contained in:
Carsten Dominik 2010-07-13 12:53:47 +02:00
parent ceb63ae94e
commit acb8bcfba7

View file

@ -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)