[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ERC: Gets buffer/channel name in erc-text-matched-hook ?
From: |
Mathieu Poussin |
Subject: |
Re: ERC: Gets buffer/channel name in erc-text-matched-hook ? |
Date: |
Fri, 22 May 2015 11:34:41 +0200 |
Looks like simply addons (buffer-name) in the concat is working :)
On 21 May 2015 at 18:17, Mathieu Poussin <mathieu.poussin@netyxia.net>
wrote:
> 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.
>