Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* [patches] mark as read with gnus notification
@ 2015-03-07 17:21 Rasmus
  2015-03-07 22:01 ` Adam Sjøgren
  2015-03-07 22:30 ` Adam Sjøgren
  0 siblings, 2 replies; 6+ messages in thread
From: Rasmus @ 2015-03-07 17:21 UTC (permalink / raw)
  To: info-gnus-english

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

Hi,

Two patches to gnus-notification that should apply against master.  I'm
sending them here since apparently gmane.emacs.gnus.general is down or
something.  I hope somebody will apply them nonetheless.

1. Raise frame when clicking read.
2. Allow to mark as read from notification, e.g. for notification ("your
   order has shipped")

My paperwork is sorted out.

—Rasmus

-- 
Slowly unravels in a ball of yarn and the devil collects it

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnus-notifications-Raise-frame-when-clicking-Read.patch --]
[-- Type: text/x-diff, Size: 1411 bytes --]

From b567a21d3039be1f1c82f35057543440ba074760 Mon Sep 17 00:00:00 2001
From: rasmus <x200s@pank.eu>
Date: Sat, 7 Mar 2015 18:10:03 +0100
Subject: [PATCH 1/2] gnus-notifications: Raise frame when clicking Read

* gnus-notifications.el (gnus-notifications-action): Raise window
  frame.
---
 lisp/ChangeLog             | 5 +++++
 lisp/gnus-notifications.el | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2047481..b6526b7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-07  Rasmus Pank Roulund  <rasmus@pank.eu>
+
+	* gnus-notifications.el (gnus-notifications-action): Raise window
+	frame.
+
 2015-02-26  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part):
diff --git a/lisp/gnus-notifications.el b/lisp/gnus-notifications.el
index 2941cc4..1ed344e 100644
--- a/lisp/gnus-notifications.el
+++ b/lisp/gnus-notifications.el
@@ -80,7 +80,8 @@ not get notifications."
       (when group-article
         (let ((group (cadr group-article))
               (article (nth 2 group-article)))
-          (gnus-fetch-group group (list article)))))))
+          (gnus-fetch-group group (list article))
+          (when (window-system) (x-focus-frame (selected-frame))))))))
 
 (defun gnus-notifications-notify (from subject photo-file)
   "Send a notification about a new mail.
-- 
2.3.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnus-notification.el-Add-mark-as-read.patch --]
[-- Type: text/x-diff, Size: 2610 bytes --]

From f73b285a33d40cd217bc45861d9308f831ffd0c3 Mon Sep 17 00:00:00 2001
From: rasmus <x200s@pank.eu>
Date: Sat, 7 Mar 2015 18:12:41 +0100
Subject: [PATCH 2/2] gnus-notification.el: Add mark as read

* gnus-notifications.el (gnus-notifications-action): Allow mark as read.
  (gnus-notifications-notify): Show uption to mark as read.
---
 lisp/ChangeLog             |  2 ++
 lisp/gnus-notifications.el | 22 ++++++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b6526b7..072c6fc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,8 @@
 
 	* 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-02-26  Katsumi Yamaoka  <yamaoka@jpl.org>
 
diff --git a/lisp/gnus-notifications.el b/lisp/gnus-notifications.el
index 1ed344e..7f8fd9e 100644
--- a/lisp/gnus-notifications.el
+++ b/lisp/gnus-notifications.el
@@ -75,13 +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))
-          (when (window-system) (x-focus-frame (selected-frame))))))))
+  (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 (window-system) (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.
@@ -91,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.3.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patches] mark as read with gnus notification
  2015-03-07 17:21 [patches] mark as read with gnus notification Rasmus
@ 2015-03-07 22:01 ` Adam Sjøgren
  2015-03-07 22:30 ` Adam Sjøgren
  1 sibling, 0 replies; 6+ messages in thread
From: Adam Sjøgren @ 2015-03-07 22:01 UTC (permalink / raw)
  To: info-gnus-english

Rasmus writes:

> Two patches to gnus-notification that should apply against master.  I'm
> sending them here since apparently gmane.emacs.gnus.general is down or
> something.  I hope somebody will apply them nonetheless.

> 1. Raise frame when clicking read.
> 2. Allow to mark as read from notification, e.g. for notification ("your
>    order has shipped")

> My paperwork is sorted out.

Pushed now; thanks!


  Best regards,

    Adam

-- 
 "It's not denial. I'm just very selective about the          Adam Sjøgren
  reality I accept."                                     asjo@koldfront.dk


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patches] mark as read with gnus notification
  2015-03-07 17:21 [patches] mark as read with gnus notification Rasmus
  2015-03-07 22:01 ` Adam Sjøgren
@ 2015-03-07 22:30 ` Adam Sjøgren
  2015-03-07 22:43   ` Adam Sjøgren
  1 sibling, 1 reply; 6+ messages in thread
From: Adam Sjøgren @ 2015-03-07 22:30 UTC (permalink / raw)
  To: info-gnus-english; +Cc: ding

Rasmus writes:

> +          (gnus-fetch-group group (list article))
> +          (when (window-system) (x-focus-frame (selected-frame))))))))

This does not work in XEmacs:

  While compiling the end of the data in file /var/lib/buildbot/slaves/debian/build-xemacs21.5/build/lisp/gnus-notifications.el:
    !! error (("The following functions are not known to be defined: 
      window-system, x-focus-frame"))

   - http://www.randomsample.de:4456/builders/xemacs-21.5/builds/1397/steps/compile/logs/stdio

and:

  While compiling the end of the data in file /var/lib/buildbot/slaves/debian/build-xemacs21.4/build/lisp/gnus-notifications.el:
    !! error (("The following functions are not known to be defined: 
      window-system, x-focus-frame"))

   - http://www.randomsample.de:4456/builders/xemacs-21.4/builds/1391/steps/compile/logs/stdio


  Best regards,

    Adam

-- 
 "Du danser godt, men ude af takt"                            Adam Sjøgren
                                                         asjo@koldfront.dk


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patches] mark as read with gnus notification
  2015-03-07 22:30 ` Adam Sjøgren
@ 2015-03-07 22:43   ` Adam Sjøgren
  2015-03-08 20:58     ` Adam Sjøgren
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Sjøgren @ 2015-03-07 22:43 UTC (permalink / raw)
  To: info-gnus-english; +Cc: ding

Adam writes:

> Rasmus writes:

>> +          (when (window-system) (x-focus-frame (selected-frame))))))))

I think you can just change (window-system) to window-system, or maybe
(eq window-system 'x)?

Here is an example for XEmacs compability for x-focus-frame:

 * https://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00351.html

I am not sure what the best way to solve these things are.


  Best regards,

    Adam

-- 
 "I always liked songs with parentheses in the title."        Adam Sjøgren
                                                         asjo@koldfront.dk


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patches] mark as read with gnus notification
  2015-03-07 22:43   ` Adam Sjøgren
@ 2015-03-08 20:58     ` Adam Sjøgren
  2015-03-08 21:29       ` Rasmus
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Sjøgren @ 2015-03-08 20:58 UTC (permalink / raw)
  To: info-gnus-english; +Cc: ding

Adam writes:

> I am not sure what the best way to solve these things are.

Turns out that gnus-util.el already had a function for this, called
gnus-select-frame-set-input-focus - so that is the solution I have
pushed now.


  Best regards,

    Adam

-- 
 "If not actually disgruntled, he was far from being          Adam Sjøgren
  gruntled."                                             asjo@koldfront.dk


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patches] mark as read with gnus notification
  2015-03-08 20:58     ` Adam Sjøgren
@ 2015-03-08 21:29       ` Rasmus
  0 siblings, 0 replies; 6+ messages in thread
From: Rasmus @ 2015-03-08 21:29 UTC (permalink / raw)
  To: info-gnus-english; +Cc: ding

asjo@koldfront.dk (Adam Sjøgren) writes:

> Adam writes:
>
>> I am not sure what the best way to solve these things are.
>
> Turns out that gnus-util.el already had a function for this, called
> gnus-select-frame-set-input-focus - so that is the solution I have
> pushed now.

Thank you, Adam!  I did not even consider Gnus having a function for this,
but I'm also not surprised.

—Rasmus

-- 
Tack, ni svenska vakttorn. Med plutonium tvingar vi dansken på knä!


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-08 21:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-07 17:21 [patches] mark as read with gnus notification Rasmus
2015-03-07 22:01 ` Adam Sjøgren
2015-03-07 22:30 ` Adam Sjøgren
2015-03-07 22:43   ` Adam Sjøgren
2015-03-08 20:58     ` Adam Sjøgren
2015-03-08 21:29       ` Rasmus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).