我在emacs 24中使用ERC并在.emacs
中使用以下代码。 erc-global-notify
功能改编自http://www.emacswiki.org/emacs/ErcPageMe。不幸的是,当带有erc窗口的emacs被最小化时,我不会从dbus获得任何通知。这有什么问题?
(require 'erc-match)
(erc-match-mode t)
(setq erc-keywords '("c++" "python" "emacs" "i")
erc-pals '("ij" "yy" "xx"))
(require 'notifications)
(defun erc-global-notify (match-type nick message)
"Notify when someone sends a message that matches a regexp in `erc-keywords'."
(when (and (eq match-type 'keyword)
;; I don't want to see anything from the erc server
(null (string-match "^[sS]erver" nick))
;; or bots
(null (string-match "\\(bot\\|serv\\)!" nick)))
(notifications-notify
:title nick
:body message
:urgency 'normal)))
(add-hook 'erc-text-matched-hook 'erc-global-notify)