[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] Org Element Api: :begin and :end are missing [9.7.13 (9.7.13-8
From: |
Dr. Arne Babenhauserheide |
Subject: |
Re: [BUG] Org Element Api: :begin and :end are missing [9.7.13 (9.7.13-8566bc @ /home/arne/.emacs.d/elpa/org-9.7.13/)] |
Date: |
Sun, 29 Dec 2024 14:10:18 +0100 |
Ihor Radchenko <yantar92@posteo.net> writes:
> "Dr. Arne Babenhauserheide" <arne_bab@web.de> writes:
>
>> In the Org Element API article describes that all elements share :begin
>> and :end:
>> https://orgmode.org/worg/dev/org-element-api.html#fnr.1
>
> Yes.
>
>> I don’t know where that changed, but I found that nowadays I have to use
>> `org-element-contents-begin' and `org-element-contents-begin' to get
>> the beginning and end of an element.
>
> Why? What's wrong with `org-element-begin' and `org-element-end'?
I didn’t know that I could also use these ☺
What’s wrong is only that I had to fix showing the first paragraph of
articles on my website with this change:¹
diff -r 67cc09b71bed -r a7c3f1ff95a6 index.org.in
--- a/index.org.in Fri Dec 27 01:31:27 2024 +0100
+++ b/index.org.in Sun Dec 29 11:50:14 2024 +0100
@@ -259,6 +259,6 @@
(when
(re-search-forward "^[ \t]*#\\+title:[ \t]*\\(.*\\)$" nil t)
(match-string 1))))
(org-elements
(org-element-parse-buffer))
- (begin (plist-get (car (cdr
(assoc 'paragraph (org-element-contents (nth 2 org-elements))))) ':begin))
- (end (plist-get (car (cdr
(assoc 'paragraph (org-element-contents (nth 2 org-elements))))) ':end))
+ (begin
(org-element-contents-begin (assoc 'paragraph (org-element-contents (nth 2
org-elements)))))
+ (end
(org-element-contents-end (assoc 'paragraph (org-element-contents (nth 2
org-elements)))))
(first-paragraph (if (and
begin end) (buffer-substring begin end) "")))
But https://orgmode.org/worg/dev/org-element-api.html#fnr.1 claims that
it should still be working.
¹ https://hg.sr.ht/~arnebab/draketo/browse/index.org.in?rev=tip#L222
Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de
signature.asc
Description: PGP signature