emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Show channel name in ERC notifications


From: Sachin Patil
Subject: [PATCH] Show channel name in ERC notifications
Date: Fri, 9 Mar 2018 21:03:56 +0530

From: Sachin Patil <address@hidden>

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 <address@hidden>
---
 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 <address@hidden>
+
+       * 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  <address@hidden>
 
        * 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]