about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-16T15·18-0400
committerglittershark <grfn@gws.fyi>2020-07-16T15·20+0000
commita87de918af175cbd93f9b69ec20f5d403457b9d1 (patch)
treef53abdf954e88c48daa0571391cee974542cb357
parent14e9e161c9303337d9e935cfd84f3cc644d99e5b (diff)
fix(gs/emacs): Prevent accidentally sending :q r/1316
If I try to send a message containing :q to ERC, just drop it.

Change-Id: I563044f0b837e2dbf4d5db94f9e906196ca91b49
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1211
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
-rw-r--r--users/glittershark/emacs.d/irc.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/users/glittershark/emacs.d/irc.el b/users/glittershark/emacs.d/irc.el
index 1b634dec78f4..866c7d556530 100644
--- a/users/glittershark/emacs.d/irc.el
+++ b/users/glittershark/emacs.d/irc.el
@@ -106,7 +106,11 @@ If the buffer is currently not visible, makes it sticky."
 
 (add-hook 'erc-connect-pre-hook 'my-erc-define-alerts)
 
-(advice-add #'erc-user-input :filter-return #'s-trim)
+(defun fix-irc-message (msg)
+  (let ((msg (s-trim msg)))
+    (if (string-equal msg ":q") "" msg)))
+
+(advice-add #'erc-user-input :filter-return #'fix-irc-message)
 
 (comment
  (my-erc-define-alerts)