From 313f587783feb1c4b497451a2f3af370c0018ff9 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 1 Nov 2018 18:20:51 -0400 Subject: [PATCH] [emacs] assimilate slack and deps, clear up .gitignore, add secrets MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit hopefully the slack thing is temporary, as i don’t like using proprietary platforms. however, if i must, i’d *much* prefer using free software to access it, rather than executing proprietary JS. note: since i’ve decided to commit etc/secrets.el, it shall not contain any sensitive information itself, but rather how to obtain them. therefore, it must be byte-compiled; and the byte-compiled etc/secrets.elc must *never* be committed. --- .gitignore | 7 +----- .gitmodules | 27 ++++++++++++++++++++++ etc/secrets.el | 7 ++++++ init.org | 61 +++++++++++++++++++++++++++++++++++++++++++++++++- lib/alert | 1 + lib/circe | 1 + lib/deferred | 1 + lib/emojify | 1 + lib/ht | 1 + lib/oauth2 | 1 + lib/request | 1 + lib/slack | 1 + lib/websocket | 1 + 13 files changed, 104 insertions(+), 7 deletions(-) create mode 100644 etc/secrets.el create mode 160000 lib/alert create mode 160000 lib/circe create mode 160000 lib/deferred create mode 160000 lib/emojify create mode 160000 lib/ht create mode 160000 lib/oauth2 create mode 160000 lib/request create mode 160000 lib/slack create mode 160000 lib/websocket diff --git a/.gitignore b/.gitignore index 9c17b6d..6a2dcca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,5 @@ -# getmail oldmail file -oldmail-* +*.elc /early-init.el /init.el /var -/recentf -/smex-items -/auto-save-list -/network-security.data diff --git a/.gitmodules b/.gitmodules index 002346a..f20e6fc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,9 @@ [borg] pushDefault = aminb collective = emacsg +[submodule "alert"] + path = lib/alert + url = git@github.com:jwiegley/alert.git [submodule "all-the-icons"] path = lib/all-the-icons url = git@github.com:domtronn/all-the-icons.el.git @@ -22,6 +25,9 @@ [submodule "boxquote"] path = lib/boxquote url = git@github.com:davep/boxquote.el.git +[submodule "circe"] + path = lib/circe + url = git@github.com:jorgenschaefer/circe.git [submodule "closql"] path = lib/closql url = git@github.com:emacscollective/closql.git @@ -45,6 +51,9 @@ # that the submodule is dirty. so, let's ignore the untracked # files of dash's submodule ignore = untracked +[submodule "deferred"] + path = lib/deferred + url = git@github.com:kiwanami/emacs-deferred.git [submodule "diff-hl"] path = lib/diff-hl url = git@github.com:dgutov/diff-hl.git @@ -71,6 +80,9 @@ [submodule "emmet-mode"] path = lib/emmet-mode url = git@github.com:smihica/emmet-mode.git +[submodule "emojify"] + path = lib/emojify + url = git@github.com:iqbalansari/emacs-emojify.git [submodule "epkg"] path = lib/epkg url = git@github.com:emacscollective/epkg.git @@ -113,6 +125,9 @@ [submodule "hlint-refactor"] path = lib/hlint-refactor url = git@github.com:mpickering/hlint-refactor-mode.git +[submodule "ht"] + path = lib/ht + url = git@github.com:Wilfred/ht.el.git [submodule "hydra"] path = lib/hydra url = git@github.com:abo-abo/hydra.git @@ -181,6 +196,9 @@ # build-step = make # build-step = make sphinx-texinfo # build-step = borg-makeinfo +[submodule "oauth2"] + path = lib/oauth2 + url = git@github.com:emacsmirror/oauth2.git [submodule "org"] path = lib/org url = git@code.orgmode.org:bzg/org-mode.git @@ -231,6 +249,9 @@ [submodule "proof-site"] # Proof General path = lib/proof-site url = git@github.com:ProofGeneral/PG.git +[submodule "request"] + path = lib/request + url = git@github.com:tkf/emacs-request.git [submodule "s"] path = lib/s url = git@github.com:magnars/s.el.git @@ -243,6 +264,9 @@ [submodule "shut-up"] path = lib/shut-up url = git@github.com:cask/shut-up.git +[submodule "slack"] + path = lib/slack + url = git@github.com:yuya373/emacs-slack.git [submodule "smex"] # used by counsel-M-x path = lib/smex url = git@github.com:nonsequitur/smex.git @@ -267,6 +291,9 @@ [submodule "web-mode"] path = lib/web-mode url = git@github.com:fxbois/web-mode.git +[submodule "websocket"] + path = lib/websocket + url = git@github.com:ahyatt/emacs-websocket.git [submodule "which-key"] path = lib/which-key url = git@github.com:justbur/emacs-which-key.git diff --git a/etc/secrets.el b/etc/secrets.el new file mode 100644 index 0000000..9feeceb --- /dev/null +++ b/etc/secrets.el @@ -0,0 +1,7 @@ +(require 'auth-source) +(defvar uw-apv-client-id (eval-when-compile (plist-get (car (auth-source-search :host "uw-apv.slack.com" :max 1)) :client-id))) +(defvar uw-apv-client-secret (eval-when-compile (plist-get (car (auth-source-search :host "uw-apv.slack.com" :max 1)) :client-secret))) +(defvar uw-apv-token (eval-when-compile (plist-get (car (auth-source-search :host "uw-apv.slack.com" :max 1)) :token))) +(defvar watform-client-id (eval-when-compile (plist-get (car (auth-source-search :host "watform.slack.com" :max 1)) :client-id))) +(defvar watform-client-secret (eval-when-compile (plist-get (car (auth-source-search :host "watform.slack.com" :max 1)) :client-secret))) +(defvar watform-token (eval-when-compile (plist-get (car (auth-source-search :host "watform.slack.com" :max 1)) :token))) diff --git a/init.org b/init.org index 9a0e1dd..d64925d 100644 --- a/init.org +++ b/init.org @@ -324,6 +324,12 @@ it it's own file. While at it, treat themes as safe. (setf custom-safe-themes t)) #+end_src +** Secrets file + +#+begin_src emacs-lisp +(load (no-littering-expand-etc-file-name "secrets")) +#+end_src + ** Better =$PATH= handling Let's use [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] to make Emacs use the =$PATH= as set up @@ -642,7 +648,7 @@ Enable =winner-mode=. #+begin_src emacs-lisp (bind-keys ("C-c b k" . kill-this-buffer) - ("C-c s s" . save-buffer) + ;; ("C-c s s" . save-buffer) ("C-c b s" . save-buffer) ("C-c S" . save-buffer) ("C-c o" . other-window) @@ -1642,6 +1648,59 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. :hook (text-mode . typo-mode)) #+end_src +** slack + +Hopefully temporary. + +#+begin_src emacs-lisp +(use-package slack + :commands (slack-start) + :init + (eval-when-compile ; silence the byte-compiler + (defvar url-http-data nil) + (defvar url-http-extra-headers nil) + (defvar url-http-method nil) + (defvar url-callback-function nil) + (defvar url-callback-arguments nil) + (defvar oauth--token-data nil)) + (setq slack-buffer-emojify t + slack-prefer-current-team t) + :config + (slack-register-team + :name "uw-apv" + :default t + :client-id uw-apv-client-id + :client-secret uw-apv-client-secret + :token uw-apv-token + :subscribed-channels '(general) + :full-and-display-names t) + (slack-register-team + :name "watform" + :default nil + :client-id watform-client-id + :client-secret watform-client-secret + :token watform-token + :subscribed-channels '(general) + :full-and-display-names t); + :bind + (("C-c s s" . slack-start) + ("C-c s u" . slack-select-unread-rooms) + ("C-c s b" . slack-select-rooms) + ("C-c s t" . slack-change-current-team) + ("C-c s c" . slack-ws-close) + :map slack-mode-map + ("C-c e" . slack-message-edit) + ("C-c k" . slack-message-delete) + ("C-c C-k" . slack-channel-leave) + ("@" . slack-message-embed-mention) + ("#" . slack-message-embed-channel))); + +(use-package alert + :commands (alert) + :init + (setq alert-default-style 'notifier)) +#+end_src + * Email #+begin_src emacs-lisp diff --git a/lib/alert b/lib/alert new file mode 160000 index 0000000..9f329be --- /dev/null +++ b/lib/alert @@ -0,0 +1 @@ +Subproject commit 9f329be87820474925f29b52a1131084c8ea95b9 diff --git a/lib/circe b/lib/circe new file mode 160000 index 0000000..fedfa7e --- /dev/null +++ b/lib/circe @@ -0,0 +1 @@ +Subproject commit fedfa7eb8516a53fa70b6a1f4fce4b5ab66ea91f diff --git a/lib/deferred b/lib/deferred new file mode 160000 index 0000000..2239671 --- /dev/null +++ b/lib/deferred @@ -0,0 +1 @@ +Subproject commit 2239671d94b38d92e9b28d4e12fd79814cfb9c16 diff --git a/lib/emojify b/lib/emojify new file mode 160000 index 0000000..38ae28d --- /dev/null +++ b/lib/emojify @@ -0,0 +1 @@ +Subproject commit 38ae28d95b58e9fb86a3495a2dda3e5de254c4fc diff --git a/lib/ht b/lib/ht new file mode 160000 index 0000000..5a665d0 --- /dev/null +++ b/lib/ht @@ -0,0 +1 @@ +Subproject commit 5a665d00dc8fda77bad2a43277d8809c23e46ab8 diff --git a/lib/oauth2 b/lib/oauth2 new file mode 160000 index 0000000..1d352b3 --- /dev/null +++ b/lib/oauth2 @@ -0,0 +1 @@ +Subproject commit 1d352b3dcd186d93bce7baf26818967c022187e4 diff --git a/lib/request b/lib/request new file mode 160000 index 0000000..a3d080e --- /dev/null +++ b/lib/request @@ -0,0 +1 @@ +Subproject commit a3d080e57eb8be606fbf39d1baff94e1b16e1fb8 diff --git a/lib/slack b/lib/slack new file mode 160000 index 0000000..792604d --- /dev/null +++ b/lib/slack @@ -0,0 +1 @@ +Subproject commit 792604db287de2a986177d90f086f5d51aa5b403 diff --git a/lib/websocket b/lib/websocket new file mode 160000 index 0000000..0d96ba2 --- /dev/null +++ b/lib/websocket @@ -0,0 +1 @@ +Subproject commit 0d96ba2ff5a25c6cd6c66f417cc9b5f38a4308ba -- 2.20.1