From aa90f6c2dd17a86be16ef459f72feedb1ad35611 Mon Sep 17 00:00:00 2001 From: Quang-Linh LE Date: Mon, 15 Feb 2021 09:42:26 +0100 Subject: [PATCH] Insert link with `org-store-link' This patch allows us to insert a link to the headline with configurable backend (org-id for example) instead of hardcoded `filename::*Heading` --- helm-org.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/helm-org.el b/helm-org.el index 527de0f..5eb5c85 100644 --- a/helm-org.el +++ b/helm-org.el @@ -374,12 +374,10 @@ nothing to CANDIDATES." (defun helm-org-insert-link-to-heading-at-marker (marker) "Insert link to heading at MARKER position." (with-current-buffer (marker-buffer marker) - (let ((heading-name (save-excursion (goto-char (marker-position marker)) - (nth 4 (org-heading-components)))) - (file-name (buffer-file-name))) + (let ((link (save-excursion (goto-char (marker-position marker)) + (org-store-link nil)))) (with-helm-current-buffer - (org-insert-link - file-name (concat "file:" file-name "::*" heading-name)))))) + (insert link))))) (defun helm-org-run-insert-link-to-heading-at-marker () "Run interactively `helm-org-insert-link-to-heading-at-marker'."