[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 6dc4c72: Pop to originating erc buffer when clickin
From: |
Basil L. Contovounesios |
Subject: |
[Emacs-diffs] master 6dc4c72: Pop to originating erc buffer when clicking desktop notification |
Date: |
Fri, 12 Apr 2019 08:10:56 -0400 (EDT) |
branch: master
commit 6dc4c722af4e5f9f189631638700cd1fb3cc2edb
Author: Alex Murray <address@hidden>
Commit: Basil L. Contovounesios <address@hidden>
Pop to originating erc buffer when clicking desktop notification
* lisp/erc/erc-desktop-notifications.el: Switch to lexical-binding.
(erc-notifications-notify): Add a default action to the desktop
notification which pops to the buffer from which the notification
originated. (Bug#35141)
Copyright-paperwork-exempt: yes
---
lisp/erc/erc-desktop-notifications.el | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/lisp/erc/erc-desktop-notifications.el
b/lisp/erc/erc-desktop-notifications.el
index 56b9392..41b7420 100644
--- a/lisp/erc/erc-desktop-notifications.el
+++ b/lisp/erc/erc-desktop-notifications.el
@@ -1,4 +1,4 @@
-;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions
+;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions
-*- lexical-binding:t -*-
;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
@@ -59,13 +59,19 @@
This will replace the last notification sent with this function."
(dbus-ignore-errors
(setq erc-notifications-last-notification
- (notifications-notify :bus erc-notifications-bus
- :title (xml-escape-string nick)
- :body (xml-escape-string msg)
- :replaces-id
erc-notifications-last-notification
- :app-icon erc-notifications-icon))))
-
-(defun erc-notifications-PRIVMSG (proc parsed)
+ (let ((channel (current-buffer)))
+ (notifications-notify :bus erc-notifications-bus
+ :title (format "%s in %s"
+ (xml-escape-string nick)
+ channel)
+ :body (xml-escape-string msg)
+ :replaces-id
erc-notifications-last-notification
+ :app-icon erc-notifications-icon
+ :actions '("default" "Switch to buffer")
+ :on-action (lambda (&rest _)
+ (pop-to-buffer channel)))))))
+
+(defun erc-notifications-PRIVMSG (_proc parsed)
(let ((nick (car (erc-parse-user (erc-response.sender parsed))))
(target (car (erc-response.command-args parsed)))
(msg (erc-response.contents parsed)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 6dc4c72: Pop to originating erc buffer when clicking desktop notification,
Basil L. Contovounesios <=