johnsu01 (johnsu01) wrote,

I've been trying to learn Emacs Lisp. Here's my first-sort of successful project. It sets up a hook in ERC to mail Instant Messages from my desktop to my mobile phone.

No, I'm not an IM junkie at all.  Just thought of this idea and decided to see if I could do it.

Suggestions on the code appreciated. I'm sure there is a superior way to mail things other than using the shell-command business.

(defun send-to-phone ()
 "Sends each #bitlbee message to my mobile phone in an email."
   (with-current-buffer "#bitlbee"
      (setq recent-message (buffer-substring-no-properties (point-min) (point-max)))
      (shell-command (concat "echo " (shell-quote-argument
            recent-message) "|" "mail -s bitlbeemessage"))))

(with-current-buffer "#bitlbee"
     (add-hook 'erc-insert-post-hook 'send-to-phone nil t))
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.