Maybe you're familiar with this IRC log samples.
15:54 [rgc] xb 15:54 [rgc] ooops, C-fail 12:02 [xyz] ls 12:02 [xyz] oops 00:21 [foo] cd 00:22 [foo] wrong buffer :/
To avoid that, some time ago I wrote some elisp to make erc-buffers read-only, but I just came up with a better solution:
(defun rgrau-erc-oops (txt) (when (member txt '("ls" "xb" "cd")) (setq erc-send-this nil))) (add-to-list 'erc-send-pre-hook 'rgrau-erc-oops)
It's too simple to make an erc module out of that(isn't it?), so I just put it in this blog entry.
2 comentarios:
My take on this:
(autoload 'eshell-command-to-value "eshell" nil)
(require 'em-alias)
(defun osener-erc-oops (txt)
(let ((output (eshell-command-to-value
(eshell/which (car (split-string txt))))))
(if (not (string= (substring output 0 10) "which: no "))
(setq erc-send-this nil))))
It uses eshell to look up the first word in PATH and will probably won't do what you meant to do for many common words.
Nice idea!
As you said, it might be too aggressive for this use case, but nevertheless, it's a nice way to interact with emacs.
Never thought of this kind of usage of eshell info.
wdyt of running shell commands if they are valid ones? shell and irc in the same buffer :)
Publicar un comentario