From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathieu Poussin Newsgroups: gmane.emacs.help Subject: Re: ERC: Gets buffer/channel name in erc-text-matched-hook ? Date: Fri, 22 May 2015 11:34:41 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1432287309 15570 80.91.229.3 (22 May 2015 09:35:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 May 2015 09:35:09 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 22 11:35:02 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YvjM4-0005DT-IQ for geh-help-gnu-emacs@m.gmane.org; Fri, 22 May 2015 11:35:00 +0200 Original-Received: from localhost ([::1]:32978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvjM3-0001Aj-QZ for geh-help-gnu-emacs@m.gmane.org; Fri, 22 May 2015 05:34:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvjLq-0001Ab-MK for help-gnu-emacs@gnu.org; Fri, 22 May 2015 05:34:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvjLn-0002Ia-Df for help-gnu-emacs@gnu.org; Fri, 22 May 2015 05:34:46 -0400 Original-Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:32990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvjLn-0002IW-23 for help-gnu-emacs@gnu.org; Fri, 22 May 2015 05:34:43 -0400 Original-Received: by wicmx19 with SMTP id mx19so35282082wic.0 for ; Fri, 22 May 2015 02:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netyxia.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=oSMlDbzvExm8fbLba35Fi0xubtzUwrXoaYQLI7bQAHg=; b=F9Wj1XRMJhwbqIvobkHsNEYSMwsy42IHf0cSl8umDvF9ZWWqpI1tpCKVf612EPL5a0 4YEZCXzv5o/5VVWFUg17+fac/OSu5ksjYE+QPyYvH8fUyrHEBdHbd7V0yxcFPMSYg2gv IGu1kQJjtxvLT14UVZO8aXWrv068u1XLKgcfs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=oSMlDbzvExm8fbLba35Fi0xubtzUwrXoaYQLI7bQAHg=; b=kfK0FvYlQyO8eTw2YOrAdWug0qQShCRapdA1vcL3L0Iki+E74LrBTnu1bDbPeO2YDh d9ddnLAXpqOHwBS9HcqrbulAnpauJwNxg/ICnOK4rzmWW0UxP9pF+Y4o3U5vkNXk92R/ bFKnPojlprL5y9m/Vl/awJ/8siOcNcJ9BrBT5OjTcdGg5rrow7nWStLGPANVoy4JK++5 CS+KzYdtRrcuXMZUMXzsN+iqMyLPpCyY5aXfIbLIdhMtu1xwgcmlneSvC7sEBwLkpaS0 4XcLNlwa5CY4TKGVYKbEMfbP5Z01vH6MaIxhAI7oCl2q74XGhwZOUW2xWAAeKriBfMWL H8Zg== X-Gm-Message-State: ALoCoQmZZ+JtrUO6To8XC9GAlX+pc/63D31LTGgrcYigcViuaVRQQX9jgiOfe4EvcJoALsxdnv++ X-Received: by 10.180.24.65 with SMTP id s1mr5662127wif.66.1432287281950; Fri, 22 May 2015 02:34:41 -0700 (PDT) Original-Received: by 10.28.26.75 with HTTP; Fri, 22 May 2015 02:34:41 -0700 (PDT) X-Originating-IP: [91.208.181.161] In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::232 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104517 Archived-At: Looks like simply addons (buffer-name) in the concat is working :) On 21 May 2015 at 18:17, Mathieu Poussin 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. >