From 82bd6c6cdaf04eccf8cab706aa6a2a7def5bf3c3 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sat, 10 Oct 2020 21:34:16 +0800 Subject: [PATCH] (fix): fix org-roam--extract-links (#1179) Co-authored-by: Boris Buliga Co-authored-by: Gustav --- CHANGELOG.md | 6 ++++++ org-roam.el | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1504d86..e2d39aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.2.3 (TBD) + +## Bugfixes + +- [#1074](https://github.com/org-roam/org-roam/issues/1074) fix `org-roam--extract-links` to handle content boundaries + ## 1.2.2 (06-10-2020) In this release we support fuzzy links of the form `[[roam:Title]]`, `[[roam:*Headline]]` and `[[roam:Title*Headline]]`. Completion for these fuzzy links is supported via `completion-at-point`. diff --git a/org-roam.el b/org-roam.el index cc2d573..8d29c09 100644 --- a/org-roam.el +++ b/org-roam.el @@ -586,14 +586,13 @@ it as FILE-PATH." (let* ((type (org-roam--collate-types (org-element-property :type link))) (path (org-element-property :path link)) (element (org-element-at-point)) - (begin (or (org-element-property :content-begin element) + (begin (or (org-element-property :contents-begin element) (org-element-property :begin element))) + (end (or (org-element-property :content-end element) + (org-element-property :end element))) (content (or (org-element-property :raw-value element) - (buffer-substring-no-properties - begin - (or (org-element-property :content-end element) - (org-element-property :end element))))) - (content (string-trim content)) + (when (and begin end) + (string-trim (buffer-substring-no-properties begin end))))) (properties (list :outline (org-roam--get-outline-path) :content content :point begin))