all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: john muhl <jm@pub.pink>
Cc: 73538@debbugs.gnu.org
Subject: bug#73538: [PATCH] Add notifications support to 'mpc'
Date: Fri, 04 Oct 2024 09:42:37 -0400	[thread overview]
Message-ID: <jwv34lcroqc.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87y134y111.fsf@pub.pink> (john muhl's message of "Thu, 03 Oct 2024 22:55:54 -0500")

>>> This adds support for displaying a notification when the song changes.
>> Oh, wow!  A patch for `mpc.el`!  Thanks!
> I hope you won’t mind a few more.

🙂

>>> +  (when-let (((string= "play" (alist-get 'state mpc-status)))
>>> +             (title (or (alist-get 'Title mpc-status) "Unknown Title"))
>>> +             (body (or (alist-get 'Artist mpc-status)
>>> +                       (alist-get 'AlbumArtist mpc-status)
>>> +                       "Unknown Artist"))
>>
>> Comment: I think it would make sense to use `mpc-format` here with
>> Custom vars to specify what goes in the title and body.
>
> What do you think the custom vars should look like?
> Would it be a FORMAT-SPEC like “%{title} %5{duration}” or something else?

I don't have a strong opinion on what the default format should look like.

> How would it handle the case where you want to try different tags like
> “use Artist or AlbumArtist”?

Ah... Hmm... good point.  We don't support that currently in
`mpc-format`.  Maybe we should add support for this (and take the
opportunity to actually document the % thingies understood by `mpc-format`).

Currently, the main format is `%WIDTH{NAME-POST}` where `-POST` is
optional, and it means to use the empty string if NAME is absent or
else use the concatenation of the content of NAME with the string POST.
Currently `-POST` is used only for `%{Disc--}`.

Maybe we should simply extend that to something like `%{NAME1|NAME2|...-POST}`?

Not sure whether it's worth adding support for a "default string", nor
what format we could use for that.  Maybe simply make it so that if
there's a | then the last element is not a tag name but a literal string
to use, so we could use:

    %{Artist|AlbumArtist|Unknown Artist}

Of course we could combine the two into something like
`%{NAME-POST+DEFAULT}` where DEFAULT would be recursively parsed as
a format string so we could do

    %{Artist+%{AlbumArtist+Unknown Artist}}

but I think this is getting too fancy for my taste (at that point, an
S-exp based format would start looking pretty attractive).


        Stefan






  reply	other threads:[~2024-10-04 13:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-28 22:48 bug#73538: [PATCH] Add notifications support to 'mpc' john muhl
2024-10-03 14:57 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-04  3:55   ` john muhl
2024-10-04 13:42     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-10-12  1:39   ` john muhl
2024-10-12 14:43     ` john muhl
2024-10-13 12:11     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-14  4:04       ` john muhl
2024-10-14 10:53         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-14 14:56           ` John Wiegley
2024-10-15 10:48             ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-14 13:08       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-17 16:43     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-18  0:26       ` john muhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv34lcroqc.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73538@debbugs.gnu.org \
    --cc=jm@pub.pink \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.