all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sachin Patil <iclcoolster@gmail.com>
To: emacs-devel@gnu.org
Cc: Sachin Patil <iclcoolster@gmail.com>
Subject: [PATCH] Show channel name in ERC notifications
Date: Fri,  9 Mar 2018 21:03:56 +0530	[thread overview]
Message-ID: <20180309153356.26302-1-psachin@redhat.com> (raw)

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




                 reply	other threads:[~2018-03-09 15:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180309153356.26302-1-psachin@redhat.com \
    --to=iclcoolster@gmail.com \
    --cc=emacs-devel@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.