summaryrefslogtreecommitdiffstats
path: root/emacsconf.el
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-31 14:38:51 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-31 14:38:51 -0400
commit4b0c3d02c24132dec0af2d5f57a04f5209cddbd6 (patch)
treeca6b7a07a627aed417d3ba0d8352e1a3a2df5bba /emacsconf.el
parentdef383660144df547b7ce41cf4322222e39336d1 (diff)
downloademacsconf-el-4b0c3d02c24132dec0af2d5f57a04f5209cddbd6.tar.xz
emacsconf-el-4b0c3d02c24132dec0af2d5f57a04f5209cddbd6.zip
Push talk info and play talk on streaming server
Diffstat (limited to 'emacsconf.el')
-rw-r--r--emacsconf.el51
1 files changed, 50 insertions, 1 deletions
diff --git a/emacsconf.el b/emacsconf.el
index 007d653..72fb254 100644
--- a/emacsconf.el
+++ b/emacsconf.el
@@ -26,6 +26,10 @@
(defgroup emacsconf nil "EmacsConf" :group 'multimedia)
+(defcustom emacsconf-id "emacsconf"
+ "ID of conference"
+ :group 'emacsconf
+ :type 'string)
(defcustom emacsconf-name "EmacsConf"
"Name of conference"
:group 'emacsconf
@@ -521,7 +525,16 @@
emacsconf-get-talk-abstract-from-subtree
emacsconf-add-talk-status
emacsconf-add-timezone-conversions
+ emacsconf-add-speakers-with-pronouns
emacsconf-add-live-info))
+(defun emacsconf-add-speakers-with-pronouns (o)
+ (plist-put o :speakers-with-pronouns
+ (cond
+ ((null (plist-get o :pronouns)) (plist-get o :speakers))
+ ((string= (plist-get o :pronouns)) (plist-get o :speakers))
+ ((string-match "(" (plist-get o :pronouns)) (plist-get o :pronouns))
+ (t (format "%s (%s)" (plist-get o :speakers) (plist-get o :pronouns)))))
+ o)
(defun emacsconf-add-live-info (o)
(let ((track (emacsconf-get-track (plist-get o :track))))
@@ -921,6 +934,7 @@
(:name "Development" :color "skyblue" :id "dev" :channel "emacsconf-dev")))
(defun emacsconf-get-track (name)
+ (when (listp name) (setq name (plist-get name :track)))
(seq-find (lambda (track) (or (string= name (plist-get track :name))
(string= name (plist-get track :id))))
emacsconf-tracks))
@@ -933,6 +947,9 @@
info))
emacsconf-tracks))
+(defun emacsconf-complete-track ()
+ (emacsconf-get-track (completing-read "Track: " (mapcar (lambda (o) (plist-get o :name)) emacsconf-tracks))))
+
(defun emacsconf-by-day (info)
(seq-group-by (lambda (o)
(format-time-string "%Y-%m-%d" (plist-get o :start-time) emacsconf-timezone))
@@ -1022,7 +1039,7 @@ Filter by TRACK if given. Use INFO as the list of talks."
(seq-group-by (lambda (o) (plist-get o :speakers))
(or info (emacsconf-active-talks (emacsconf-filter-talks (emacsconf-get-talk-info))))))))
-(defun emacsconf-surround (before text after alternative)
+(defun emacsconf-surround (before text after &optional alternative)
"Concat BEFORE, TEXT, and AFTER if TEXT is specified, or return ALTERNATIVE."
(if (and text (not (string= text "")))
(concat (or before "") text (or after ""))
@@ -1078,5 +1095,37 @@ Filter by TRACK if given. Use INFO as the list of talks."
(recenter)
(undo-boundary))))
+(defun emacsconf-add-org-after-todo-state-change-hook ()
+ "Add FUNC to `org-after-todo-stage-change-hook'."
+ (interactive)
+ (with-current-buffer (find-buffer-visiting emacsconf-org-file)
+ (add-hook 'org-after-todo-state-change-hook #'emacsconf-org-after-todo-state-change nil t)))
+
+(defun emacsconf-remove-org-after-todo-state-change-hook ()
+ "Remove FUNC from `org-after-todo-stage-change-hook'."
+ (interactive)
+ (with-current-buffer (find-buffer-visiting emacsconf-org-file)
+ (remove-hook 'org-after-todo-state-change-hook
+ #'emacsconf-org-after-todo-state-change t)))
+
+(defvar emacsconf-todo-hooks
+ '(
+ emacsconf-stream-play-talk-org-after-todo-state-change ;; play the talk
+ ;; emacsconf-erc-org-after-todo-state-change ;; announce via ERC
+ ;; emacsconf-publish-backstage-org-after-todo-state-change ;; update the backstage index
+ emacsconf-stream-update-talk-info-org-after-todo-state-change ;; write to the talk text
+ )
+ "Functions to run when the todo state changes.")
+
+(defun emacsconf-org-after-todo-state-change ()
+ "Run all the hooks in `emacsconf-todo-hooks'."
+ (run-hooks 'emacsconf-todo-hooks))
+
+(defun emacsconf-broadcast (message)
+ (interactive "MMessage: ")
+ (when (not (string= (or message "") ""))
+ (erc-cmd-BROADCAST message))
+ (emacsconf-stream-broadcast message))
+
(provide 'emacsconf)
;;; emacsconf.el ends here