Skip to content

Commit 543a23a

Browse files
maxnikulinyantar92
authored andcommitted
Revert "lisp/ol.el: Fix bug when storing links"
This reverts commit b4b35fc. Avoid duplication of CUSTOM_ID links.
1 parent 2737128 commit 543a23a

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

lisp/ol.el

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,24 +1659,16 @@ non-nil."
16591659

16601660
((and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode))
16611661
(org-with-limited-levels
1662-
(cond
1663-
;; Store a link using the target at point.
1662+
(setq custom-id (org-entry-get nil "CUSTOM_ID"))
1663+
(cond
1664+
;; Store a link using the target at point
16641665
((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1)
16651666
(setq cpltxt
16661667
(concat "file:"
16671668
(abbreviate-file-name
16681669
(buffer-file-name (buffer-base-buffer)))
16691670
"::" (match-string 1))
16701671
link cpltxt))
1671-
;; Store a link using the CUSTOM_ID property.
1672-
((setq custom-id (org-entry-get nil "CUSTOM_ID"))
1673-
(setq cpltxt
1674-
(concat "file:"
1675-
(abbreviate-file-name
1676-
(buffer-file-name (buffer-base-buffer)))
1677-
"::#" custom-id)
1678-
link cpltxt))
1679-
;; Store a link using (and perhaps creating) the ID property.
16801672
((and (featurep 'org-id)
16811673
(or (eq org-id-link-to-org-use-id t)
16821674
(and interactive?
@@ -1685,13 +1677,14 @@ non-nil."
16851677
'create-if-interactive-and-no-custom-id)
16861678
(not custom-id))))
16871679
(and org-id-link-to-org-use-id (org-entry-get nil "ID"))))
1680+
;; Store a link using the ID at point
16881681
(setq link (condition-case nil
16891682
(prog1 (org-id-store-link)
16901683
(setq desc (or (plist-get org-store-link-plist
16911684
:description)
16921685
"")))
16931686
(error
1694-
;; Probably before first headline, link only to file.
1687+
;; Probably before first headline, link only to file
16951688
(concat "file:"
16961689
(abbreviate-file-name
16971690
(buffer-file-name (buffer-base-buffer))))))))

0 commit comments

Comments
 (0)