summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-01 07:12:27 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-01 07:12:27 -0400
commitabaf3f85f1ec69020266cda04f2365f9309d2b3c (patch)
tree14012afda0816a0e6760015d971ad5bfc13f0e32
parent0527ff60cff7702189ead331252084445a732934 (diff)
downloademacsconf-el-abaf3f85f1ec69020266cda04f2365f9309d2b3c.tar.xz
emacsconf-el-abaf3f85f1ec69020266cda04f2365f9309d2b3c.zip
improve go-to-talk
-rw-r--r--emacsconf.el41
1 files changed, 18 insertions, 23 deletions
diff --git a/emacsconf.el b/emacsconf.el
index 8ff487e..d95ce0d 100644
--- a/emacsconf.el
+++ b/emacsconf.el
@@ -156,30 +156,25 @@
(if (and search (string-match "\\(.*?\\) - " search))
(match-string 1 search)
search))
-(defun emacsconf-go-to-talk (&optional search)
+
+(defun emacsconf-go-to-talk (search)
(interactive (list (emacsconf-complete-talk)))
- (when search
- (setq search (emacsconf-get-slug-from-string search))
- (pop-to-buffer (find-file-noselect emacsconf-org-file))
- (let ((choices
- (save-excursion
- (delq nil
- (org-map-entries
- (lambda ()
- (cons
- (concat (org-entry-get (point) "SLUG") " - "
- (org-entry-get (point) "ITEM") " - "
- (org-entry-get (point) "NAME") " - "
- (org-entry-get (point) "EMAIL"))
- (point)))
- "SLUG={.}")))))
- (goto-char
- (if search
- (or (org-find-property "SLUG" search)
- (cdr (seq-find (lambda (s) (string-match search (car s))) choices)))
- (assoc-default (completing-read "Find: " choices)
- choices)))
- (org-reveal))))
+ (pop-to-buffer (find-file-noselect emacsconf-org-file))
+ (if (emacsconf-get-slug-from-string search)
+ (goto-char (org-find-property "SLUG" (emacsconf-get-slug-from-string search)))
+ (catch 'found
+ (org-map-entries
+ (lambda ()
+ (when (string-match search
+ (cons
+ (concat (org-entry-get (point) "SLUG") " - "
+ (org-entry-get (point) "ITEM") " - "
+ (org-entry-get (point) "NAME") " - "
+ (org-entry-get (point) "EMAIL"))
+ (point)))
+ (throw 'found)))
+ "SLUG={.}")))
+ (org-reveal))
(defmacro emacsconf-for-each-talk (&rest body)
(declare (indent 0) (debug t))