3 ms·
This reminds me of something I thought about taking back up: A while back I wrote a number of Emacs scripts so that I could listen to Discord messages, as they
by julianeon 3y ago
This reminds me of something I thought about taking back up:
A while back I wrote a number of Emacs scripts so that I could listen to Discord messages, as they were streaming in basically, and then 'do Lisp' on them. For example, take the data that was streaming in and format it into a web page with a few links I could then investigate. I may get back into that.
- Zambyte 3y agoDo you still have that script? I would be interested in checking that out.
- scruple 3y agoI would, as well. Very neat idea and I'm in a Discord server where I'd get some utility from this sort of thing.
- julianeon 3y agoHere's the meat of it. First, you have an API or something which is piping text into your terminal - in this case, into eshell. Like for example let's say it's churning out lines like this: "big vote in berlin" https://cnn.com/vote-in-berlin https://cnn.com/vote-in-berlin I move my cursor over the text - remember, this is in emacs in eshell, I can modify the text there - and change the line to read: "big vote in berlin" (opyn https://cnn.com/vote-in-berlin https://cnn.com/vote-in-berlin) I move my cursor after the parenthesis and type C-x C-e. In my .emacs file I've defined this function: (defun opyn (arg) "Open local file in Firefox" (interactive) (let ((filearg (concat "file:///home/julian/Lang/Python/Something/" arg ".html"))) (shell-command (concat "chromium " filearg))) (message "opened file") ) Now it opens that file. But probably what you want to do is process the data in the text. So here's my emacs function for this (not the code for the data processing itself which was done in Python, separately - but see how you can go combine those together). (defun refresh (arg) "Rerun local file creation & open in Firefox" (interactive) (let ((filearg (concat "ruby project_refresh_emacs.rb " arg))) (shell-command filearg)) (message "refreshed file for you") ) That's pretty much it. Hope that helps.
- julianeon 3y agoI replied a couple comments below w a fuller explanation but here's the relevant emacs functions, code only. (defun opyn (arg) "Open local file in Firefox" (interactive) (let ((filearg (concat "file:///home/julian/Lang/Python/Something/" arg ".html"))) (shell-command (concat "chromium " filearg))) (message "opened file") ) (defun refresh (arg) "Rerun local file creation & open in Firefox" (interactive) (let ((filearg (concat "ruby project_refresh_emacs.rb " arg))) (shell-command filearg)) (message "refreshed file for you") )
- swah 3y agoIs this something using Bitlbee ? I remember doing fun stuff when I used IRC inside Emacs.
- julianeon 3y agoI wasn't using Bitbee, no. I just showed my code in the comment above fyi.