all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Show channel name in ERC notifications
@ 2018-03-09 15:33 Sachin Patil
  0 siblings, 0 replies; only message in thread
From: Sachin Patil @ 2018-03-09 15:33 UTC (permalink / raw)
  To: emacs-devel; +Cc: Sachin Patil

From: Sachin Patil <iclcoolster@gmail.com>

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 <iclcoolster@gmail.com>
---
 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 <psachin@redhat.com>
+
+	* 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  <kwhite@gnu.org>
 
 	* 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




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-09 15:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-09 15:33 [PATCH] Show channel name in ERC notifications Sachin Patil

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.