about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/glittershark/emacs.d/org-gcal.el48
1 files changed, 28 insertions, 20 deletions
diff --git a/users/glittershark/emacs.d/org-gcal.el b/users/glittershark/emacs.d/org-gcal.el
index d31e705269a4..183dfbd5a725 100644
--- a/users/glittershark/emacs.d/org-gcal.el
+++ b/users/glittershark/emacs.d/org-gcal.el
@@ -68,32 +68,40 @@
 
 (defun event->org-headline (event level)
   (cl-flet ((make-time
-                (key)
-                (when-let ((raw-time (->> event (alist-get key) (alist-get 'dateTime))))
-                  (format-time-string
-                   (org-time-stamp-format t)
-                   (parse-iso8601-time-string raw-time)))))
-       (if-let ((start-time (make-time 'start))
-                (end-time (make-time 'end)))
-           (s-format
-            "${headline} [[${htmlLink}][${summary}]] :event:
+             (key)
+             (when-let ((raw-time (->> event (alist-get key) (alist-get 'dateTime))))
+               (format-time-string
+                (org-time-stamp-format t)
+                (parse-iso8601-time-string raw-time)))))
+    (if-let ((start-time (make-time 'start))
+             (end-time (make-time 'end)))
+        (s-format
+         "${headline} [[${htmlLink}][${summary}]] :event:
 ${startTime}--${endTime}
 :PROPERTIES:
-:LOCATION: ${location}
+${location-prop}
 :EVENT: ${htmlLink}
 :END:
 
 ${description}"
-            (function
-             (lambda (k m)
-               (or (alist-get (intern k) m)
-                   (format "key not found: %s" k))))
-            (append
-             event
-             `((headline . ,(make-string level ?*))
-               (startTime . ,start-time)
-               (endTime . ,end-time))))
-         "")))
+         (function
+          (lambda (k m)
+            (or (alist-get (intern k) m)
+                (format "key not found: %s" k))))
+         (append
+          event
+          `((headline . ,(make-string level ?*))
+            (startTime . ,start-time)
+            (endTime . ,end-time)
+            (location-prop
+             . ,(if-let ((location (alist-get 'location event)))
+                    (s-lex-format ":LOCATION: ${location}")
+                  "")))))
+      "")))
+
+(comment
+ (alist-get 'foo nil)
+ )
 
 (defun write-events (events)
   (with-current-buffer (find-file-noselect events-file)