Paste number 1864: notify me via a GNOME message box when someone wants to contact me

Paste number 1864: notify me via a GNOME message box when someone wants to contact me
Pasted by: bigmike160
4 years, 5 months ago
#emacs
Paste contents:
Raw Source | XML | Display As
;;; Notify me when a keyword is matched (someone wants to reach me)
;;; Modify erc-keywords to contain the various permutations of your
;;; nick

(defvar my-notify-message "%s is calling your name!")

(defun my-erc-text-matched-stuff (match-type nick message)
  (interactive)
  (when (eq match-type 'keyword)
    (shell-command
     ;; escape (') characters by turning them into ('"'"'), which
     ;; works for all shells i have tried so far
     (concat "zenity --info --text '"
             (replace-regexp-in-string
              "'" "'\"'\"'"
              (format my-notify-message nick)
)

             "'"
)
)
)
)

(add-hook 'erc-text-matched-hook 'my-erc-text-matched-stuff)

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.