GNU bug report logs - #35141
Add a default action to erc-desktop-notifications to switch to the originating buffer

Previous Next

Package: emacs;

Reported by: Alex Murray <murray.alex <at> gmail.com>

Date: Thu, 4 Apr 2019 12:38:02 UTC

Severity: wishlist

Tags: patch

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35141 in the body.
You can then email your comments to 35141 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35141; Package emacs. (Thu, 04 Apr 2019 12:38:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex Murray <murray.alex <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 04 Apr 2019 12:38:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alex Murray <murray.alex <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Add a default action to erc-desktop-notifications to switch to the
 originating buffer
Date: Thu, 4 Apr 2019 17:02:24 +1030
[Message part 1 (text/plain, inline)]
Attached is a patch which converts erc-desktop-notifications.el to
lexical-binding and adds a default action to the generated notifications so
that when they are clicked we automatically switch to the originating
buffer.
[Message part 2 (text/html, inline)]
[0001-Switch-to-originating-erc-buffer-when-clicking-deskt.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35141; Package emacs. (Fri, 05 Apr 2019 02:14:01 GMT) Full text and rfc822 format available.

Message #8 received at 35141 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Alex Murray <murray.alex <at> gmail.com>
Cc: 35141 <at> debbugs.gnu.org
Subject: Re: bug#35141: Add a default action to erc-desktop-notifications to
 switch to the originating buffer
Date: Fri, 05 Apr 2019 03:13:02 +0100
Alex Murray <murray.alex <at> gmail.com> writes:

> Attached is a patch which converts erc-desktop-notifications.el to
> lexical-binding and adds a default action to the generated
> notifications so that when they are clicked we automatically switch to
> the originating buffer.

SGTM.

> From 52b63272eed8aaafcd931e833ad006dd425d6512 Mon Sep 17 00:00:00 2001
> From: Alex Murray <murray.alex <at> gmail.com>
> Date: Thu, 4 Apr 2019 16:49:48 +1030
> Subject: [PATCH] Switch to originating erc buffer when clicking desktop
>  notification
>
> * lisp/erc/erc-desktop-notifications.el: Switch to lexical-binding and
>   add a default action to the desktop notification which switches to
>   the buffer from which the notification originated. As such clicking
>   on the notification now automatically switches to that buffer.

Please mention the name of the function changed:

* lisp/erc/erc-desktop-notifications.el: Switch to lexical-binding.
(erc-notifications-notify): Add ...

Unless you have completed your copyright assignment for contributions to
Emacs, the commit message should also include:

Copyright-paperwork-exempt: yes

For more details, see the file CONTRIBUTE.

> diff --git a/ChangeLog.3 b/ChangeLog.3
> index 235c8bb180..3819d6b4fe 100644
> --- a/ChangeLog.3
> +++ b/ChangeLog.3
> @@ -1,3 +1,10 @@
> +2019-04-04  Alex Murray  <murray.alex <at> gmail.com>
> +
> +	* lisp/erc/erc-desktop-notifications.el: Use lexical-binding.
> +	(erc-notifications-notify): Add a default action to
> +	notifications which switches to the buffer from which the
> +	notification originated.
> +
>  2019-03-20  Eli Zaretskii  <eliz <at> gnu.org>
>  
>  	Improve indexing of the user manual

ChangeLog files are no longer maintained by hand, but rather generated
from Git commit messages.

> diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el
> index 56b93925ce..c1b812c119 100644
> --- a/lisp/erc/erc-desktop-notifications.el
> +++ b/lisp/erc/erc-desktop-notifications.el
> @@ -59,11 +59,17 @@
>  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))))
> +          (let ((channel (current-buffer)))
> +            (notifications-notify :bus erc-notifications-bus
> +                                  :title (format "%s in %s"
> +                                                 (xml-escape-string nick)
> +                                                 (buffer-name channel))

No need for buffer-name; you can pass buffers directly to "%s".

> +                                  :body (xml-escape-string msg)
> +                                  :replaces-id erc-notifications-last-notification
> +                                  :app-icon erc-notifications-icon
> +                                  :actions '("default" "Switch to buffer")
> +                                  :on-action #'(lambda (id action)
> +                                                 (switch-to-buffer channel)))))))

This should instead be something like the following:

  (lambda (&rest _)
    (pop-to-buffer channel))

In particular, lambdas don't need to be quoted with #', pop-to-buffer is
far better behaved than switch-to-buffer, and unused argument names
should either start with an underscore or be omitted.

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35141; Package emacs. (Fri, 05 Apr 2019 03:23:02 GMT) Full text and rfc822 format available.

Message #11 received at 35141 <at> debbugs.gnu.org (full text, mbox):

From: Alex Murray <murray.alex <at> gmail.com>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35141 <at> debbugs.gnu.org
Subject: Re: bug#35141: Add a default action to erc-desktop-notifications to
 switch to the originating buffer
Date: Fri, 5 Apr 2019 13:52:10 +1030
[Message part 1 (text/plain, inline)]
Hi Basil,

Thanks for the review - see attached for an updated version based on your
feedback.

Cheers,
Alex


On Fri, 5 Apr 2019 at 12:43, Basil L. Contovounesios <contovob <at> tcd.ie>
wrote:

> Alex Murray <murray.alex <at> gmail.com> writes:
>
> > Attached is a patch which converts erc-desktop-notifications.el to
> > lexical-binding and adds a default action to the generated
> > notifications so that when they are clicked we automatically switch to
> > the originating buffer.
>
> SGTM.
>
> > From 52b63272eed8aaafcd931e833ad006dd425d6512 Mon Sep 17 00:00:00 2001
> > From: Alex Murray <murray.alex <at> gmail.com>
> > Date: Thu, 4 Apr 2019 16:49:48 +1030
> > Subject: [PATCH] Switch to originating erc buffer when clicking desktop
> >  notification
> >
> > * lisp/erc/erc-desktop-notifications.el: Switch to lexical-binding and
> >   add a default action to the desktop notification which switches to
> >   the buffer from which the notification originated. As such clicking
> >   on the notification now automatically switches to that buffer.
>
> Please mention the name of the function changed:
>
> * lisp/erc/erc-desktop-notifications.el: Switch to lexical-binding.
> (erc-notifications-notify): Add ...
>
> Unless you have completed your copyright assignment for contributions to
> Emacs, the commit message should also include:
>
> Copyright-paperwork-exempt: yes
>
> For more details, see the file CONTRIBUTE.
>
> > diff --git a/ChangeLog.3 b/ChangeLog.3
> > index 235c8bb180..3819d6b4fe 100644
> > --- a/ChangeLog.3
> > +++ b/ChangeLog.3
> > @@ -1,3 +1,10 @@
> > +2019-04-04  Alex Murray  <murray.alex <at> gmail.com>
> > +
> > +     * lisp/erc/erc-desktop-notifications.el: Use lexical-binding.
> > +     (erc-notifications-notify): Add a default action to
> > +     notifications which switches to the buffer from which the
> > +     notification originated.
> > +
> >  2019-03-20  Eli Zaretskii  <eliz <at> gnu.org>
> >
> >       Improve indexing of the user manual
>
> ChangeLog files are no longer maintained by hand, but rather generated
> from Git commit messages.
>
> > diff --git a/lisp/erc/erc-desktop-notifications.el
> b/lisp/erc/erc-desktop-notifications.el
> > index 56b93925ce..c1b812c119 100644
> > --- a/lisp/erc/erc-desktop-notifications.el
> > +++ b/lisp/erc/erc-desktop-notifications.el
> > @@ -59,11 +59,17 @@
> >  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))))
> > +          (let ((channel (current-buffer)))
> > +            (notifications-notify :bus erc-notifications-bus
> > +                                  :title (format "%s in %s"
> > +                                                 (xml-escape-string
> nick)
> > +                                                 (buffer-name channel))
>
> No need for buffer-name; you can pass buffers directly to "%s".
>
> > +                                  :body (xml-escape-string msg)
> > +                                  :replaces-id
> erc-notifications-last-notification
> > +                                  :app-icon erc-notifications-icon
> > +                                  :actions '("default" "Switch to
> buffer")
> > +                                  :on-action #'(lambda (id action)
> > +                                                 (switch-to-buffer
> channel)))))))
>
> This should instead be something like the following:
>
>   (lambda (&rest _)
>     (pop-to-buffer channel))
>
> In particular, lambdas don't need to be quoted with #', pop-to-buffer is
> far better behaved than switch-to-buffer, and unused argument names
> should either start with an underscore or be omitted.
>
> Thanks,
>
> --
> Basil
>
[Message part 2 (text/html, inline)]
[0001-Switch-to-originating-erc-buffer-when-clicking-deskt.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35141; Package emacs. (Fri, 05 Apr 2019 11:23:02 GMT) Full text and rfc822 format available.

Message #14 received at 35141 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Alex Murray <murray.alex <at> gmail.com>
Cc: 35141 <at> debbugs.gnu.org
Subject: Re: bug#35141: Add a default action to erc-desktop-notifications to
 switch to the originating buffer
Date: Fri, 05 Apr 2019 12:22:41 +0100
Alex Murray <murray.alex <at> gmail.com> writes:

> Thanks for the review - see attached for an updated version based on your feedback.

I just tried byte-compiling the patched file and got the following
warning:

  ELC      erc/erc-desktop-notifications.elc
  In toplevel form:
  erc/erc-desktop-notifications.el:74:1:
  Warning: Unused lexical argument ‘proc’

Since this arises because of lexical-binding, could you please also add
an underscore to the name of the PROC argument in
erc-notifications-PRIVMSG?

Otherwise LGTM, but we'll have to wait a few days to give others a
chance to comment.

Thanks,

-- 
Basil




Severity set to 'wishlist' from 'normal' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 05 Apr 2019 11:37:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 05 Apr 2019 11:37:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35141; Package emacs. (Sat, 06 Apr 2019 09:54:01 GMT) Full text and rfc822 format available.

Message #21 received at 35141 <at> debbugs.gnu.org (full text, mbox):

From: Alex Murray <murray.alex <at> gmail.com>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35141 <at> debbugs.gnu.org
Subject: Re: bug#35141: Add a default action to erc-desktop-notifications to
 switch to the originating buffer
Date: Sat, 6 Apr 2019 20:22:38 +1030
[Message part 1 (text/plain, inline)]
Done - see attached. Thanks again for your help.

On Fri, 5 Apr 2019 at 21:52, Basil L. Contovounesios <contovob <at> tcd.ie>
wrote:

> Alex Murray <murray.alex <at> gmail.com> writes:
>
> > Thanks for the review - see attached for an updated version based on
> your feedback.
>
> I just tried byte-compiling the patched file and got the following
> warning:
>
>   ELC      erc/erc-desktop-notifications.elc
>   In toplevel form:
>   erc/erc-desktop-notifications.el:74:1:
>   Warning: Unused lexical argument ‘proc’
>
> Since this arises because of lexical-binding, could you please also add
> an underscore to the name of the PROC argument in
> erc-notifications-PRIVMSG?
>
> Otherwise LGTM, but we'll have to wait a few days to give others a
> chance to comment.
>
> Thanks,
>
> --
> Basil
>
[Message part 2 (text/html, inline)]
[0001-Switch-to-originating-erc-buffer-when-clicking-deskt.patch (text/x-patch, attachment)]

Reply sent to "Basil L. Contovounesios" <contovob <at> tcd.ie>:
You have taken responsibility. (Fri, 12 Apr 2019 12:17:02 GMT) Full text and rfc822 format available.

Notification sent to Alex Murray <murray.alex <at> gmail.com>:
bug acknowledged by developer. (Fri, 12 Apr 2019 12:17:02 GMT) Full text and rfc822 format available.

Message #26 received at 35141-done <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Alex Murray <murray.alex <at> gmail.com>
Cc: 35141-done <at> debbugs.gnu.org
Subject: Re: bug#35141: Add a default action to erc-desktop-notifications to
 switch to the originating buffer
Date: Fri, 12 Apr 2019 13:16:41 +0100
Alex Murray <murray.alex <at> gmail.com> writes:

> Done - see attached. Thanks again for your help.
>
> On Fri, 5 Apr 2019 at 21:52, Basil L. Contovounesios <contovob <at> tcd.ie> wrote:
>
>  Otherwise LGTM, but we'll have to wait a few days to give others a
>  chance to comment.

Thanks, pushed to master[1].  I made minor edits to the commit message
to follow CONTRIBUTE guidelines and to make it slightly more accurate
and less redundant.

[1: 6dc4c722af]: Pop to originating erc buffer when clicking desktop notification
  2019-04-12 13:08:28 +0100
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=6dc4c722af4e5f9f189631638700cd1fb3cc2edb

If you're interested in making further contributions, I would recommend
starting the copyright assignment process.  See CONTRIBUTE and (info
"(emacs) Copyright Assignment") for details.

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35141; Package emacs. (Sun, 14 Apr 2019 12:18:02 GMT) Full text and rfc822 format available.

Message #29 received at 35141-done <at> debbugs.gnu.org (full text, mbox):

From: Alex Murray <murray.alex <at> gmail.com>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35141-done <at> debbugs.gnu.org
Subject: Re: bug#35141: Add a default action to erc-desktop-notifications to
 switch to the originating buffer
Date: Sun, 14 Apr 2019 21:47:12 +0930
[Message part 1 (text/plain, inline)]
Thanks!

On Fri, 12 Apr 2019 at 21:46, Basil L. Contovounesios <contovob <at> tcd.ie>
wrote:

> Alex Murray <murray.alex <at> gmail.com> writes:
>
> > Done - see attached. Thanks again for your help.
> >
> > On Fri, 5 Apr 2019 at 21:52, Basil L. Contovounesios <contovob <at> tcd.ie>
> wrote:
> >
> >  Otherwise LGTM, but we'll have to wait a few days to give others a
> >  chance to comment.
>
> Thanks, pushed to master[1].  I made minor edits to the commit message
> to follow CONTRIBUTE guidelines and to make it slightly more accurate
> and less redundant.
>
> [1: 6dc4c722af]: Pop to originating erc buffer when clicking desktop
> notification
>   2019-04-12 13:08:28 +0100
>
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=6dc4c722af4e5f9f189631638700cd1fb3cc2edb
>
> If you're interested in making further contributions, I would recommend
> starting the copyright assignment process.  See CONTRIBUTE and (info
> "(emacs) Copyright Assignment") for details.
>
> Thanks,
>
> --
> Basil
>
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 May 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 40 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.