diff options
author | Max Nikulin <manikulin@gmail.com> | 2020-08-28 14:49:03 +0000 |
---|---|---|
committer | Bastien Guerry <bastien.guerry@data.gouv.fr> | 2020-09-04 17:59:21 +0200 |
commit | 20aa3507aff887fdd721b9276e9e919430885bf1 (patch) | |
tree | 92f4116923a7cb563769fb01a2503e6bef9c43a4 | |
parent | fd28d0ace6dcac8ef5ab3a9c68a85065d20ca23b (diff) | |
download | org-mode-20aa3507aff887fdd721b9276e9e919430885bf1.tar.gz |
ol.el: Fix store and insert link in indirect buffer
* lisp/ol.el (org-store-link): Store link with CUSTOM_ID anchor
in indirect buffer.
(org-insert-link): Do not add file name to search and CUSTOM_ID
links pointed to the same file when called from indirect buffer.
When a subtree was open in an indirect buffer, wrong argument
of `abbreviate-file-name' prevented storing link to a CUSTOM_ID
anchor. Internal link to a header line or to a CUSTOM_ID anchor
was created with file name instead of concise form.
This is a follow up of 784e5f1488.
TINYCHANGE
-rw-r--r-- | lisp/ol.el | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1699,8 +1699,10 @@ non-nil." (push (list link desc) org-stored-links) (message "Stored: %s" (or desc link)) (when custom-id - (setq link (concat "file:" (abbreviate-file-name - (buffer-file-name)) "::#" custom-id)) + (setq link (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer))) + "::#" custom-id)) (push (list link desc) org-stored-links))) (car org-stored-links))))) @@ -1841,13 +1843,14 @@ Use TAB to complete link prefixes, then RET for type-specific completion support ;; Check if we are linking to the current file with a search ;; option If yes, simplify the link by using only the search ;; option. - (when (and buffer-file-name + (when (and (buffer-file-name (buffer-base-buffer)) (let ((case-fold-search nil)) (string-match "\\`file:\\(.+?\\)::" link))) (let ((path (match-string-no-properties 1 link)) (search (substring-no-properties link (match-end 0)))) (save-match-data - (when (equal (file-truename buffer-file-name) (file-truename path)) + (when (equal (file-truename (buffer-file-name (buffer-base-buffer))) + (file-truename path)) ;; We are linking to this same file, with a search option (setq link search))))) |