summaryrefslogtreecommitdiff
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
parent9e385d1bab645f741d60a59f8e0c85e312920c25 (diff)
downloadorg-mode-8e3b73d4dc352a66c3c4e9b4c8bd87c7fb938937.tar.gz
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.
-rw-r--r--lisp/org-id.el7
-rw-r--r--lisp/org.el3
2 files changed, 7 insertions, 3 deletions
diff --git a/lisp/org-id.el b/lisp/org-id.el
index d0fdeeb..1ff433b 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)))
diff --git a/lisp/org.el b/lisp/org.el
index bf79ee8..67c570b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13140,7 +13140,8 @@ part of the buffer."
(while (re-search-forward re nil t)
(when (if value (org-at-property-p)
(org-entry-get (point) property nil t))
- (throw 'exit (progn (org-back-to-heading t) (point)))))))))
+ (throw 'exit (progn (org-back-to-heading-or-point-min t)
+ (point)))))))))
(defun org-delete-property (property)
"In the current entry, delete PROPERTY."