From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Sachin Patil Newsgroups: gmane.emacs.devel Subject: [PATCH] Show channel name in ERC notifications Date: Fri, 9 Mar 2018 21:03:56 +0530 Message-ID: <20180309153356.26302-1-psachin@redhat.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1520609550 14581 195.159.176.226 (9 Mar 2018 15:32:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 9 Mar 2018 15:32:30 +0000 (UTC) Cc: Sachin Patil To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 09 16:32:26 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euK0Q-0003g0-Ds for ged-emacs-devel@m.gmane.org; Fri, 09 Mar 2018 16:32:26 +0100 Original-Received: from localhost ([::1]:45989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euK2R-0003ux-P9 for ged-emacs-devel@m.gmane.org; Fri, 09 Mar 2018 10:34:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euK21-0003jo-J3 for emacs-devel@gnu.org; Fri, 09 Mar 2018 10:34:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1euK1y-0006R1-E7 for emacs-devel@gnu.org; Fri, 09 Mar 2018 10:34:05 -0500 Original-Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:40259) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1euK1y-0006QH-80 for emacs-devel@gnu.org; Fri, 09 Mar 2018 10:34:02 -0500 Original-Received: by mail-pf0-x241.google.com with SMTP id x1so1409799pfh.7 for ; Fri, 09 Mar 2018 07:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ACYSJCosT2qunB9uo20LSZvAA5SGWFquWyBYQBqqjvE=; b=ohgu0daZUSbCTcgs12eQ0fr6BNONNVs+4vDNMVMSHeYFmiE69m+jKWCTL+KfczAuX4 M6XwMAdQzAEX91FijAVn5QOZLgamukz7Lq5577ixRr6ayDA49AXuaxDqc2Mc4bw39rBG sXWvGAt18+lB1iBuQlgXA5JDdGDA42pOOOf48CCudmqXV7LdViqeQrXWh7M6+sIsq57R 0aOTemXwoLqMd1ZH76cpRogbU3i4l/kbnWIq5y8makElFsUvQCTo4gxgyylaYV1+24oi 9rpDbEGhYr+sawP7WXexJ+MqMPZrIt2RdXW6e+mbDr+QO529OOKBfjJm4hhXsjryhp/v x99w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ACYSJCosT2qunB9uo20LSZvAA5SGWFquWyBYQBqqjvE=; b=Ad8I/N27K2WlGy2XsVIdTwj76fw1jTugfnABLAveMdU3S+tdM23ke523xfe7FlmCnT oJgflAtTEoKQ+KcetMagOtJIFTt/tbJyCLJCgKg9ILR9+0x71G8a16CxX0sElmsbjHPI LBPRY1IV2QgAViXu2vLUaXd0RDIgKityTRW4a9WF/71mqrvtF5z64ame7nsxye7YOwOs duXShUefFDNHju19z0qrVLa/k3yOXanUCjRv835wYEUQF9b3Sh4WLTeOB/lm0zB8X5QA 9jvDbZh0N/e6g/YJ0fLF1HQgjSWRy2+OVGWJo7cyaUXo6CknLpQmv6pBslVPoFCDGcD5 KZyQ== X-Gm-Message-State: APf1xPBUK3A73oI89QK6BzvR6nJUpoXxcyOM4guvlIW1O+ByyQibn0oM jiDUQVBwsZrb5F+0IZdPLgdQryAS X-Google-Smtp-Source: AG47ELscNAxnjqRa80toG22DRcpYozJp46iYjBNaNl1Pp6XhSIyKrLF5D8r6sZJFseB7pBGDin6iJQ== X-Received: by 10.101.93.73 with SMTP id e9mr24980784pgt.264.1520609640750; Fri, 09 Mar 2018 07:34:00 -0800 (PST) Original-Received: from nubia.redhat.com ([103.51.232.2]) by smtp.gmail.com with ESMTPSA id i1sm3975170pfi.116.2018.03.09.07.33.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Mar 2018 07:34:00 -0800 (PST) X-Google-Original-From: Sachin Patil X-Mailer: git-send-email 2.14.3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:223542 Archived-At: From: Sachin Patil Currently ERC notification don't display channel name which makes it difficult to find from which channel the message arrived. This fix enables displaying channel name is ERC notification when `erc-notification-show-channel` is set to non-nil. The idea is based on email thread[1] by Alberto Donato. [1] https://lists.gnu.org/archive/html/erc-discuss/2017-08/msg00000.html Signed-off-by: Sachin Patil --- lisp/erc/ChangeLog.2 | 8 ++++++++ lisp/erc/erc-desktop-notifications.el | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/lisp/erc/ChangeLog.2 b/lisp/erc/ChangeLog.2 index 5fc4135c439b..55a3f3a3405e 100644 --- a/lisp/erc/ChangeLog.2 +++ b/lisp/erc/ChangeLog.2 @@ -1,3 +1,11 @@ +2018-03-09 Sachin Patil + + * erc-desktop-notifications.el (erc-notifications-notify): + Show channel name in ERC notification. A new varialble + `erc-notification-show-channel`(nil) when set to non-nil + displays channel name along with IRC nick who sent the + message. + 2015-11-07 Kelvin White * erc-pcomplete.el (pcomplete-erc-nicks): Fix bug for tab complete diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el index 84db0f58e46d..f2df8d74c609 100644 --- a/lisp/erc/erc-desktop-notifications.el +++ b/lisp/erc/erc-desktop-notifications.el @@ -52,11 +52,19 @@ :group 'erc-notifications :type '(choice (const :tag "Session bus" :session) string)) +(defcustom erc-notifications-show-channel nil + "Show channel name in notification. +When non-nil displays channel name along with nick in notification." + :group 'erc-notifications + :type 'boolean) + (defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors (defun erc-notifications-notify (nick msg) "Notify that NICK send some MSG. This will replace the last notification sent with this function." + (if erc-notifications-show-channel + (setq nick (format "%s (%s)" nick (buffer-name)))) (dbus-ignore-errors (setq erc-notifications-last-notification (notifications-notify :bus erc-notifications-bus -- 2.14.3