all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mathieu Poussin <mathieu.poussin@netyxia.net>
To: help-gnu-emacs@gnu.org
Subject: Re: ERC: Gets buffer/channel name in erc-text-matched-hook ?
Date: Fri, 22 May 2015 11:34:41 +0200	[thread overview]
Message-ID: <CALgt2ADCj=486pz287-Y=fTt5WGTsrtPsyF0YL+GC5XZA8u9ow@mail.gmail.com> (raw)
In-Reply-To: <CALgt2ADWcSsh0SYe_LTBgNeZvuoXX7q0TtwNgk4Lm6TCNAzJsA@mail.gmail.com>

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.
>


      reply	other threads:[~2015-05-22  9:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 16:17 ERC: Gets buffer/channel name in erc-text-matched-hook ? Mathieu Poussin
2015-05-22  9:34 ` Mathieu Poussin [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALgt2ADCj=486pz287-Y=fTt5WGTsrtPsyF0YL+GC5XZA8u9ow@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.