summaryrefslogtreecommitdiff
path: root/lisp/org-id.el
diff options
context:
space:
mode:
authorGustav Wikström <gustav@whil.se>2020-04-05 17:36:01 +0200
committerGustav Wikström <gustav@whil.se>2020-04-10 10:04:12 +0200
commit8e3b73d4dc352a66c3c4e9b4c8bd87c7fb938937 (patch)
tree651c32468adbd390b67a8fddd2e5fad52dcf6c99 /lisp/org-id.el
parent9e385d1bab645f741d60a59f8e0c85e312920c25 (diff)
Allow storing and following ID links before first heading
* lisp/org.el (org-find-property): Make org-find-property work correctly also before first heading. * lisp/org-id.el (org-id-store-link): Make it possible to store ID links also before first heading.
Diffstat (limited to 'lisp/org-id.el')
-rw-r--r--lisp/org-id.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/org-id.el b/lisp/org-id.el
index d0fdeeb1b..1ff433bd8 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -665,8 +665,11 @@ optional argument MARKERP, return the position as a new marker."
(let* ((link (concat "id:" (org-id-get-create)))
(case-fold-search nil)
(desc (save-excursion
- (org-back-to-heading t)
- (or (and (looking-at org-complex-heading-regexp)
+ (org-back-to-heading-or-point-min t)
+ (or (and (org-before-first-heading-p)
+ (file-name-nondirectory
+ (buffer-file-name (buffer-base-buffer))))
+ (and (looking-at org-complex-heading-regexp)
(if (match-end 4)
(match-string 4)
(match-string 0)))