From: Mathieu Poussin <mathieu.poussin@netyxia.net>
To: help-gnu-emacs@gnu.org
Subject: ERC: Gets buffer/channel name in erc-text-matched-hook ?
Date: Thu, 21 May 2015 18:17:58 +0200 [thread overview]
Message-ID: <CALgt2ADWcSsh0SYe_LTBgNeZvuoXX7q0TtwNgk4Lm6TCNAzJsA@mail.gmail.com> (raw)
Hello,
I wrote a simple system that send me a notification using pushover and
shows the revelant line in emacs.
Currently I get the nick and message, I would like to include the buffer
name / channel name in the notification message, but I don't know how can I
do this.
Here is my code :
(defcustom pushover-token nil
"pushover application token")
(defcustom pushover-user-key nil
"pushover user-key")
(defun pushover-notify (title msg)
(let ((url-request-method "POST")
(url-request-data (concat "token=" pushover-token
"&user=" pushover-user-key
"&title=" title
"&message=" msg)))
(url-retrieve "https://api.pushover.net/1/messages.json"
'pushover-kill-url-buffer)))
(defun pushover-kill-url-buffer (status)
"Kill the buffer returned by `url-retrieve'."
(kill-buffer (current-buffer)))
;; Notify my when someone mentions my nick.
(defun erc-global-notify (matched-type nick msg)
(interactive)
(when (eq matched-type 'current-nick)
(pushover-notify "ERC Notification" (concat "<" (car (split-string nick
"!")) "> " message))
(display-message-or-buffer (concat "<" (car (split-string nick "!")) ">
" message) "ERC Notifications")
))
(add-hook 'erc-text-matched-hook 'erc-global-notify)
How can I do this ?
Thank you.
next reply other threads:[~2015-05-21 16:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 16:17 Mathieu Poussin [this message]
2015-05-22 9:34 ` ERC: Gets buffer/channel name in erc-text-matched-hook ? Mathieu Poussin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALgt2ADWcSsh0SYe_LTBgNeZvuoXX7q0TtwNgk4Lm6TCNAzJsA@mail.gmail.com \
--to=mathieu.poussin@netyxia.net \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).