about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2022-08-17 00:24:06 +0530
committerArun Isaac2022-08-17 00:51:55 +0530
commite2694487648194865dcc51e5b5492bf3d6a6de99 (patch)
tree5ceed9eb73e5e8fae1c4829f27d3ad8c68e156b7
parent81cb2f254ad8b0e19088b51908d3469cec99fc3e (diff)
downloadennum-e2694487648194865dcc51e5b5492bf3d6a6de99.tar.gz
ennum-e2694487648194865dcc51e5b5492bf3d6a6de99.tar.lz
ennum-e2694487648194865dcc51e5b5492bf3d6a6de99.zip
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.
-rw-r--r--ennum.el32
1 files changed, 15 insertions, 17 deletions
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)