Merge branch 'maint'

This commit is contained in:
Bastien 2021-05-06 14:40:38 +02:00
commit eb3de47d25
1 changed files with 12 additions and 5 deletions

View File

@ -1598,9 +1598,8 @@ non-nil."
((and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode)) ((and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode))
(org-with-limited-levels (org-with-limited-levels
(setq custom-id (org-entry-get nil "CUSTOM_ID")) (cond
(cond ;; Store a link using the target at point.
;; Store a link using the target at point
((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1) ((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1)
(setq cpltxt (setq cpltxt
(concat "file:" (concat "file:"
@ -1608,6 +1607,15 @@ non-nil."
(buffer-file-name (buffer-base-buffer))) (buffer-file-name (buffer-base-buffer)))
"::" (match-string 1)) "::" (match-string 1))
link cpltxt)) link cpltxt))
;; Store a link using the CUSTOM_ID property.
((setq custom-id (org-entry-get nil "CUSTOM_ID"))
(setq cpltxt
(concat "file:"
(abbreviate-file-name
(buffer-file-name (buffer-base-buffer)))
"::#" custom-id)
link cpltxt))
;; Store a link using (and perhaps creating) the ID property.
((and (featurep 'org-id) ((and (featurep 'org-id)
(or (eq org-id-link-to-org-use-id t) (or (eq org-id-link-to-org-use-id t)
(and interactive? (and interactive?
@ -1616,14 +1624,13 @@ non-nil."
'create-if-interactive-and-no-custom-id) 'create-if-interactive-and-no-custom-id)
(not custom-id)))) (not custom-id))))
(and org-id-link-to-org-use-id (org-entry-get nil "ID")))) (and org-id-link-to-org-use-id (org-entry-get nil "ID"))))
;; Store a link using the ID at point
(setq link (condition-case nil (setq link (condition-case nil
(prog1 (org-id-store-link) (prog1 (org-id-store-link)
(setq desc (or (plist-get org-store-link-plist (setq desc (or (plist-get org-store-link-plist
:description) :description)
""))) "")))
(error (error
;; Probably before first headline, link only to file ;; Probably before first headline, link only to file.
(concat "file:" (concat "file:"
(abbreviate-file-name (abbreviate-file-name
(buffer-file-name (buffer-base-buffer)))))))) (buffer-file-name (buffer-base-buffer))))))))