|
@@ -6339,7 +6339,10 @@ This command can be called in any mode to insert a link in Org-mode syntax."
|
|
|
(defun org-insert-link (&optional complete-file link-location)
|
|
|
"Insert a link. At the prompt, enter the link.
|
|
|
|
|
|
-Completion can be used to select a link previously stored with
|
|
|
+Completion can be used to insert any of the link protocol prefixes like
|
|
|
+http or ftp in use.
|
|
|
+
|
|
|
+The history can be used to select a link previously stored with
|
|
|
`org-store-link'. When the empty string is entered (i.e. if you just
|
|
|
press RET at the prompt), the link defaults to the most recently
|
|
|
stored link. As SPC triggers completion in the minibuffer, you need to
|
|
@@ -6355,11 +6358,14 @@ With a \\[universal-argument] prefix, prompts for a file to link to. The file na
|
|
|
be selected using completion. The path to the file will be relative to the
|
|
|
current directory if the file is in the current directory or a subdirectory.
|
|
|
Otherwise, the link will be the absolute path as completed in the minibuffer
|
|
|
-\(i.e. normally ~/path/to/file).
|
|
|
+\(i.e. normally ~/path/to/file). You can configure this behavior using the
|
|
|
+option `org-link-file-path-type'.
|
|
|
|
|
|
With two \\[universal-argument] prefixes, enforce an absolute path even if the file is in
|
|
|
-the current directory or below. With three \\[universal-argument] prefixes, negate the meaning
|
|
|
-of `org-keep-stored-link-after-insertion'.
|
|
|
+the current directory or below.
|
|
|
+
|
|
|
+With three \\[universal-argument] prefixes, negate the meaning of
|
|
|
+`org-keep-stored-link-after-insertion'.
|
|
|
|
|
|
If `org-make-link-description-function' is non-nil, this function will be
|
|
|
called with the link target, and the result will be the default
|
|
@@ -6391,7 +6397,7 @@ used as the link location instead of reading one interactively."
|
|
|
(setq remove (list (match-beginning 0) (match-end 0))
|
|
|
link (read-string "Link: "
|
|
|
(org-remove-angle-brackets (match-string 0)))))
|
|
|
- ((equal complete-file '(4))
|
|
|
+ ((member complete-file '((4) (16)))
|
|
|
;; Completing read for file names.
|
|
|
(setq file (read-file-name "File: "))
|
|
|
(let ((pwd (file-name-as-directory (expand-file-name ".")))
|
|
@@ -6470,7 +6476,8 @@ used as the link location instead of reading one interactively."
|
|
|
(origpath path)
|
|
|
(case-fold-search nil))
|
|
|
(cond
|
|
|
- ((eq org-link-file-path-type 'absolute)
|
|
|
+ ((or (eq org-link-file-path-type 'absolute)
|
|
|
+ (equal complete-file '(16)))
|
|
|
(setq path (abbreviate-file-name (expand-file-name path))))
|
|
|
((eq org-link-file-path-type 'noabbrev)
|
|
|
(setq path (expand-file-name path)))
|
|
@@ -6484,7 +6491,8 @@ used as the link location instead of reading one interactively."
|
|
|
(expand-file-name path))
|
|
|
;; We are linking a file with relative path name.
|
|
|
(setq path (substring (expand-file-name path)
|
|
|
- (match-end 0)))))))
|
|
|
+ (match-end 0)))
|
|
|
+ (setq path (abbreviate-file-name (expand-file-name path)))))))
|
|
|
(setq link (concat "file:" path))
|
|
|
(if (equal desc origpath)
|
|
|
(setq desc path))))
|