From e2694487648194865dcc51e5b5492bf3d6a6de99 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 17 Aug 2022 00:24:06 +0530 Subject: Do not pattern match link objects, use the org API. * ennum.el (ennum--read-post): Do not pattern match link objects. Use the org API instead. --- ennum.el | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'ennum.el') diff --git a/ennum.el b/ennum.el index c0556d2..691018a 100644 --- a/ennum.el +++ b/ennum.el @@ -263,23 +263,21 @@ the current state of all its variables." (let* ((tree (org-element-parse-buffer)) (links (org-element-map tree 'link (lambda (link) - (pcase link - (`(link ,properties . ,_) - (let ((link-type (org-element-property :type link)) - (path (org-element-property :path link))) - (pcase link-type - ("post" - (ennum-make-post-link - :path path - :target-title (if (org-element-contents link) - 'not-required 'required))) - ("video" - (ennum-make-video-link - :path path - :poster (ennum-video-poster path))) - (_ (ennum-make-link - :type (intern link-type) - :path path)))))))))) + (let ((link-type (org-element-property :type link)) + (path (org-element-property :path link))) + (pcase link-type + ("post" + (ennum-make-post-link + :path path + :target-title (if (org-element-contents link) + 'not-required 'required))) + ("video" + (ennum-make-video-link + :path path + :poster (ennum-video-poster path))) + (_ (ennum-make-link + :type (intern link-type) + :path path)))))))) (ennum-make-post :filename filename :slug (file-name-base filename) -- cgit v1.2.3