about summary refs log tree commit diff
path: root/slack-snippets.el
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-03-26T19·03-0400
committerGriffin Smith <root@gws.fyi>2020-03-26T19·03-0400
commit35c76e7098111ed0d84aef1bd09f7025ce728b87 (patch)
treecea6f3893ffb3b983fdc42b4c38aa5c3c1a5fe36 /slack-snippets.el
parent23b179ad1d3d2e07c114741dffc50a8343f0a7a6 (diff)
Many updates, too many to count
commit messages are for code, not config

I guess
Diffstat (limited to 'slack-snippets.el')
-rw-r--r--slack-snippets.el35
1 files changed, 23 insertions, 12 deletions
diff --git a/slack-snippets.el b/slack-snippets.el
index 0c5175192107..9e05382ee6f0 100644
--- a/slack-snippets.el
+++ b/slack-snippets.el
@@ -192,10 +192,11 @@
      (ivy-read
       "Select channel: "
       ;; TODO want to potentially use purpose / topic stuff here
-      (-map (lambda (chan) (let ((label (assoc-default 'label (cdr chan)))
-                            (id (car chan)))
-                        (propertize label 'channel-id id)))
-            conversations)
+      (->> conversations
+           (-filter (lambda (c) (assoc-default 'label (cdr c))))
+           (-map (lambda (chan) (let ((label (assoc-default 'label (cdr chan)))
+                                 (id (car chan)))
+                             (propertize label 'channel-id id)))))
       :history 'slack/channel-history
       :action (lambda (selected)
                 (let ((channel-id (get-text-property 0 'channel-id selected)))
@@ -203,14 +204,24 @@
                   (message "Sent message to %s" selected))))))
   nil)
 
+(comment
+ (prompt-for-channel #'message)
+ (->> --convos
+      (-filter (lambda (c) (assoc-default 'label (cdr c))))
+      (-map (lambda (chan) (let ((label (assoc-default 'label (cdr chan)))
+                       (id (car chan)))
+                   (propertize label 'channel-id id)))))
+
+ (->> --convos (car) (cdr) (assoc-default 'label))
+ )
+
 (defun slack-send-code-snippet (&optional snippet-text)
-  (interactive)
-  (when-let ((snippet-text (or snippet-text
-                               (buffer-substring-no-properties (mark) (point)))))
-    (prompt-for-channel
-     (lambda (channel-id)
-       (slack/post-message
-        :text       (format "```\n%s```" snippet-text)
-        :channel-id channel-id)))))
+  (interactive
+   (list (buffer-substring-no-properties (mark) (point))))
+  (prompt-for-channel
+   (lambda (channel-id)
+     (slack/post-message
+      :text       (format "```\n%s```" snippet-text)
+      :channel-id channel-id))))
 
 (provide 'slack-snippets)