From a87de918af175cbd93f9b69ec20f5d403457b9d1 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 16 Jul 2020 11:18:46 -0400 Subject: fix(gs/emacs): Prevent accidentally sending :q 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 --- users/glittershark/emacs.d/irc.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'users') diff --git a/users/glittershark/emacs.d/irc.el b/users/glittershark/emacs.d/irc.el index 1b634dec78..866c7d5565 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) -- cgit 1.4.1