Skip to content

Instantly share code, notes, and snippets.

@psachin
Last active February 23, 2018 07:01
Show Gist options
  • Save psachin/f07c0741d0de4f2cf914eebbd45bddfc to your computer and use it in GitHub Desktop.
Save psachin/f07c0741d0de4f2cf914eebbd45bddfc to your computer and use it in GitHub Desktop.
Show channel name in ERC notification
diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el
index 84db0f58e46d..2978f6362279 100644
--- a/lisp/erc/erc-desktop-notifications.el
+++ b/lisp/erc/erc-desktop-notifications.el
@@ -52,11 +52,18 @@
:group 'erc-notifications
:type '(choice (const :tag "Session bus" :session) string))
+(defcustom erc-notifications-show-channel nil
+ "Show channel name 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment