From 08534cef42568878d03ba116288b9ccbc43984b4 Mon Sep 17 00:00:00 2001 From: Rasmus Pank Roulund Date: Sun, 8 Mar 2015 10:10:37 +0000 Subject: [PATCH] lisp/gnus/gnus-notifications: Raise frame when clicking Read; Add mark as read --- lisp/gnus/ChangeLog | 7 +++++++ lisp/gnus/gnus-notifications.el | 21 ++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 2ee0c56c7f5..763267c3413 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,10 @@ +2015-03-08 Rasmus Pank Roulund + + * gnus-notifications.el (gnus-notifications-action): Raise window + frame. + (gnus-notifications-action): Allow mark as read. + (gnus-notifications-notify): Show uption to mark as read. + 2015-03-08 Adam Sjøgren * message.el (message-insert-formatted-citation-line): Change %F to diff --git a/lisp/gnus/gnus-notifications.el b/lisp/gnus/gnus-notifications.el index 2941cc46e4a..22dba3570a3 100644 --- a/lisp/gnus/gnus-notifications.el +++ b/lisp/gnus/gnus-notifications.el @@ -75,12 +75,19 @@ not get notifications." "Map notifications ids to messages.") (defun gnus-notifications-action (id key) - (when (string= key "read") - (let ((group-article (assoc id gnus-notifications-id-to-msg))) - (when group-article - (let ((group (cadr group-article)) - (article (nth 2 group-article))) - (gnus-fetch-group group (list article))))))) + (let ((group-article (assoc id gnus-notifications-id-to-msg))) + (when group-article + (let ((group (cadr group-article)) + (article (nth 2 group-article))) + (cond ((string= key "read") + (gnus-fetch-group group (list article)) + (when (and window-system (fboundp 'x-focus-frame)) (x-focus-frame (selected-frame)))) + ((string= key "mark-read") + (gnus-update-read-articles + group + (delq article (gnus-list-of-unread-articles group))) + ;; gnus-group-refresh-group + (gnus-group-update-group group))))))) (defun gnus-notifications-notify (from subject photo-file) "Send a notification about a new mail. @@ -90,7 +97,7 @@ Return a notification id if any, or t on success." 'notifications-notify :title from :body subject - :actions '("read" "Read") + :actions '("read" "Read" "mark-read" "Mark As Read") :on-action 'gnus-notifications-action :app-icon (gnus-funcall-no-warning 'image-search-load-path "gnus/gnus.png") -- 2.39.2