summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-05 11:25:41 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-05 11:25:41 -0400
commit01dde684aa08c375c602661f259f46d559ecc3c2 (patch)
tree4cb8170b1e4fc0826be14f3d49bff5cc00b2d15a
parent4f695107c28d2d0ef069faba3061d736a72c3be9 (diff)
downloademacsconf-el-01dde684aa08c375c602661f259f46d559ecc3c2.tar.xz
emacsconf-el-01dde684aa08c375c602661f259f46d559ecc3c2.zip
Use org-entry-properties, might be more efficient
-rw-r--r--emacsconf.el35
1 files changed, 21 insertions, 14 deletions
diff --git a/emacsconf.el b/emacsconf.el
index ca0074b..6d0e5ae 100644
--- a/emacsconf.el
+++ b/emacsconf.el
@@ -158,6 +158,7 @@
(defun emacsconf-go-to-talk (search)
(interactive (list (emacsconf-complete-talk)))
(pop-to-buffer (find-file-noselect emacsconf-org-file))
+ (widen)
(if (emacsconf-get-slug-from-string search)
(goto-char (org-find-property "SLUG" (emacsconf-get-slug-from-string search)))
(catch 'found
@@ -170,7 +171,7 @@
(org-entry-get (point) "NAME") " - "
(org-entry-get (point) "EMAIL"))
(point)))
- (throw 'found)))
+ (throw 'found (point))))
"SLUG={.}")))
(org-reveal))
@@ -264,9 +265,10 @@
(org-timestamp-from-string
(org-entry-get (point) "SCHEDULED"))
t))))
- (mapcar
- (lambda (o) (list (car o) (org-entry-get (point) (cadr o))))
- field-props))))
+ (let* ((entry-props (org-entry-properties)))
+ (mapcar
+ (lambda (o) (list (car o) (assoc-default (cadr o) entry-props)))
+ field-props)))))
(defvar emacsconf-abstract-heading-regexp "abstract" "Regexp matching heading for talk abstract.")
@@ -379,16 +381,18 @@
(defun emacsconf-get-talk-info ()
(with-current-buffer (find-file-noselect emacsconf-org-file)
(save-excursion
- (let (results)
- (org-map-entries
- (lambda ()
- (when (or (org-entry-get (point) "TIME")
- (org-entry-get (point) "SLUG")
- (org-entry-get (point) "INCLUDE_IN_INFO"))
- (setq results
- (cons (emacsconf-get-talk-info-for-subtree)
- results)))))
- (nreverse results)))))
+ (save-restriction
+ (widen)
+ (let (results)
+ (org-map-entries
+ (lambda ()
+ (when (or (org-entry-get (point) "TIME")
+ (org-entry-get (point) "SLUG")
+ (org-entry-get (point) "INCLUDE_IN_INFO"))
+ (setq results
+ (cons (emacsconf-get-talk-info-for-subtree)
+ results)))))
+ (nreverse results))))))
(defun emacsconf-filter-talks (list)
"Return only talk info in LIST."
@@ -745,6 +749,9 @@ Include some other things, too, such as emacsconf-year, title, name, email, url,
(format-time-string "%H:%M" (plist-get (cadr info) :start-time)))))
(setq info (cdr info))))
+(defun emacsconf-active-talks (list)
+ "Remove CANCELLED talks from the list."
+ (seq-remove (lambda (o) (string= (plist-get o :status) "CANCELLED")) list))
(provide 'emacsconf)