From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 28 18:49:01 2024 Received: (at submit) by debbugs.gnu.org; 28 Sep 2024 22:49:01 +0000 Received: from localhost ([127.0.0.1]:52473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sugFJ-0006y5-3c for submit@debbugs.gnu.org; Sat, 28 Sep 2024 18:49:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:52342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sugFH-0006xq-36 for submit@debbugs.gnu.org; Sat, 28 Sep 2024 18:49:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sugEm-0003xP-9y for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 18:48:28 -0400 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sugEk-00011G-8q for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 18:48:28 -0400 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 6DFF4114019F for ; Sat, 28 Sep 2024 18:48:23 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Sat, 28 Sep 2024 18:48:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1727563703; x=1727650103; bh=H1Fn39rLpZVoQC4W6mi5aMK9s8xPxyTn jEGZqRFnQ34=; b=Zbj5Mvh9Yn9TidzipPv31qgHjtxJZHE0WtQcEoVs4Irm5k5C uXZqjE8DdzKrOQhyi3YciSz5yvwAb2IQryVGVZo1sYxDaKOXCdRrF6oL7WDXQFg8 e2aIe8HGLRuzH7Qgmtcyw8iTzBf+L6wHAuIRRwAJ+4aojKCS62AOHqxq1kAkjYwA 4pswj7lvt6kZFjgV5NIi4qHVDACbg2qTnm3YN0f+r3uaFrmfgYHe9/qqxD4sMYRh DcodIPnpRQE/KjpdHqimMtOO/cANpvQvaXv0+XdsxrQnyZd5t2riJmW0VLtf3FSF 87ZASj3Cbbol1mb44uHaUqMyv4KwainVEGP2cw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1727563703; x=1727650103; bh=H1Fn39rLpZVoQC4W6mi5aMK9s8xPxyTnjEG ZqRFnQ34=; b=VTa4bsX6zlRPVsOl0wdZpMLx6hsIvZNfdguVFnYZe7nqHj85+Kq +U0mxvuAqfz8Qi/ukt1ygspMPl6f8JTMZpRf1er8v7rz1gPwwdCbMNhO+Z1zxhdM 4YAlTE6kqVEJXslYbfzHjlq/DheDHd6xDMif7768FSPkvN9gMNgJkQZSqldwsADK g9QdKJVohlittW1xLyoC5oOqtXmXCWRBvIFYdh7gDw0GVybAaFsh7QVU6s3Inx+o oDf/vTuvqbA8RWjMsZfTXKcWAgWUuyjUDHMknPqC/S3e4ecUanjAp7N+2DLavs7R QWh9DP+6pFjb95zDcYMq/Q/hqAPcFnrWIGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduvddgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkgggtsehmtderredttddtnecuhfhrohhmpehjohhhnhcumhhuhhhluceojhhmsehpuhgs rdhpihhnkheqnecuggftrfgrthhtvghrnhepfefhvdefuddtledvvddvjefhfedvfeelge fgieeuieeitddvvdfgieeuudegleejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepjhhmsehpuhgsrdhpihhnkhdpnhgspghrtghpthhtohepud dpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsghughdqghhnuhdqvghmrggtshes ghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 28 Sep 2024 18:48:22 -0400 (EDT) From: john muhl To: bug-gnu-emacs@gnu.org Subject: [PATCH] Add notifications support to 'mpc' X-Debbugs-Cc: Stefan Monnier Date: Sat, 28 Sep 2024 17:48:21 -0500 Message-ID: <87frpjtmx6.fsf@pub.pink> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.154; envelope-from=jm@pub.pink; helo=fhigh-a3-smtp.messagingengine.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) --=-=-= Content-Type: text/plain Tags: patch This adds support for displaying a notification when the song changes. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-notifications-support-to-mpc.patch >From eb495c851dafcf883b0c1cbcd22b2dedc074f226 Mon Sep 17 00:00:00 2001 From: john muhl Date: Sun, 15 Sep 2024 19:52:25 -0500 Subject: [PATCH] Add notifications support to 'mpc' * lisp/mpc.el (mpc-notifications): (mpc-notifications-function): New option. (mpc-notifications-id): New variable. (mpc-notifications-notify): (mpc-cover-image-find): (mpc-cover-image-p): New function. --- lisp/mpc.el | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/lisp/mpc.el b/lisp/mpc.el index 768c70c2e3a..30e295d4810 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -95,6 +95,8 @@ (require 'cl-lib) (require 'subr-x)) +(require 'notifications) + (defgroup mpc () "Client for the Music Player Daemon (mpd)." :prefix "mpc-" @@ -2766,6 +2768,83 @@ mpc-drag-n-drop (t (error "Unsupported drag'n'drop gesture")))))) +;;; Notifications ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(declare-function notifications-notify "notifications") +(declare-function w32-notification-notify "notifications") +(declare-function haiku-notifications-notify "notifications") +(declare-function android-notifications-notify "notifications") + +(defcustom mpc-notifications-function 'mpc-notifications-notify + "Function called to display notification." + :version "31.1" + :type 'function) + +(defcustom mpc-notifications nil + "Non-nil means to display notifications when the song changes." + :version "31.1" + :type 'boolean + :set (lambda (symbol value) + (if-let ((cb (cons 'file mpc-notifications-function)) + value) + (add-to-list 'mpc-status-callbacks cb) + (setq mpc-status-callbacks (delete cb mpc-status-callbacks))) + (set-default-toplevel-value symbol value))) + +(defvar mpc-notifications-id nil) + +(defun mpc-notifications-notify () + "Display a notification with information about the current song." + (interactive) + (mpc-status-refresh) + (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")) + (icon (or (mpc-cover-image-find (alist-get 'file mpc-status)) + notifications-application-icon))) + (pcase system-type + ("windows-nt" + (w32-notification-notify :title title :body body :icon icon)) + ("haiku" + (setq mpc-notifications-id + (haiku-notifications-notify :title title + :body body + :app-icon icon + :replaces-id mpc-notifications-id))) + ("android" + (setq mpc-notifications-id + (android-notifications-notify :title title + :body body + :icon icon + :replaces-id mpc-notifications-id)) + (android-notifications-notify :title title :body body :icon icon)) + (_ (when (notifications-get-server-information) + (setq mpc-notifications-id + (notifications-notify :title title + :body body + :app-icon icon + :replaces-id mpc-notifications-id))))))) + +(defun mpc-cover-image-find (file) + "Find cover image for FILE." + (and-let* ((default-directory mpc-mpd-music-directory) + (dir (file-name-directory file)) + (files (directory-files (mpc-file-local-copy dir))) + (cover (seq-find #'mpc-cover-image-p files)) + ((expand-file-name cover dir))))) + +(defun mpc-cover-image-p (file) + "Check if FILE is a cover image." + (let ((covers '(".folder.png" "folder.png" "cover.jpg" "folder.jpg"))) + (or (seq-find (lambda (cover) (string= file cover)) covers) + (and mpc-cover-image-re (string-match-p mpc-cover-image-re file))))) + +(when mpc-notifications + (add-to-list 'mpc-status-callbacks + (cons 'file mpc-notifications-function))) + ;;; Toplevel ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defcustom mpc-frame-alist '((name . "MPC") (tool-bar-lines . 1) -- 2.46.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 29 21:36:11 2024 Received: (at control) by debbugs.gnu.org; 30 Sep 2024 01:36:11 +0000 Received: from localhost ([127.0.0.1]:43453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sv5Kd-0007nv-4t for submit@debbugs.gnu.org; Sun, 29 Sep 2024 21:36:11 -0400 Received: from mail-ed1-f45.google.com ([209.85.208.45]:56817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sv5KJ-0007jT-8E for control@debbugs.gnu.org; Sun, 29 Sep 2024 21:35:53 -0400 Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5c5bca6603aso4477773a12.1 for ; Sun, 29 Sep 2024 18:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727660053; x=1728264853; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=rBzzwA4QopTdWcUpzXvCLXvhiXxqlWvnMDVPhikauk0=; b=lZCgnjaFmzY88clXEdciRuyXgufHqDx7/cEzzTgSnIniGb0262m5/ufxtf1o6m/GIj bQOAv4O9xPJ3pf3GLWxV1ipWjtb+7oBUf/yTyj4e60P7S1Q5NFgbxdihCE2VDwoH0fr4 gb4ImXbl8JSeP5tyRgdYY0QVthNg96r9+4+aWoX675Iavxf/5YyLuQt+CjwvwGSPq806 KH60YqeEG4XzKORfteJQhACl1h/QRMKKW9UOZ/L0Y+w1fcHm/My6yERk7G6hFU2T3aPg uVEXMKNFEx2MTKLzF8Y75vi2nv8D2J+GP9BvbAj4JbaT4imVVihCUm8V65my+p1C/hUt fQrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727660053; x=1728264853; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=rBzzwA4QopTdWcUpzXvCLXvhiXxqlWvnMDVPhikauk0=; b=Dg5CHn8bYg23al4u7ya6CQmXJGA6MQwt4/ZW9aH6LuZwgP+nl2kFNVYoQa3a2Nl6DI zHIOoqcSCrfDbNa/dq4J9X/tHMANWraIszeGrFei324TmSykfxs8sWYMkhIDTTwKKNB4 TeJq8CVa2gJStPfgLm0YIzDMGtKZ6NQdmksXE4o/NHP8cyabAd4wOexp/QXP8N+VI3Ix 3vjasoRzs+i3RjE43vk2UsxLqAReR1Cy9N4syx7HkQYcZnGVj8j5Zzv7RAsPHMKH62gv 61omVI2khguU8Jn+HE4hpMrZ1jrdUe9+ZGFNPkdwyOyqWofvJVVuik448pOA+7mTV6vJ 2D9A== X-Gm-Message-State: AOJu0YwnnQNROUoYy7f/ZT3TcIzqt0m23OnqXUgFD4ZJJ9yboCh2umfG HpBqoMaLpYClkahtVTKvgglf0iiWu3MoRwoBhTZVPzrHp3z8E2ubF+h7XfLOvHhnZEG+9pv7LbR HiLkZFkbM49sQt3+GYxkl17Xf3BtHBw== X-Google-Smtp-Source: AGHT+IHVFBq7F6Hu8A/AAbxaoSIc2aswe7QGRIASQqVeJmdPcXeIKymlgahFQbFnj2H7m+nrGIbT1Qjap99S83uOfZQ= X-Received: by 2002:a50:cc0d:0:b0:5c0:a8d0:8782 with SMTP id 4fb4d7f45d1cf-5c8825fb21cmr8329029a12.28.1727660053272; Sun, 29 Sep 2024 18:34:13 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 29 Sep 2024 18:34:13 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Sun, 29 Sep 2024 18:34:13 -0700 Message-ID: Subject: control message for bug #73538 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) severity 73538 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 03 10:57:47 2024 Received: (at 73538) by debbugs.gnu.org; 3 Oct 2024 14:57:48 +0000 Received: from localhost ([127.0.0.1]:33710 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swNH1-0000W8-Co for submit@debbugs.gnu.org; Thu, 03 Oct 2024 10:57:47 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10858) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swNGy-0000Vr-QR for 73538@debbugs.gnu.org; Thu, 03 Oct 2024 10:57:45 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AC61D100043; Thu, 3 Oct 2024 10:57:35 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1727967454; bh=qwvXYwGha4ZYnSOZzohVHoKXUMq5R61uaz2RdDOblzQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=DW0EhIPTVtjjf/e4+Y6MPQCWqAyjrn8prZeJNUS0p1F4fXx7NgPz4BaTWNaECJlYX S1TdKG7A/WXyhac0k3pIJd/lUuAGc2ng83OZAzFRC9FhatYH807KZ32P9UAUFlooaj NtMCgTqDvT+krE//iC3i6FgmOcgznSS+RmGib5l6iuPV36qO+tUOWufJQMkgzj9/XH 75sWqjSd1dhaCetm4xGPS2y3W0/Z6CeLjW1sPMKqs+rIN5Yu24YEtHtQQA//wZnB/0 RwqW9OS9BdWy82FsbQ3deqBQ+1eftJyfW8aWfF/XasSTvEG/dkivgtZOdhmqz8+Ydh PWByURZFng/Og== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D7B4010002E; Thu, 3 Oct 2024 10:57:34 -0400 (EDT) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AAC1B120175; Thu, 3 Oct 2024 10:57:34 -0400 (EDT) From: Stefan Monnier To: john muhl Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <87frpjtmx6.fsf@pub.pink> (john muhl's message of "Sat, 28 Sep 2024 17:48:21 -0500") Message-ID: References: <87frpjtmx6.fsf@pub.pink> Date: Thu, 03 Oct 2024 10:57:23 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.219 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73538 Cc: 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [ Sorry for the delay. ] > This adds support for displaying a notification when the song changes. Oh, wow! A patch for `mpc.el`! Thanks! Looks pretty good overall. I'm not familiar with the `notifications` library, OTOH, so I have a few questions, comments, and nitpicks below. > +(defcustom mpc-notifications-function 'mpc-notifications-notify > + "Function called to display notification." > + :version "31.1" > + :type 'function) Nitpick: I'd prefer it to use #' to quote `mpc-notifications-notify`. Nitpick: The docstring should describe how it's called (how many args are passed to it, what those args will be, and what it should return). Question: Is it worth making this a `defcustom`? I have a hard time imagining someone using the Customize UI to set this. > +(defcustom mpc-notifications nil > + "Non-nil means to display notifications when the song changes." > + :version "31.1" > + :type 'boolean > + :set (lambda (symbol value) > + (if-let ((cb (cons 'file mpc-notifications-function)) > + value) > + (add-to-list 'mpc-status-callbacks cb) > + (setq mpc-status-callbacks (delete cb mpc-status-callbacks))) > + (set-default-toplevel-value symbol value))) Comment: I'd assume that `file` changes are rare enough that it's OK to always have a callback in there regardless if notifications are enabled and instead test the value of `mpc-notifications` in that callback before calling `mpc-notifications-function`. > +(defvar mpc-notifications-id nil) Comment: AFAICT this is an internal var so it should use a "--". > +(defun mpc-notifications-notify () > + "Display a notification with information about the current song." > + (interactive) > + (mpc-status-refresh) Question: Why is it interactive? Question: Why does it need `mpc-status-refresh`? It seems odd to call `mpc-status-refresh` from an "mpc-status-callback" (i.e. a function called in response to an `mpc-status-refresh`). > + (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. > + (pcase system-type > + ("windows-nt" > + (w32-notification-notify :title title :body body :icon icon)) > + ("haiku" > + (setq mpc-notifications-id > + (haiku-notifications-notify :title title > + :body body > + :app-icon icon > + :replaces-id mpc-notifications-id))) > + ("android" > + (setq mpc-notifications-id > + (android-notifications-notify :title title > + :body body > + :icon icon > + :replaces-id mpc-notifications-id)) > + (android-notifications-notify :title title :body body :icon icon)) > + (_ (when (notifications-get-server-information) > + (setq mpc-notifications-id > + (notifications-notify :title title > + :body body > + :app-icon icon > + :replaces-id mpc-notifications-id))))))) Comment: Eww! Question: Don't we have a function in Emacs which knows which notification backend to use so we don't need to do this ugly dispatch dance here? > +(defun mpc-cover-image-find (file) > + "Find cover image for FILE." > + (and-let* ((default-directory mpc-mpd-music-directory) > + (dir (file-name-directory file)) > + (files (directory-files (mpc-file-local-copy dir))) > + (cover (seq-find #'mpc-cover-image-p files)) > + ((expand-file-name cover dir))))) > + > +(defun mpc-cover-image-p (file) > + "Check if FILE is a cover image." > + (let ((covers '(".folder.png" "folder.png" "cover.jpg" "folder.jpg"))) > + (or (seq-find (lambda (cover) (string= file cover)) covers) > + (and mpc-cover-image-re (string-match-p mpc-cover-image-re file))))) Comment: This should be consolidated with the `Cover` code in `mpc-format`. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 03 23:56:09 2024 Received: (at submit) by debbugs.gnu.org; 4 Oct 2024 03:56:09 +0000 Received: from localhost ([127.0.0.1]:34207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swZQG-0000TC-RY for submit@debbugs.gnu.org; Thu, 03 Oct 2024 23:56:09 -0400 Received: from lists.gnu.org ([209.51.188.17]:54234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swZQD-0000So-EL for submit@debbugs.gnu.org; Thu, 03 Oct 2024 23:56:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swZQA-0006vf-Bt for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 23:56:02 -0400 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swZQ7-0005qR-8b for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 23:56:01 -0400 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 41753138060C; Thu, 3 Oct 2024 23:55:56 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Thu, 03 Oct 2024 23:55:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1728014156; x=1728100556; bh=C/8TPwc9AFiPKZGJ1lfR3s1IaELtNqMN9Ff6efajTmg=; b= B16Pcn3+XIWa8e1sYZhab7odoDwxW7HBPiIIueM0yYSyrqd1YhMRquR+Z7X8bedI KYnp+a9br3PWKyP7TaUEb8Gnwf1oA9zT9uEqfQ7QGMbMEWNlW04tNjrVhDgCtnD/ jORZJD8Bl0UO4s3pvhNu+Kbhv9OCN1fbbwEBmSeKUneArUHpSGYlreUT6PV4AIa8 Ao16iFfvQyZMqUIK8/7cHjFKaer/Pfn2vd5g+1QGfvsKvVgFUT06GeGzx34j1ttz AKAQutd56YGuk+I5jd5jozJbVZrjLFSjAGCwKW0fARwd12B3i9W+41JflbDv2z1H Q0T25XnyW2cY0VLpLTG1Sg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728014156; x= 1728100556; bh=C/8TPwc9AFiPKZGJ1lfR3s1IaELtNqMN9Ff6efajTmg=; b=W rhQJ3zDTrVunrWV3GicWsMOjUIcm8RMiifnfpEN7fMMLdZzaK9wyeTD8mxyOiSzM taYYQb7D+UlG/FyVp0v81U5Be1uUKgcdwSqivTM23LkGWnGWZOOA35QhU5cOhw6u DHmRbsFcifuiiomxp/51A1xgpVHICkd2xaPwwTCa/yXEXJWeQ3YX3DKA6xXVcWR4 Qo8tkkGOsWJpbJ5T+GVBNHRQNTUP2bWlTHfCMqtW8ndEBp8iEf6TWj6omRLFsZjw SUIRwNbCsfIwTOzBKPoUvMIrguzfl7lmXJdUW3sSM/aLLe3ZVt6nP2B1NEGEm1bu wBnojdFGyHJNUOcGBNECQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvvddgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgfgsehtqhertddtreej necuhfhrohhmpehjohhhnhcumhhuhhhluceojhhmsehpuhgsrdhpihhnkheqnecuggftrf grthhtvghrnhepgeevhedvtdetvdekuddvtddthefhvdfggfdvgfeitdejudehhfffjedt vdevveeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epjhhmsehpuhgsrdhpihhnkhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepjeefheefkeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtph htthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrgdprhgtphhtthho pegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Oct 2024 23:55:55 -0400 (EDT) From: john muhl To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: (Stefan Monnier via's message of "Thu, 03 Oct 2024 10:57:23 -0400") References: <87frpjtmx6.fsf@pub.pink> User-Agent: mu4e 1.12.1; emacs 31.0.50 Date: Thu, 03 Oct 2024 22:55:54 -0500 Message-ID: <87y134y111.fsf@pub.pink> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=103.168.172.145; envelope-from=jm@pub.pink; helo=fout-a2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit Cc: Stefan Monnier , 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text= editors" writes: > [ Sorry for the delay. ] No sweat. It=E2=80=99s plenty fast by my reckoning. >> This adds support for displaying a notification when the song changes. > > Oh, wow! A patch for `mpc.el`! Thanks! I hope you won=E2=80=99t mind a few more. > Looks pretty good overall. I'm not familiar with the `notifications` > library, OTOH, so I have a few questions, comments, and nitpicks below. Thanks for looking. I=E2=80=99ll address the rest in a follow up patch but in the meantime could you elaborate on this point: >> + (when-let (((string=3D "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 =E2=80=9C%{title} %5{duration}=E2=80=9D or something else?= How would it handle the case where you want to try different tags like =E2=80=9Cuse Artist or AlbumArtist=E2=80=9D? If you don=E2=80=99t have something specific in mind I=E2=80=99ll see what = I can come up but any ideas would be helpful. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 04 09:42:51 2024 Received: (at 73538) by debbugs.gnu.org; 4 Oct 2024 13:42:51 +0000 Received: from localhost ([127.0.0.1]:34711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swia2-0006bV-L4 for submit@debbugs.gnu.org; Fri, 04 Oct 2024 09:42:51 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swia1-0006bG-8P for 73538@debbugs.gnu.org; Fri, 04 Oct 2024 09:42:49 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BBC77807C9; Fri, 4 Oct 2024 09:42:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1728049358; bh=9Wx+1EcmBB68AqUMPuIV3y/ffqBrD5vtqquI/sshKJI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=cZ1Dy/AMF043ZZCdvT2DbP2Vp6n5HMalhcz+/5CwnjusTLHluoCQjeb5BS8Ppd8c9 KETRbw8z1tvZP8xaMtRmUU6aGSRbx4jKgr6PZoqhOG7Ja7yuXU0nfoypeevDEMz001 HbsP1wjo31trTZcF/75UkZmZdWQ54xXnPVnbxUUiOjNCtWF/1EiAsN8fDLPxC8yXdI p7PN8/ATEcwcY5I/7cMnKorD0FHZ7wzHj82iRYaXqb4eACU5JX4PzLtac1MtSs85hO dveXflm/K2t7ljzgbGM3TkJScfiz80qrpiMKydc4SvHK+Me3+uJfXAiQr+5xaeTMzj l183wq3aW6dbA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D47C080244; Fri, 4 Oct 2024 09:42:38 -0400 (EDT) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B8AD2120829; Fri, 4 Oct 2024 09:42:38 -0400 (EDT) From: Stefan Monnier To: john muhl Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <87y134y111.fsf@pub.pink> (john muhl's message of "Thu, 03 Oct 2024 22:55:54 -0500") Message-ID: References: <87frpjtmx6.fsf@pub.pink> <87y134y111.fsf@pub.pink> Date: Fri, 04 Oct 2024 09:42:37 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.055 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73538 Cc: 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >>> This adds support for displaying a notification when the song changes. >> Oh, wow! A patch for `mpc.el`! Thanks! > I hope you won=E2=80=99t mind a few more. =F0=9F=99=82 >>> + (when-let (((string=3D "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 =E2=80=9C%{title} %5{duration}=E2=80=9D 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 > =E2=80=9Cuse Artist or AlbumArtist=E2=80=9D? 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|...-POS= T}`? 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 12 09:58:23 2024 Received: (at 73538) by debbugs.gnu.org; 12 Oct 2024 13:58:23 +0000 Received: from localhost ([127.0.0.1]:46111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szcdS-0000uT-Re for submit@debbugs.gnu.org; Sat, 12 Oct 2024 09:58:23 -0400 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]:37921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szcdQ-0000uF-4E for 73538@debbugs.gnu.org; Sat, 12 Oct 2024 09:58:21 -0400 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 8046E138025A; Sat, 12 Oct 2024 09:58:00 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Sat, 12 Oct 2024 09:58:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728741480; x=1728827880; bh=QxwKi2IxBh UhwIWq4Cmm7KaErJc0DXQSPFZkKBvGRP4=; b=IFNX9FCUusxBwWwY279mjzsAxZ ACagrxsgXn7/dZTPkg4T8WJvcbx5NLQe/nbE2l9jUTmgiTT9ZIYRCagNpLHdtc84 kiopbsfCP3ZBM8Q/+3JkxXlz0DYz3BJazW+1285QUB9HCviKNVR2YaS7JTbv0u/b BOr0BzFd+PCBowZCG9kt5JPihCUj0chEik2JcndXYsOVewZBUpd1hymNtM2lFkYr UvQIkg+gf3Eswq6zhBmh7meJleLfsEnHVnUzOVacLCXe6pTMNxCoVAapozFdh6km h3HulJeHs2Tbt6mrYLuja7Vwf6prOa/s3hexirjNKFoiZxijsZpo8uWio5qA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728741480; x=1728827880; bh=QxwKi2IxBhUhwIWq4Cmm7KaErJc0 DXQSPFZkKBvGRP4=; b=JxNGswQNQaFIBypfZNU4k6nZ0p3CYvdzfQmYKlZRw9Gb jjzKLAV37GdNBJZb4KRtL2YKQ/3tWsTeIYSTDKZxyTQ+n3rDaBMcSV8XG06LnwbX MHCTYASLbAeRHiA1TXhg3GtYPSsobglqcDOeCPyk/nZuxTZj6DrWw4/ii/DUub51 8OcMA0vHZ/8/9zxObNkRfQfmLA9AciHgVIUPAi5Mw36nXHG04Fr3z6WoDnuHV8G+ m86/RYAjkVtlaHTUqH3+7Qb4cQNCassxuR1a5nYt0bPCb/uG3JP/LuPxqFJrfdNL g4v1TSMLxp0a5Y/JPxGUmb/t6sW08JPEm+AB8K4jwQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeguddgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujgfffhgfkfggtgesmhdtreertderjeen ucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffrrg htthgvrhhnpeejvdeludegleefieegtdduteevvdelieffgffhudfhudfghfegvedvgeff vdfhveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hjmhesphhusgdrphhinhhkpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopeejfeehfeekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpth htohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggr X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 12 Oct 2024 09:57:59 -0400 (EDT) From: john muhl To: Stefan Monnier Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: (Stefan Monnier via's message of "Thu, 03 Oct 2024 10:57:23 -0400") Date: Fri, 11 Oct 2024 20:39:29 -0500 References: <87frpjtmx6.fsf@pub.pink> User-Agent: mu4e 1.12.1; emacs 31.0.50 Message-ID: <87r08lwhi1.fsf@pub.pink> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 73538 Cc: 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.9 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Here=E2=80=99s an updated patch. Should have all feedback incorporated and now with a NEWS entry. Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text= editors" writes: >> +(defcustom mpc-notifications-function 'mpc-notifications-notify >> + "Function called to display notification." >> + :version "31.1" >> + :type 'function) > > Nitpick: I'd prefer it to use #' to quote `mpc-notifications-notify`. > Nitpick: The docstring should describe how it's called (how many args > are passed to it, what those args will be, and what it should return). > Question: Is it worth making this a `defcustom`? I have a hard time > imagining someone using the Customize UI to set this. With the title and body now customizable this isn=E2=80=99t needed anymore. >> +(defcustom mpc-notifications nil >> + "Non-nil means to display notifications when the song changes." >> + :version "31.1" >> + :type 'boolean >> + :set (lambda (symbol value) >> + (if-let ((cb (cons 'file mpc-notifications-function)) >> + value) >> + (add-to-list 'mpc-status-callbacks cb) >> + (setq mpc-status-callbacks (delete cb mpc-status-callbacks))) >> + (set-default-toplevel-value symbol value))) > > Comment: I'd assume that `file` changes are rare enough that it's OK to > always have a callback in there regardless if notifications are enabled a= nd > instead test the value of `mpc-notifications` in that callback before > calling `mpc-notifications-function`. Ok. Moved it in with the other callbacks. >> +(defvar mpc-notifications-id nil) > > Comment: AFAICT this is an internal var so it should use a "--". Done. >> +(defun mpc-notifications-notify () >> + "Display a notification with information about the current song." >> + (interactive) >> + (mpc-status-refresh) > > Question: Why is it interactive? I have a global mpc-minor-mode that adds a key binding for notifications and it must have bled through. > Question: Why does it need `mpc-status-refresh`? It seems odd to call > `mpc-status-refresh` from an "mpc-status-callback" (i.e. a function > called in response to an `mpc-status-refresh`). Looks like debugging debris. >> + (when-let (((string=3D "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. Instead of changing mpc-format I made the customizable variables take a list of specs where the first element to return something interesting is used and a plain string can be added for fallback: (setopt mcp-notifications-body-specs '("%{Artist}" "%{AlbumArtist}" "Unknown Artist")) I added your description of the FORMAT-SPEC to the mpc-format docstring too. >> + (pcase system-type >> + ("windows-nt" >> + (w32-notification-notify :title title :body body :icon icon)) >> + ("haiku" >> + (setq mpc-notifications-id >> + (haiku-notifications-notify :title title >> + :body body >> + :app-icon icon >> + :replaces-id mpc-notifications= -id))) >> + ("android" >> + (setq mpc-notifications-id >> + (android-notifications-notify :title title >> + :body body >> + :icon icon >> + :replaces-id mpc-notificatio= ns-id)) >> + (android-notifications-notify :title title :body body :icon icon= )) >> + (_ (when (notifications-get-server-information) >> + (setq mpc-notifications-id >> + (notifications-notify :title title >> + :body body >> + :app-icon icon >> + :replaces-id mpc-notifications-i= d))))))) > > Comment: Eww! > Question: Don't we have a function in Emacs which knows which > notification backend to use so we don't need to do this ugly dispatch > dance here? Well there are erc-notifications-notify, gnus-notifications-notify and org-show-notifications but none of those seemed appropriate for reuse by mpc. Rather than add a fourth implementation I removed support for everything except DBus. I=E2=80=99ll try to work up a patch for notifications.el that could be used in erc, gnus, org and mpc then we can revisit support for the rest. Does that sound OK or do you have another idea? >> +(defun mpc-cover-image-find (file) >> + "Find cover image for FILE." >> + (and-let* ((default-directory mpc-mpd-music-directory) >> + (dir (file-name-directory file)) >> + (files (directory-files (mpc-file-local-copy dir))) >> + (cover (seq-find #'mpc-cover-image-p files)) >> + ((expand-file-name cover dir))))) >> + >> +(defun mpc-cover-image-p (file) >> + "Check if FILE is a cover image." >> + (let ((covers '(".folder.png" "folder.png" "cover.jpg" "folder.jpg"))) >> + (or (seq-find (lambda (cover) (string=3D file cover)) covers) >> + (and mpc-cover-image-re (string-match-p mpc-cover-image-re file= ))))) > > Comment: This should be consolidated with the `Cover` code in `mpc-format= `. mpc-format now uses mpc-cover-image-find. Thanks. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-Add-notifications-support-to-mpc-Bug-73538.patch Content-Transfer-Encoding: quoted-printable >From 71deac5c51c90b24d886d26810d04a963d576c64 Mon Sep 17 00:00:00 2001 From: john muhl Date: Sun, 15 Sep 2024 19:52:25 -0500 Subject: [PATCH] Add notifications support to 'mpc' (Bug#73538) * lisp/mpc.el (mpc-notifications, mpc-notifications-title) (mpc-notifications-body): New option. (mpc--notifications-id): New variable. (mpc-notifications-notify, mpc-cover-image-find) (mpc-cover-image-p, mpc--notifications-format): New function. (mpc-format): Use 'mpc-cover-find' and expand docstring to include details about the FORMAT-SPEC. (mpc-status-callbacks): Add file callback for notifications. --- etc/NEWS | 8 +++++ lisp/mpc.el | 96 ++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 96 insertions(+), 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index c2919169bbf..6ffec916848 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -535,6 +535,14 @@ instead. *** A new shortcut to navigate to previous menu. The hardcoded "^" shortcut gets you back to the previous menu. =20 +** MPC + +--- +*** New user option 'mpc-notifications'. +When non-nil MPC displays a desktop notification when the song changes. +The notification=E2=80=99s title and body can be customized with +'mpc-notifications-title' and 'mpc-notifications-body'. + * New Modes and Packages in Emacs 31.1 =20 diff --git a/lisp/mpc.el b/lisp/mpc.el index 768c70c2e3a..a4b576cbd1b 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -95,6 +95,8 @@ (require 'cl-lib) (require 'subr-x)) =20 +(require 'notifications) + (defgroup mpc () "Client for the Music Player Daemon (mpd)." :prefix "mpc-" @@ -460,6 +462,7 @@ mpc-status-callbacks (state . mpc--faster-toggle-refresh) ;Only ffwd/rewind while play/pau= se. (volume . mpc-volume-refresh) (file . mpc-songpointer-refresh) + (file . mpc-notifications-notify) ;; The song pointer may need updating even if the file doesn't change, ;; if the same song appears multiple times in a row. (song . mpc-songpointer-refresh) @@ -958,6 +961,20 @@ mpc-file-local-copy ;; aux) )) =20 +(defun mpc-cover-image-find (file) + "Find cover image for FILE." + (and-let* ((default-directory mpc-mpd-music-directory) + (dir (mpc-file-local-copy (file-name-directory file))) + (files (directory-files dir)) + (cover (seq-find #'mpc-cover-image-p files)) + ((expand-file-name cover dir))))) + +(defun mpc-cover-image-p (file) + "Check if FILE is a cover image." + (let ((covers '(".folder.png" "folder.png" "cover.jpg" "folder.jpg"))) + (or (seq-find (lambda (cover) (string=3D file cover)) covers) + (and mpc-cover-image-re (string-match-p mpc-cover-image-re file)))= )) + ;;; Formatter ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; =20 (defcustom mpc-cover-image-re nil ; (rx (or ".jpg" ".jpeg" ".png") string-= end) @@ -992,7 +1009,15 @@ mpc-tempfiles-add (push file mpc-tempfiles)) =20 (defun mpc-format (format-spec info &optional hscroll) - "Format the INFO according to FORMAT-SPEC, inserting the result at point= ." + "Format the INFO according to FORMAT-SPEC, inserting the result at point. + +FORMAT-SPEC is a string of the format '%-WIDTH{NAME-POST}' where the first +'-', WIDTH and -POST are optional. % followed by the optional '-' means +to right align the output. WIDTH limits the output to the specified +number of characters by replacing any further output with a horizontal +ellipsis. The optional -POST means to use the empty string if NAME is +absent or else use the concatenation of the content of NAME with the +string POST." (let* ((pos 0) (start (point)) (col (if hscroll (- hscroll) 0)) @@ -1026,7 +1051,8 @@ mpc-format (substring time (match-end = 0)) time))))) ('Cover - (let ((dir (file-name-directory (cdr (assq 'file info= ))))) + (let* ((file (alist-get 'file info)) + (dir (file-name-directory file))) ;; (debug) (setq pred ;; We want the closure to capture the current @@ -1037,12 +1063,7 @@ mpc-format (and (funcall oldpred info) (equal dir (file-name-directory (cdr (assq 'file info)))= ))))) - (if-let* ((covers '(".folder.png" "folder.png" "cov= er.jpg" "folder.jpg")) - (cover (cl-loop for file in (directory-fi= les (mpc-file-local-copy dir)) - if (or (member (downcase = file) covers) - (and mpc-cover-ima= ge-re - (string-match= mpc-cover-image-re file))) - return (concat dir file))) + (if-let* ((cover (mpc-cover-image-find file)) (file (with-demoted-errors "MPC: %s" (mpc-file-local-copy cover)))) (let (image) @@ -2766,6 +2787,65 @@ mpc-drag-n-drop (t (error "Unsupported drag'n'drop gesture")))))) =20 +;;; Notifications ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;; + +(declare-function notifications-notify "notifications") + +(defcustom mpc-notifications nil + "Non-nil means to display notifications when the song changes." + :version "31.1" + :type 'boolean) + +(defcustom mpc-notifications-title + '("%{Title}" "Unknown Title") + "FORMAT-SPEC used in the notification title. + +The first element that returns a non-emtpy string is used. The last +element is a plain string to use as fallback for when none of the tags +are found. See `mpc-format' for the definition of FORMAT-SPEC." + :version "31.1" + :type '(repeat string)) + +(defcustom mpc-notifications-body + '("%{Artist}" "%{AlbumArtist}" "Unknown Artist") + "FORMAT-SPEC used in the notification body. + +The first element that returns a non-emtpy string is used. The last +element is a plain string to use as fallback for when none of the tags +are found. See `mpc-format' for the definition of FORMAT-SPEC." + :version "31.1" + :type '(repeat string)) + +(defvar mpc--notifications-id nil) + +(defun mpc--notifications-format (format-specs) + "Use FORMAT-SPECS to get string for use in notification." + (seq-some + (lambda (spec) + (let ((text (with-temp-buffer + (mpc-format spec mpc-status) + (buffer-string)))) + (if (string=3D "" text) nil text))) + format-specs)) + +(defun mpc-notifications-notify () + "Display a notification with information about the current song." + (when-let ((mpc-notifications) + ((notifications-get-server-information)) + ((string=3D "play" (alist-get 'state mpc-status))) + (title (mpc--notifications-format mpc-notifications-title)) + (body (mpc--notifications-format mpc-notifications-body)) + (icon (or (mpc-cover-image-find (alist-get 'file mpc-status)) + notifications-application-icon))) + (setq mpc--notifications-id + (notifications-notify :title title + :body body + :app-icon icon + :replaces-id mpc--notifications-id)))) + + + + ;;; Toplevel ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;; =20 (defcustom mpc-frame-alist '((name . "MPC") (tool-bar-lines . 1) --=20 2.46.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 12 10:44:21 2024 Received: (at 73538) by debbugs.gnu.org; 12 Oct 2024 14:44:21 +0000 Received: from localhost ([127.0.0.1]:46448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szdLw-0003Zg-H9 for submit@debbugs.gnu.org; Sat, 12 Oct 2024 10:44:21 -0400 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]:44003) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szdLt-0003ZS-J5 for 73538@debbugs.gnu.org; Sat, 12 Oct 2024 10:44:19 -0400 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id DCE1313801F2; Sat, 12 Oct 2024 10:43:57 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Sat, 12 Oct 2024 10:43:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728744237; x=1728830637; bh=Axf9VkYh5P NMLo1oCGQmjHcnaVe8XjJ6do5um/FZ0qM=; b=Phwxa43dpUmexEX9iSN50lD5j8 O9TCTr5jxFOIexdUq8l06Om6fnbeUbIfHfYG6edn51P7eASqKFEY3WzTkTeL5LBp yF4ukUBzoZV/g/Sp5IVNP//S4yeHHR9gwVF/1CbeDX7Ot1oA1XaFAnlO3/SXHzJx Akk/I8sn1TvpF7yF3JvAQQDNUsbOFymbPEHzsVcJexA8agEUOM4cAo7OMw+ZI5ry UTtFpasuTClE7XxF3uxvq0OsNzYawsaKcWKCXfX8RHdU33mmJ204QujYehI7m0I8 i1EDrI36phaCBU7L9F3Pcu+5HYquVeNb0SXe3G0WDaXW9DBo05LfkbmGBx8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728744237; x=1728830637; bh=Axf9VkYh5PNMLo1oCGQmjHcnaVe8 XjJ6do5um/FZ0qM=; b=jVG33tb5txl5LW1bQ2fbMXnet1wY4JRUGB9WT7F5b0At O5nxXpxgRyv0QA0RU0GQbXQRIUSSMppL4s+saGz6UR+l5rx1XAG4PS4CQmjUJxu2 APwlFBRXK59s48Gby64Ri8bVIS1hQaWMNHRvPJFQBA+uAfci+Sago7HxEKwaXkod TGAgQZNVC5oOE3jJLaZlilk68XhGRRt1SmtBkQqZ42fdXHB5vF6PIvstW9Sb7aNw iAsai/2tRMt4tNkYzTKyPU+P+D59lElbzL7cEUNPcd0nLJBV1EQkZ6OIrGvrEl/s Z+VHvVAaLXe4EEnVoJZzXP+TXvLe/uRv/dO0pDQAlA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeguddgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesmhdtreertderjeen ucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffrrg htthgvrhhnpeehkeeiudffvefhieelueduleelvddtjeevtdetgefgieelhfehieekleef ffffteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hjmhesphhusgdrphhinhhkpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopeejfeehfeekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpth htohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggr X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 12 Oct 2024 10:43:57 -0400 (EDT) From: john muhl To: Stefan Monnier Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <87r08lwhi1.fsf@pub.pink> (john muhl's message of "Fri, 11 Oct 2024 20:39:29 -0500") References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> User-Agent: mu4e 1.12.1; emacs 31.0.50 Date: Sat, 12 Oct 2024 09:43:56 -0500 Message-ID: <87h69hwfdf.fsf@pub.pink> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 73538 Cc: 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Here=E2=80=99s the same patch but with the excess whitespace removed. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-Add-notifications-support-to-mpc-Bug-73538.patch Content-Transfer-Encoding: quoted-printable >From 2f8a66174e37ab076de82eda3759230ed1c3a58c Mon Sep 17 00:00:00 2001 From: john muhl Date: Sun, 15 Sep 2024 19:52:25 -0500 Subject: [PATCH] Add notifications support to 'mpc' (Bug#73538) * lisp/mpc.el (mpc-notifications, mpc-notifications-title) (mpc-notifications-body): New option. (mpc--notifications-id): New variable. (mpc-notifications-notify, mpc-cover-image-find) (mpc-cover-image-p, mpc--notifications-format): New function. (mpc-format): Use 'mpc-cover-find' and expand docstring to include details about the FORMAT-SPEC. (mpc-status-callbacks): Add file callback for notifications. --- etc/NEWS | 8 +++++ lisp/mpc.el | 93 ++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 93 insertions(+), 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index c2919169bbf..6ffec916848 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -535,6 +535,14 @@ instead. *** A new shortcut to navigate to previous menu. The hardcoded "^" shortcut gets you back to the previous menu. =20 +** MPC + +--- +*** New user option 'mpc-notifications'. +When non-nil MPC displays a desktop notification when the song changes. +The notification=E2=80=99s title and body can be customized with +'mpc-notifications-title' and 'mpc-notifications-body'. + * New Modes and Packages in Emacs 31.1 =20 diff --git a/lisp/mpc.el b/lisp/mpc.el index 768c70c2e3a..a8789b19c42 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -95,6 +95,8 @@ (require 'cl-lib) (require 'subr-x)) =20 +(require 'notifications) + (defgroup mpc () "Client for the Music Player Daemon (mpd)." :prefix "mpc-" @@ -460,6 +462,7 @@ mpc-status-callbacks (state . mpc--faster-toggle-refresh) ;Only ffwd/rewind while play/pau= se. (volume . mpc-volume-refresh) (file . mpc-songpointer-refresh) + (file . mpc-notifications-notify) ;; The song pointer may need updating even if the file doesn't change, ;; if the same song appears multiple times in a row. (song . mpc-songpointer-refresh) @@ -958,6 +961,20 @@ mpc-file-local-copy ;; aux) )) =20 +(defun mpc-cover-image-find (file) + "Find cover image for FILE." + (and-let* ((default-directory mpc-mpd-music-directory) + (dir (mpc-file-local-copy (file-name-directory file))) + (files (directory-files dir)) + (cover (seq-find #'mpc-cover-image-p files)) + ((expand-file-name cover dir))))) + +(defun mpc-cover-image-p (file) + "Check if FILE is a cover image." + (let ((covers '(".folder.png" "folder.png" "cover.jpg" "folder.jpg"))) + (or (seq-find (lambda (cover) (string=3D file cover)) covers) + (and mpc-cover-image-re (string-match-p mpc-cover-image-re file)))= )) + ;;; Formatter ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; =20 (defcustom mpc-cover-image-re nil ; (rx (or ".jpg" ".jpeg" ".png") string-= end) @@ -992,7 +1009,15 @@ mpc-tempfiles-add (push file mpc-tempfiles)) =20 (defun mpc-format (format-spec info &optional hscroll) - "Format the INFO according to FORMAT-SPEC, inserting the result at point= ." + "Format the INFO according to FORMAT-SPEC, inserting the result at point. + +FORMAT-SPEC is a string of the format '%-WIDTH{NAME-POST}' where the first +'-', WIDTH and -POST are optional. % followed by the optional '-' means +to right align the output. WIDTH limits the output to the specified +number of characters by replacing any further output with a horizontal +ellipsis. The optional -POST means to use the empty string if NAME is +absent or else use the concatenation of the content of NAME with the +string POST." (let* ((pos 0) (start (point)) (col (if hscroll (- hscroll) 0)) @@ -1026,7 +1051,8 @@ mpc-format (substring time (match-end = 0)) time))))) ('Cover - (let ((dir (file-name-directory (cdr (assq 'file info= ))))) + (let* ((file (alist-get 'file info)) + (dir (file-name-directory file))) ;; (debug) (setq pred ;; We want the closure to capture the current @@ -1037,12 +1063,7 @@ mpc-format (and (funcall oldpred info) (equal dir (file-name-directory (cdr (assq 'file info)))= ))))) - (if-let* ((covers '(".folder.png" "folder.png" "cov= er.jpg" "folder.jpg")) - (cover (cl-loop for file in (directory-fi= les (mpc-file-local-copy dir)) - if (or (member (downcase = file) covers) - (and mpc-cover-ima= ge-re - (string-match= mpc-cover-image-re file))) - return (concat dir file))) + (if-let* ((cover (mpc-cover-image-find file)) (file (with-demoted-errors "MPC: %s" (mpc-file-local-copy cover)))) (let (image) @@ -2766,6 +2787,62 @@ mpc-drag-n-drop (t (error "Unsupported drag'n'drop gesture")))))) =20 +;;; Notifications ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;; + +(declare-function notifications-notify "notifications") + +(defcustom mpc-notifications nil + "Non-nil means to display notifications when the song changes." + :version "31.1" + :type 'boolean) + +(defcustom mpc-notifications-title + '("%{Title}" "Unknown Title") + "FORMAT-SPEC used in the notification title. + +The first element that returns a non-emtpy string is used. The last +element is a plain string to use as fallback for when none of the tags +are found. See `mpc-format' for the definition of FORMAT-SPEC." + :version "31.1" + :type '(repeat string)) + +(defcustom mpc-notifications-body + '("%{Artist}" "%{AlbumArtist}" "Unknown Artist") + "FORMAT-SPEC used in the notification body. + +The first element that returns a non-emtpy string is used. The last +element is a plain string to use as fallback for when none of the tags +are found. See `mpc-format' for the definition of FORMAT-SPEC." + :version "31.1" + :type '(repeat string)) + +(defvar mpc--notifications-id nil) + +(defun mpc--notifications-format (format-specs) + "Use FORMAT-SPECS to get string for use in notification." + (seq-some + (lambda (spec) + (let ((text (with-temp-buffer + (mpc-format spec mpc-status) + (buffer-string)))) + (if (string=3D "" text) nil text))) + format-specs)) + +(defun mpc-notifications-notify () + "Display a notification with information about the current song." + (when-let ((mpc-notifications) + ((notifications-get-server-information)) + ((string=3D "play" (alist-get 'state mpc-status))) + (title (mpc--notifications-format mpc-notifications-title)) + (body (mpc--notifications-format mpc-notifications-body)) + (icon (or (mpc-cover-image-find (alist-get 'file mpc-status)) + notifications-application-icon))) + (setq mpc--notifications-id + (notifications-notify :title title + :body body + :app-icon icon + :replaces-id mpc--notifications-id)))) + ;;; Toplevel ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;; =20 (defcustom mpc-frame-alist '((name . "MPC") (tool-bar-lines . 1) --=20 2.46.2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable john muhl writes: > Here=E2=80=99s an updated patch. Should have all feedback incorporated and > now with a NEWS entry. > > Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of te= xt editors" writes: > >>> +(defcustom mpc-notifications-function 'mpc-notifications-notify >>> + "Function called to display notification." >>> + :version "31.1" >>> + :type 'function) >> >> Nitpick: I'd prefer it to use #' to quote `mpc-notifications-notify`. >> Nitpick: The docstring should describe how it's called (how many args >> are passed to it, what those args will be, and what it should return). >> Question: Is it worth making this a `defcustom`? I have a hard time >> imagining someone using the Customize UI to set this. > > With the title and body now customizable this isn=E2=80=99t needed anymor= e. > >>> +(defcustom mpc-notifications nil >>> + "Non-nil means to display notifications when the song changes." >>> + :version "31.1" >>> + :type 'boolean >>> + :set (lambda (symbol value) >>> + (if-let ((cb (cons 'file mpc-notifications-function)) >>> + value) >>> + (add-to-list 'mpc-status-callbacks cb) >>> + (setq mpc-status-callbacks (delete cb mpc-status-callbacks)= )) >>> + (set-default-toplevel-value symbol value))) >> >> Comment: I'd assume that `file` changes are rare enough that it's OK to >> always have a callback in there regardless if notifications are enabled = and >> instead test the value of `mpc-notifications` in that callback before >> calling `mpc-notifications-function`. > > Ok. Moved it in with the other callbacks. > >>> +(defvar mpc-notifications-id nil) >> >> Comment: AFAICT this is an internal var so it should use a "--". > > Done. > >>> +(defun mpc-notifications-notify () >>> + "Display a notification with information about the current song." >>> + (interactive) >>> + (mpc-status-refresh) >> >> Question: Why is it interactive? > > I have a global mpc-minor-mode that adds a key binding for > notifications and it must have bled through. > >> Question: Why does it need `mpc-status-refresh`? It seems odd to call >> `mpc-status-refresh` from an "mpc-status-callback" (i.e. a function >> called in response to an `mpc-status-refresh`). > > Looks like debugging debris. > >>> + (when-let (((string=3D "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. > > Instead of changing mpc-format I made the customizable variables > take a list of specs where the first element to return something > interesting is used and a plain string can be added for fallback: > > (setopt mcp-notifications-body-specs > '("%{Artist}" "%{AlbumArtist}" "Unknown Artist")) > > I added your description of the FORMAT-SPEC to the mpc-format > docstring too. > >>> + (pcase system-type >>> + ("windows-nt" >>> + (w32-notification-notify :title title :body body :icon icon)) >>> + ("haiku" >>> + (setq mpc-notifications-id >>> + (haiku-notifications-notify :title title >>> + :body body >>> + :app-icon icon >>> + :replaces-id mpc-notification= s-id))) >>> + ("android" >>> + (setq mpc-notifications-id >>> + (android-notifications-notify :title title >>> + :body body >>> + :icon icon >>> + :replaces-id mpc-notificati= ons-id)) >>> + (android-notifications-notify :title title :body body :icon ico= n)) >>> + (_ (when (notifications-get-server-information) >>> + (setq mpc-notifications-id >>> + (notifications-notify :title title >>> + :body body >>> + :app-icon icon >>> + :replaces-id mpc-notifications-= id))))))) >> >> Comment: Eww! >> Question: Don't we have a function in Emacs which knows which >> notification backend to use so we don't need to do this ugly dispatch >> dance here? > > Well there are erc-notifications-notify, gnus-notifications-notify > and org-show-notifications but none of those seemed appropriate > for reuse by mpc. > > Rather than add a fourth implementation I removed support for > everything except DBus. I=E2=80=99ll try to work up a patch for > notifications.el that could be used in erc, gnus, org and mpc then > we can revisit support for the rest. Does that sound OK or do you > have another idea? > >>> +(defun mpc-cover-image-find (file) >>> + "Find cover image for FILE." >>> + (and-let* ((default-directory mpc-mpd-music-directory) >>> + (dir (file-name-directory file)) >>> + (files (directory-files (mpc-file-local-copy dir))) >>> + (cover (seq-find #'mpc-cover-image-p files)) >>> + ((expand-file-name cover dir))))) >>> + >>> +(defun mpc-cover-image-p (file) >>> + "Check if FILE is a cover image." >>> + (let ((covers '(".folder.png" "folder.png" "cover.jpg" "folder.jpg")= )) >>> + (or (seq-find (lambda (cover) (string=3D file cover)) covers) >>> + (and mpc-cover-image-re (string-match-p mpc-cover-image-re fil= e))))) >> >> Comment: This should be consolidated with the `Cover` code in `mpc-forma= t`. > > mpc-format now uses mpc-cover-image-find. > > Thanks. > > > [2. text/x-patch; 0001-Add-notifications-support-to-mpc-Bug-73538.patch].= .. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 13 08:12:40 2024 Received: (at 73538) by debbugs.gnu.org; 13 Oct 2024 12:12:40 +0000 Received: from localhost ([127.0.0.1]:50489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szxSh-0006d4-Hi for submit@debbugs.gnu.org; Sun, 13 Oct 2024 08:12:40 -0400 Received: from mout.gmx.net ([212.227.17.20]:38471) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szxSe-0006cg-FH for 73538@debbugs.gnu.org; Sun, 13 Oct 2024 08:12:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1728821523; x=1729426323; i=michael.albinus@gmx.de; bh=NtgpakE+YOxkiCJCrtHMJ1Zqu7/lsTPPHCsxJpcrMio=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=jY4swKIWE3vXoi6z8Cmc4OyFkR4h3RoMVSbtzYQcQj81xFkxredvRfeVuYa5+PpK Fvv+xwS7XpHfzVO5ntQZYRpa7kTRQHtrQ3aIelPWJPVSMxsDGE8GYzYobWqybUNWx tN2RMGs4uHjzSNjs3uczbO0bjiw+2dcGTwVnrre3JlRsr9FjyLBndkjRZnVnCbig7 +R0ZExKVanEJMMw7jpm4fa5zlYdD8PV5B2/ZDplYVmLIu0VIk7aBmMX9BZ0vGt1I0 cUQIsfY3FIKLEbdvzP+PC3as9xpfyJ0pwc5byUvvW0ltrujGsy6vibXyDU8c0Yv0J YWndZfyXOpO9JkhQog== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MsYqp-1tnecz2879-00yeEJ; Sun, 13 Oct 2024 14:12:02 +0200 From: Michael Albinus To: john muhl Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <87r08lwhi1.fsf@pub.pink> (john muhl's message of "Fri, 11 Oct 2024 20:39:29 -0500") References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> Date: Sun, 13 Oct 2024 14:11:58 +0200 Message-ID: <87ed4krylt.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:scJ/BKUDiIgjqIkz3vAx5m/mdOGl1DftE2Te69dCQKOTQr/jLRB g10QFV+zBNp0f85bpjXOEosKtRLnoa79jpIQ88QSLeWpqaloDc93T2rjGVjMwyjjxmf+u/u GVbyTpEOReRi56sXlMs0mJPb2Zue7+pcq+J68zoNFXzEA+MpyE8MLPbwNmm9rxz1DR7laVN hBnEEBIhmFih59Tjs1Pxg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:rTfOX3gpVDw=;AIA560X/4wY9EocEwebY3/xoAz1 c9yEv0t2NhZVk6DzXhI039qomXZ5c7/QqieQ3t1sfnQPkPQMdZ4kJDjsG3vINRZc+NyoFvUDY 5IqY66YcculQzZVeENa3W4DtOAyyb+jWCnklJIoXzaFdB1GPf1xzuCvgHt4+VUYRhPEGadmdG UR3hc7tER9ZpAp/j7UOXbk06VH+WkoCTNOiarJJB2T+ZafWIYxmBsl45wDm5p/zJq89T/PO8B Al8aUoyjCoAkv67Du6AYstNy6bXHOahKEBHvPtJChD3dQ+MfIXKtIipI/LGPNGXv8qhGpJlAU lFU8ht9/S69HwqoHbB+EcHlovQjiVdClsnUSx5Max21PYpVz5rHVc1l005u0+M9tJlzSgW3A6 2UzvJHrQ+5mIrHqcVj1C7c56NS+79bq+rLqkjHM4G+ijF4u0tol6c21WMbw/cWCBsaFPSyxtY 8BO2c46hNb7Hy0YLSdFNt16mvQ5RoUngweXojetL4Lo4Z+RwkF/P6xLhVWFuN0r714MF+RgVp +naAZv5YnHdA3DtXO5Ncc24s5NgX1y/Y0FE8J5+vbuoF1uGWaam13VxGAY1NuZLihSp5lM7sn VyrV6iklpt8DCjDFingqkugbb+PJTSxTyo5LbQFxq+baLKqDvZ/et3RTcnFzkV1paTBwgSb3o m625piTv6jmnDfDeggGhGbXzZMkn5Wd/8haBrliPk52rcXNsZRySF7qnSlHsZMCrTrt9SCk+G vrLBmg2t6w8mddNOwBiUYbjpczsughJArbUitkXFUTTRaSjzydlIa/+D4um+mVs1FmDjjirN7 anARPtYcWtx32cA3PZSg2hrA== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 73538 Cc: John Wiegley , Stefan Monnier , 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) john muhl writes: Hi John, > Well there are erc-notifications-notify, gnus-notifications-notify > and org-show-notifications but none of those seemed appropriate > for reuse by mpc. There is alert.el in MELPA, and some other packages which use it. Perhaps it could help? --8<---------------cut here---------------start------------->8--- /home/albinus/.emacs.d/elpa/archives/melpa/elpa-packages.eld 96: (alert :url "https://github.com/jwiegley/alert.git") 97: (alert-termux :url "https://github.com/gergelypolonkai/alert-termux.= git") 99: (alert-toast :url "https://github.com/gkowzan/alert-toast.git") 3294: (mu4e-alert :url "https://github.com/xzz53/mu4e-alert.git") 3600: (org-alert :url "https://github.com/spegoraro/org-alert.git") 4312: (rcirc-alert :url "https://github.com/csantosb/rcirc-alert.git") 4314: (rcirc-alertify :url "https://github.com/fgallina/rcirc-alertify.git= ") 4954: (term-alert :url "https://github.com/calliecameron/term-alert.git") 5310: (weechat-alert :url "https://github.com/Kungi/weechat-alert.git") --8<---------------cut here---------------end--------------->8--- Yes, I would like to see alert.el in GNU ELPA. > Rather than add a fourth implementation I removed support for > everything except DBus. I=E2=80=99ll try to work up a patch for > notifications.el that could be used in erc, gnus, org and mpc then > we can revisit support for the rest. Does that sound OK or do you > have another idea? Perhaps they could be changed to use alert.el instead? In its Commentary, alert.el says: --8<---------------cut here---------------start------------->8--- ;; There are several builtin styles, and it is trivial to create new ones. ;; The builtins are: ;; ;; fringe - Changes the current frame's fringe background color ;; mode-line - Changes the current frame's mode-line background color ;; gntp - Uses gntp, it requires gntp.el (see https://github.com= /tekai/gntp.el) ;; growl - Uses Growl on OS X, if growlnotify is on the PATH ;; ignore - Ignores the alert entirely ;; libnotify - Uses libnotify if notify-send is on the PATH ;; log - Logs the alert text to *Alerts*, with a timestamp ;; message - Uses the Emacs `message' facility ;; momentary - Uses the Emacs `momentary-string-display' facility ;; notifications - Uses notifications library via D-Bus ;; notifier - Uses terminal-notifier on OS X, if it is on the PATH ;; osx-notifier - Native OSX notifier using AppleScript ;; toaster - Use the toast notification system ;; x11 - Changes the urgency property of the window in the X Wi= ndow System ;; termux - Use termux-notification from the Termux API --8<---------------cut here---------------end--------------->8--- > Thanks. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 14 00:04:50 2024 Received: (at 73538) by debbugs.gnu.org; 14 Oct 2024 04:04:50 +0000 Received: from localhost ([127.0.0.1]:33873 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0CKA-0004oa-36 for submit@debbugs.gnu.org; Mon, 14 Oct 2024 00:04:50 -0400 Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]:60085) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0CK7-0004oK-2g for 73538@debbugs.gnu.org; Mon, 14 Oct 2024 00:04:48 -0400 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 396831380237; Mon, 14 Oct 2024 00:04:25 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Mon, 14 Oct 2024 00:04:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1728878665; x=1728965065; bh=nCDL6tytq1MUE6LDLSVDVMTEj/h2bxI5bVuytiRvGC0=; b= S6W5ONO7B6PUjAuARdaC6/jRFzjUx0lSzCo1tx6vS3h8ItqWAvW0IecbZRagsudq SW9rmRRjvsD+CvMxruGpwFAIK5GSzymqX0VAyFeCYE/ZAlz3Ot4T97eCQXfzitZ9 rfm8wAA4z09a9aJAUNeiJPbahDJT9w3ALaGWLBLbkG1vWwGrBZQsC5+7wCppwX2K 2c8giroaKxSUd+erlm3pC6jeaIgCKUYOzskrktRB+jtilcDchZ2xGuNmqEpajIST hEUkDWra85dQ1N0gvUwFU+C1K2HFPCL9PEHYncF/U8uKGpWpo2JjZ+HgHUlcDFYr plRoMCtbdLp4FM4VK0XJUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728878665; x= 1728965065; bh=nCDL6tytq1MUE6LDLSVDVMTEj/h2bxI5bVuytiRvGC0=; b=p rEpoBS3Dukn7Xp0trSF4zdlH3YrpjykDlraeFBE7j9QqO9mAiEoc++9H7c2CNCgf lMOfGCKd+JhOqN2ZvZVXlnUlIIy/15cOden//VpZESXXJ5D8G8XJxmNwLAY2zHUQ d5lxQv2VDo9wyecpYeHkxdyYzAAHvky9tF9M7OiJLVzeFXjerYC/h8ECD5HAWP3c yMSaUtuIgidSgqfYn4ulj4K2S5R4E/LDDfNoiC8JGHIif6aWlOVMYFfnw9Ng+Hhb 3bZKHVJsS6Rz86DY7Z2CT4JR5hpT/LZ3MmkUNY6f7pk6zCBcpzjdXHTPS6pVKqTq Vxb2DEGZrrOX8bKFCDj3g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeggedgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgfgsehtqhertddtreej necuhfhrohhmpehjohhhnhcumhhuhhhluceojhhmsehpuhgsrdhpihhnkheqnecuggftrf grthhtvghrnhephfehhfdugfeltefggfeltdeggeefhfehffekjeekvdethedtgfegtdeu tdefieeknecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjmhesphhusgdrphhinhhkpdhnsggp rhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjfihivghglh gvhiesghhmrghilhdrtghomhdprhgtphhtthhopeejfeehfeekseguvggssghughhsrdhg nhhurdhorhhgpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlh drtggrpdhrtghpthhtohepmhhitghhrggvlhdrrghlsghinhhushesghhmgidruggv X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Oct 2024 00:04:24 -0400 (EDT) From: john muhl To: Michael Albinus Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <87ed4krylt.fsf@gmx.de> (Michael Albinus's message of "Sun, 13 Oct 2024 14:11:58 +0200") References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> <87ed4krylt.fsf@gmx.de> User-Agent: mu4e 1.12.1; emacs 31.0.50 Date: Sun, 13 Oct 2024 23:04:22 -0500 Message-ID: <87r08jfhyx.fsf@pub.pink> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 73538 Cc: John Wiegley , Stefan Monnier , 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Michael Albinus writes: > john muhl writes: > > Hi John, > >> Well there are erc-notifications-notify, gnus-notifications-notify >> and org-show-notifications but none of those seemed appropriate >> for reuse by mpc. > > There is alert.el in MELPA, and some other packages which use > it. Perhaps it could help? > > --8<---------------cut here---------------start------------->8--- > /home/albinus/.emacs.d/elpa/archives/melpa/elpa-packages.eld > 96: (alert :url "https://github.com/jwiegley/alert.git") > 97: (alert-termux :url "https://github.com/gergelypolonkai/alert-termu= x.git") > 99: (alert-toast :url "https://github.com/gkowzan/alert-toast.git") > 3294: (mu4e-alert :url "https://github.com/xzz53/mu4e-alert.git") > 3600: (org-alert :url "https://github.com/spegoraro/org-alert.git") > 4312: (rcirc-alert :url "https://github.com/csantosb/rcirc-alert.git") > 4314: (rcirc-alertify :url "https://github.com/fgallina/rcirc-alertify.g= it") > 4954: (term-alert :url "https://github.com/calliecameron/term-alert.git") > 5310: (weechat-alert :url "https://github.com/Kungi/weechat-alert.git") > --8<---------------cut here---------------end--------------->8--- > > Yes, I would like to see alert.el in GNU ELPA. It looks like it was proposed for inclusion a few times over the years but never got past the copyright assignment stage. Maybe a dedicated bug report for that would get more attention than this one. >> Rather than add a fourth implementation I removed support for >> everything except DBus. I=E2=80=99ll try to work up a patch for >> notifications.el that could be used in erc, gnus, org and mpc then >> we can revisit support for the rest. Does that sound OK or do you >> have another idea? > > Perhaps they could be changed to use alert.el instead? I didn=E2=80=99t look closely (at alert or what erc, &c. are doing) but I guess it could be made to work for all these cases. It=E2=80=99ll need some patches to support Android, Haiku and Windows but that should be fairly trivial I think. Should we table this patch until alert is integrated with Emacs? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 14 06:53:39 2024 Received: (at 73538) by debbugs.gnu.org; 14 Oct 2024 10:53:39 +0000 Received: from localhost ([127.0.0.1]:35508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0Ihn-0001Ey-F0 for submit@debbugs.gnu.org; Mon, 14 Oct 2024 06:53:39 -0400 Received: from mout.gmx.net ([212.227.17.21]:60195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0Ihl-0001Eh-Ax for 73538@debbugs.gnu.org; Mon, 14 Oct 2024 06:53:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1728903188; x=1729507988; i=michael.albinus@gmx.de; bh=y3myww3OFtBQZsyEf0SvZoOiNhA02Hb0uJNwLWkpjCQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=VmaNCogObLt6QgEorLW6rEDALjvALqJJTZ5pQfTAvrzINQ3J+okxThJJY2FMYRIE oY3a2izsv8knSkxNChHl4SQulxLEu1Y62iFbSM8TuMkNQUo0EXIkIMxSGpAjACOvT AP/sMco7penhPpX/DxUnzk03SuMEbtZ8CUcs8gszjtZuAB7xPfZ/wtmmbtgv+Qzab 5lCrk0U+YKeFFfSOb4FYiGU1bqg9d7HG6crFtGBSFwmTC5pm9ctNDHmqmS2ePOhSy wuvmtDVBbuCpYp+Dd3t1rdfqJBHYTwwNYVbSjIXfbPIiDw7zoEBzs6hMPJYLE8hdV UfSU+h1nHGYD1ibPdA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MGz1f-1tEHCR0OeZ-008xtu; Mon, 14 Oct 2024 12:53:08 +0200 From: Michael Albinus To: john muhl Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <87r08jfhyx.fsf@pub.pink> (john muhl's message of "Sun, 13 Oct 2024 23:04:22 -0500") References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> <87ed4krylt.fsf@gmx.de> <87r08jfhyx.fsf@pub.pink> Date: Mon, 14 Oct 2024 12:53:01 +0200 Message-ID: <871q0jvtv6.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:mBHH6Pmc1BJdkjCBrQW+nQ8Klle8oK7MvzltN/NNb1QPlpwNgO7 voQZGfUhFOiNC3J3oBkKDkb4cjXkNvNNzBf3v1/R5/xRDugJKCjGA94CUROvJT4zVWrY/PZ Ug3F3dlSckIc+QPFhMTGiesL3HvmSwQJi2ycrhzqwjYXTIymBOo5aow/13T5JziDYjmu8Kf yppzDf2gyqvlti5uHn4ow== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:onpvjNUXTOQ=;hOXIwbQKWBbogpAlQ2Y+WIP2T0e l3ZK6MNNDQTwsHpe+zZ+nYaxmSQGkZ3d4RVA7CzKrdWq3/W65YghqL7CdSzGKjECIchLA66tr OHtllfHBo9aj3ZsAb95PeYpeoi2XholRxVpl5GmstXpKvsoDw79odCZAkqSUbcZK3ROt9qiOO WavALHb2ie6O7udba102D0DLOLkjRJovIkCwbxUDGrtKck0AvqImZSV7fdr6tfFL7L8LLzd18 PU/1RLpOMFS1uRthfQmFnEUWM5SyAbVeBkMVErip0Er54ErKEYYkJ9y/L6XUor/6eWDORlJsh cfDmXXhFb+we7FSokMr30lubE8X4EvalOSdsmHyx0srmB06NxIuA1cIGOCc8tPIVoSmdO4cy7 wdaDXUdxPOVbmJLB326jDGs/gBtPOEhb8J2v5579Zdo/R5bk3RLaHw0LfOoBGqUy5CeH47Ick XsAYDRHr5JNB7UJrJKS4VdVfWTqtBzBiOnPJQHfvf5wP98RC1V7k8n6RCtDapd5t/L228UhnR A8fBLnWBGdiT1pimWIxNnudwcyLyGjmg1uDvNFn0Ij/rg1OkNBkvqNn1ITXEKjEjlVDdATRJZ cbhScIgVMHpAZ5dIzpy8FWoYOPeN3RS563KZ30T/zIUjdN3B7xH5DGWTiLT5yPwUpaNKlSlif fRVgClKS7dkyLVXSRl3wzkSKMNt202d54plfCZk62Fh2VGLGJc1PGOv8o9mg1c718rnK+awGe B3hYX8K1FUVd8X9rxxhhTL7LlgsIxxKi7Cb+ZhZKV9ewHar9FhKdiSd9lGYLdJ1GfD7uBjjFC vvts9+RisjtmElSonfL3dHbw== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 73538 Cc: John Wiegley , Stefan Monnier , 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) john muhl writes: Hi John, >> Yes, I would like to see alert.el in GNU ELPA. > > It looks like it was proposed for inclusion a few times over the > years but never got past the copyright assignment stage. Maybe a > dedicated bug report for that would get more attention than this > one. > >>> Rather than add a fourth implementation I removed support for >>> everything except DBus. I=E2=80=99ll try to work up a patch for >>> notifications.el that could be used in erc, gnus, org and mpc then >>> we can revisit support for the rest. Does that sound OK or do you >>> have another idea? >> >> Perhaps they could be changed to use alert.el instead? > > I didn=E2=80=99t look closely (at alert or what erc, &c. are doing) but I > guess it could be made to work for all these cases. It=E2=80=99ll need > some patches to support Android, Haiku and Windows but that should > be fairly trivial I think. > > Should we table this patch until alert is integrated with Emacs? I'm definitely in favor of getting alert.el into GNU ELPA (or Emacs core, even better) first. Would you like to push the needed actions? If we have a dedicated bug report for this, it is also simpler to understand the current status (completeness of copyright assignments etc pp). I'd like to help you, but I cannot start it by myself. I'm in a miserable health condition. It could always happen that I'm unavailable w/o prior notice. > Thanks. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 14 09:08:58 2024 Received: (at 73538) by debbugs.gnu.org; 14 Oct 2024 13:08:58 +0000 Received: from localhost ([127.0.0.1]:37307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0Koj-0001fL-Os for submit@debbugs.gnu.org; Mon, 14 Oct 2024 09:08:58 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:35173) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0Koi-0001eO-2m for 73538@debbugs.gnu.org; Mon, 14 Oct 2024 09:08:56 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 63C7B4425D1; Mon, 14 Oct 2024 09:08:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1728911312; bh=YAu9b+xMxJHCj7wyWHb9mSxlmGboT0GrospATbK0KT8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=RumRnruMPg18oJCHrM9h/A62s2oNY6mh4jyGiTJW/rJ36nEDAVfhNlMcah3OApdq7 FhsnJJKslb9SXsdRl0HbpI4i9BPA8v4w67mmwnkOusWeNqXhFW1tGtJb7zEjJ/CNDr s5cTE9dczygl+0rF/kw76FPA4JcQ6zKEk8/MqOzcUCojZWgmSDrZqqElGEvezwu29r 9EntslXuCVu6gEzSgMuuhbqHrCvjNJQdty+L3L/VZ5KtKBE3ZhWhZ2tqnpdlCf3i6H el8+OyjKYiDtszLqg4thGoI7aUErtiEg+zZL9KM9RbvXrk9aCK102wKYnIuT4OuGFu ZZosr87s2y27Q== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 680194425A1; Mon, 14 Oct 2024 09:08:32 -0400 (EDT) Received: from pastel (104-195-209-82.cpe.teksavvy.com [104.195.209.82]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 33B7912034C; Mon, 14 Oct 2024 09:08:32 -0400 (EDT) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <87ed4krylt.fsf@gmx.de> (Michael Albinus's message of "Sun, 13 Oct 2024 14:11:58 +0200") Message-ID: References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> <87ed4krylt.fsf@gmx.de> Date: Mon, 14 Oct 2024 09:08:30 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.037 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73538 Cc: John Wiegley , john muhl , 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> Well there are erc-notifications-notify, gnus-notifications-notify >> and org-show-notifications but none of those seemed appropriate >> for reuse by mpc. > > There is alert.el in MELPA, and some other packages which use > it. Perhaps it could help? Looking at the above existing uses of `notifications-notify` I get the impression that we should fix `notifications-notify` so it dispatches to the applicable backend, regardless if we want to integrate `alert.el`. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 14 10:58:05 2024 Received: (at 73538) by debbugs.gnu.org; 14 Oct 2024 14:58:05 +0000 Received: from localhost ([127.0.0.1]:40048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0MWL-0008Dv-B3 for submit@debbugs.gnu.org; Mon, 14 Oct 2024 10:58:05 -0400 Received: from mail-yb1-f175.google.com ([209.85.219.175]:59565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0MWI-0008DV-DP for 73538@debbugs.gnu.org; Mon, 14 Oct 2024 10:58:03 -0400 Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-e290333a62cso3688129276.2 for <73538@debbugs.gnu.org>; Mon, 14 Oct 2024 07:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728917805; x=1729522605; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:feedback-id:from:to:cc :subject:date:message-id:reply-to; bh=S3dSztaLcYfLb7f7TF5bRhP+PkA6vjzOxl9KbB+s7Nw=; b=XTMdfnOSWB7Dn3uFfgu/YI2sfthX8vK66mlAZ/7fgzB1Rr/knk+SF8B5z6ojW8zEL3 RwyaIVeKfRYO2kN5PisvjEBMIq/IYfHhx0pPFakfoM0HXuAKNzzH8DWeDGrmcHnhCdhb MyjSp3jaBzcGKjAaXlxIwoJDHZDnQiMEtd2+SIGFy2fm2moBol6oERAC5uH6HDHxNC2B GJLxZ8urJf+CAwrdSTCRWZrjXPSwA+PtK6WQcIJEbPGwm7C6oY6AZ0J31OLgH5ga+RkA krrGC+mPK3IFAId9rplFfXauXEpHzzkePkeYhg9XrGBPnYlPjwDvYyeYlWSwntRvdCpm eyQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728917805; x=1729522605; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:feedback-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=S3dSztaLcYfLb7f7TF5bRhP+PkA6vjzOxl9KbB+s7Nw=; b=R3QMTmkOX05RJFWleYYVVZA0R9DS+3+ZkMlIS3urLYuX6hxBLVGt4xLdRBZglXZM1w oBxNS1Tw++++eXP9riYZYa6O6n5YqugOYZvC4IP77ak38DzLwuGjaxl+i+q3JgTBjJPu Bg5QkhHkN9Qvb+Z1GDsCWPYfU7WxBOXTRxaxfLSab/ipMMdP+iiLCWLzqRE5Kl8llfiH ca6u83eITakRjY2S+0m6M6vqWlF62dvgq9XuAB0YiTFkQdPD0ddbAWHSWMah4tc/+HLH Ie118vNt06Lo8UMlnilkjmromjqsieCSDuKKckxSDJhSV2kWjjDvLFSuAH9ozh8btZjf ls/A== X-Forwarded-Encrypted: i=1; AJvYcCVaUM+hg+1S7YwxIn7lCfnMiFAO/GB5GWsv5tAlkl2XluHgbouqPZwuttqPfxVc+7qeIhTbiQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzTjhsyLHWEztrmbsBRtLoOZOF5rhT2DxYxaaAb8s3Rp8jtDo+F 5mtJ7kdxw5w3JxOC7uM7zr1OTX55rUrUAaV0id9eeIOtptAN9D2AyUNxbQ== X-Google-Smtp-Source: AGHT+IFcLLlmqDf9eRXElTKO4KxPiGpWY6k4thYWmMY3Qe3unYHJoi8mOF3bLr+Ms72YSi6Z8/bU1w== X-Received: by 2002:a05:6902:a81:b0:e28:e534:2dd with SMTP id 3f1490d57ef6-e2919d989demr8542274276.24.1728917804738; Mon, 14 Oct 2024 07:56:44 -0700 (PDT) Received: from fauth-a1-smtp.messagingengine.com (fauth-a1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b11497acb3sm426655985a.120.2024.10.14.07.56.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 07:56:44 -0700 (PDT) Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfauth.phl.internal (Postfix) with ESMTP id 132681200071; Mon, 14 Oct 2024 10:56:44 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Mon, 14 Oct 2024 10:56:44 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeghedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkfgggtgfgsehtqhertddtreej necuhfhrohhmpeflohhhnhcuhghivghglhgvhicuoehjfihivghglhgvhiesghhmrghilh drtghomheqnecuggftrfgrthhtvghrnhepffekhfevfeevveefteekuedujeehtdeifeeh ueevkeegkeevhfdtfeehtddtkedtnecuffhomhgrihhnpehgihhthhhusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhhnhif odhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeikeelgeeifeekgedqudejje ehfeekudeiqdhjfihivghglhgvhieppehgmhgrihhlrdgtohhmsehnvgifrghrthhishgr nhhsrdgtohhmpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtph htthhopeejfeehfeekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepmhho nhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggrpdhrtghpthhtohepjhhmsehpuh gsrdhpihhnkhdprhgtphhtthhopehmihgthhgrvghlrdgrlhgsihhnuhhssehgmhigrdgu vg X-ME-Proxy: Feedback-ID: i3c0945b2:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Oct 2024 10:56:43 -0400 (EDT) From: John Wiegley To: Michael Albinus Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <871q0jvtv6.fsf@gmx.de> (Michael Albinus's message of "Mon, 14 Oct 2024 12:53:01 +0200") References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> <87ed4krylt.fsf@gmx.de> <87r08jfhyx.fsf@pub.pink> <871q0jvtv6.fsf@gmx.de> Date: Mon, 14 Oct 2024 07:56:42 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73538 Cc: john muhl , Stefan Monnier , 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> Michael Albinus writes: > I'm definitely in favor of getting alert.el into GNU ELPA (or Emacs core, > even better) first. Would you like to push the needed actions? > If we have a dedicated bug report for this, it is also simpler to underst= and > the current status (completeness of copyright assignments etc pp). I'd li= ke > to help you, but I cannot start it by myself. I'm in a miserable health > condition. It could always happen that I'm unavailable w/o prior notice. I=E2=80=99d be very happy to see alert.el make it into either ELPA or Core.= Looking at the =E2=80=98git shortlog=E2=80=98, it does seem that there will be quite a= number of assignments needed. I have created this issue on GitHub to help us track assignments, the same = way we did for use-package (which took a couple of years to finally resolve, bt= w): https://github.com/jwiegley/alert/issues/115 John From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 15 06:49:08 2024 Received: (at 73538) by debbugs.gnu.org; 15 Oct 2024 10:49:08 +0000 Received: from localhost ([127.0.0.1]:54242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0f6y-0003na-0m for submit@debbugs.gnu.org; Tue, 15 Oct 2024 06:49:08 -0400 Received: from mout.gmx.net ([212.227.15.18]:52141) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0f6w-0003n4-5M for 73538@debbugs.gnu.org; Tue, 15 Oct 2024 06:49:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1728989299; x=1729594099; i=michael.albinus@gmx.de; bh=0LqrbFdGmDaPUU28CjG0rCVWE3I0rNX4mhW7GBtw/Pw=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=oAfr2xDV5jZW/nc3CA8L5ndZdN2gSb23g4wujBRYO7j4/ejI+FoU7Q8abqoDjPtT ADp/ETpKnDAKgAH3gkiL+Hffl9EPwY3eJGUTsDzhLDnkaiMqL/MKxlMHDAe+HBJn+ Spjb7fX01SCIoilyZLlumQNrxCzvoMv/1jKKK/hFZF+HuRDZNtFSvB45nVTwJIQo1 XWAY6frXI3W98L6OrQIIcGFD+NDfDVds3JqAh/aWM3spGQT0jUAAymy0WnQKINXEK mOlD8aFP4ZEDUvlnUP5+QrFJ4cHPy60u4/RoAD+9UWDzytXRDrEU6Mmen6eAZZlKl Z4HstQ6KjvsnckXPsw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MiaY9-1td2yz3Icp-00adTK; Tue, 15 Oct 2024 12:48:18 +0200 From: Michael Albinus To: John Wiegley Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: (John Wiegley's message of "Mon, 14 Oct 2024 07:56:42 -0700") References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> <87ed4krylt.fsf@gmx.de> <87r08jfhyx.fsf@pub.pink> <871q0jvtv6.fsf@gmx.de> Date: Tue, 15 Oct 2024 12:48:15 +0200 Message-ID: <87a5f5vdzk.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:DeTqsN89DC0609qur5aqM0zLSaGZtLmUJsTKRlUd7xTUayWwmfj u3inr4uUT/HiGEVev7FSh3qL9LuvF7ORDxpBowIotGOJdbMDukedxPcs/ZKKnwqFp8MdJgM QgupMUP+Whd27wixuCOElMcjrPeogWjPz2+Szz0d7617pWyF5N7PuUUlEcZ80Vsw0VVGSWM 1R9Rl81ATzP/cuPPe/RQg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:o4KjfPMJyFA=;+BE2E9CWn1Edz2BEpsB+IkA5o3j vSiWMXYpm26m8rCGzx8Z2BPk0YS9E4WRsmO6tdjdvwl5B6fAA28zMDV3cH/qBAwL+xYk0Ckr3 RdbjQjVfQC8/4lg9JkrRC3JTy32anyr5Fo35HFEiaG3aFURVY3BuHqJ8pf0/FCGEOJ+OBMQ2J oWww/RUx+H8y/lTIRAshoo/gIjJ3jnkcmSv7L8gGNRkAbi8bCoSHubweIjOkgm5Rg2704WgdW UMF4OwaCSd0ZZCBDuu64vdjg3Bcx57jmLBRgSslCvx/52ymYDM/1hqx+5YwnFIYfYtk59f4oG vdCMGyXd/HA+Anks/G0L75eTbL3VtHKAjnANJ3fdEeM1xCR3tBYs3jtHzV7IjTzB9BujE7T4F gH7dmeur1mCzKJEkkDpCYrIcjXuI+paOPHkXOWQcG3Exsii+lY6aVgPjTygMunHzYlzDntTr8 RgTxF3+V86WVPRMKpVHxwlxz5OP0mQW+UQoE++XOaRpCTnN8NZ9GacZAYs1cTQ/lIWNwWyC7R I4louMt3Oo1KGJwemp/Ol/7UdfyNviJ1rvRQPCpLC7AFoBI/MjDlJjNq/73bL+tz71evZYU2k +iUm66fy+MJFu0fC7PEbccl3E2JQ/MoFkJEJAmRX3tb+WwCzBgidKDXKG6Gi62DyNbqsCdavn t48WspLiZyKKq2etr/GuQ3HaDwUXsvLdljyBCcs/C7tQ4MiZAeHl7Iye6QnbW0eI37qXRnHLB d9uA3NiP5V5Q7EZ8/+L0wH0t52AhJxA+fXpBJ0gNTAYpO5N+Ei8YNJPK2fwEe67D+ZGMNnlH0 8tCAW/zqig/qT0o4p9qXz8OaCYRx6T+7iSVJLfPSXbffA= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 73538 Cc: john muhl , Stefan Monnier , 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) John Wiegley writes: Hi John, > I=E2=80=99d be very happy to see alert.el make it into either ELPA or Cor= e. Looking at > the =E2=80=98git shortlog=E2=80=98, it does seem that there will be quite= a number of > assignments needed. > > I have created this issue on GitHub to help us track assignments, the sam= e way > we did for use-package (which took a couple of years to finally resolve, = btw): > > https://github.com/jwiegley/alert/issues/115 Thanks! I've checked this list. There are just two people left we need to contact, see my comments there. Would you like to ask them? > John Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 12:44:16 2024 Received: (at 73538) by debbugs.gnu.org; 17 Oct 2024 16:44:16 +0000 Received: from localhost ([127.0.0.1]:35406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1Tbj-0000c7-Lo for submit@debbugs.gnu.org; Thu, 17 Oct 2024 12:44:16 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:40304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1Tbh-0000bp-L8 for 73538@debbugs.gnu.org; Thu, 17 Oct 2024 12:44:14 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C65EB100055; Thu, 17 Oct 2024 12:43:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1729183426; bh=7wwzmu6aZT8NIYdkInV9ILupT6pSRoXmpGWOp38SbOw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=i7TeHx98LG7N98GbJij7RH2Ig/X0NZ9laX63Use5UuATbl+AiPyjN/pW2q3aXR73c 6H3LUjY3kqdLUl+sbMqkPo9BcNj5b7ILELT4Z0Z1xkoSeqYOw1bjrYsYSSDOt4LLDH qmaO9f6wBCD8q1fZ1jhxuyxisX2RfTYolzjsISwwPbD8sg6XYuc8ExLZzCL9ESB6KJ 11Dpo2YTHed95OH7rstzojuU6EvvnHADSdQ7ubMicnEAwstshSygWpD/G93SvjNqil AVVaxfLkqFPK/trcSuUyi0WP4fBfi5wTYqS/XgstEFQyXcMpxU/SqJq4bZsvLCMH0A 9Or+VSXaesQ1g== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1E2A0100042; Thu, 17 Oct 2024 12:43:46 -0400 (EDT) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F120C12047D; Thu, 17 Oct 2024 12:43:45 -0400 (EDT) From: Stefan Monnier To: john muhl Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: <87r08lwhi1.fsf@pub.pink> (john muhl's message of "Fri, 11 Oct 2024 20:39:29 -0500") Message-ID: References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> Date: Thu, 17 Oct 2024 12:43:45 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.033 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73538 Cc: 73538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Here=E2=80=99s an updated patch. Should have all feedback incorporated and > now with a NEWS entry. Thanks, merged into `master` (after which I installed some further tweaks). >> Question: Why is it interactive? > I have a global mpc-minor-mode that adds a key binding for > notifications and it must have bled through. =F0=9F=99=82 > Instead of changing mpc-format I made the customizable variables > take a list of specs where the first element to return something > interesting is used and a plain string can be added for fallback: > > (setopt mcp-notifications-body-specs > '("%{Artist}" "%{AlbumArtist}" "Unknown Artist")) > > I added your description of the FORMAT-SPEC to the mpc-format > docstring too. I tweaked the docstring a bit further. Regarding the `mpc-notifications-body/title`, the problem I can see with it is that the "conditionality" is based on the fact that the overall result is an empty string, so you can use something like (setopt mcp-notifications-body '("By %{Artist}" "By %{AlbumArtist}" "Unknown Artist")) since the first will expand to the non-empty "By ". =F0=9F=99=81 Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 20:26:37 2024 Received: (at 73538-done) by debbugs.gnu.org; 18 Oct 2024 00:26:37 +0000 Received: from localhost ([127.0.0.1]:36359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1apA-0005QV-MC for submit@debbugs.gnu.org; Thu, 17 Oct 2024 20:26:36 -0400 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]:47615) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1ap7-0005Q9-Mc for 73538-done@debbugs.gnu.org; Thu, 17 Oct 2024 20:26:35 -0400 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 02674138024C; Thu, 17 Oct 2024 20:26:06 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 17 Oct 2024 20:26:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1729211165; x=1729297565; bh=DC5GMl0Qve2erOQ0pBLSntzt1DCzSSSPT3QvOZGgOFw=; b= bHie90SimkH2XLF5TetS5t/+cUYlxK2HrBBpE5aCSAR2m3OKzsn2xO3VUvXzwfJp lPwxDyfGdI5Me7r601msT7wLeofJ9WCGUUYzoP1WYLpbGJvXFOE31Qfa+RFpNZzo ns1P7jRgEwm3V28PNwvnffbtsSKFLYByF/WL9RR4ZuyRzsT6HiWn2Ku77JNvzsA0 VMdpGHytijiYaMggwwQAAJr5FN8Z9Eu0j74V44OURwGlUiXx8yMXiLwN8qQiRkAM IegVb+1Y3RioZ5vs/pAhR9b7MyCuAtRsFqsFY86vLTYHc9pJETsZi02it2zxXw++ MAj9Vlj2UlRHivbrkB4VMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1729211165; x= 1729297565; bh=DC5GMl0Qve2erOQ0pBLSntzt1DCzSSSPT3QvOZGgOFw=; b=l I6+cFYz059uhDYF7S97YVNvU86RV7r7sNIn5NGi8qzTwMUVvVzNoks9QGG0puph5 Sw2xXhZn4FHxLRurSQHQUViCnk405gsnHC2PcRG1h2olKNB8u0OQnT3cAsZpeFm0 UTETckOR0MjkYMSXxw70iQjgjDqKcXilaU+RqbmU32wxdQgQt6qZxfuxP8xhLfxi JsQH5PGKAA9qRQ/4wzdcfAifzMTinsRxYzUSZI3fNxF4SlV3pJvecWDXr/fEX4c+ 3Ls0VbwkgEcmUimBlRrp91YQ81K489aVPdmvrlWb3qpswC99sRNbYP3ISK0SgXTp /oupMhdniRPo+D94pKMbw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgfgsehtqhertddtreej necuhfhrohhmpehjohhhnhcumhhuhhhluceojhhmsehpuhgsrdhpihhnkheqnecuggftrf grthhtvghrnhepgeevhedvtdetvdekuddvtddthefhvdfggfdvgfeitdejudehhfffjedt vdevveeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epjhhmsehpuhgsrdhpihhnkhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepjeefheefkedqughonhgvseguvggssghughhsrdhgnhhurdhorh hgpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggr X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 17 Oct 2024 20:26:05 -0400 (EDT) From: john muhl To: Stefan Monnier Subject: Re: bug#73538: [PATCH] Add notifications support to 'mpc' In-Reply-To: (Stefan Monnier's message of "Thu, 17 Oct 2024 12:43:45 -0400") References: <87frpjtmx6.fsf@pub.pink> <87r08lwhi1.fsf@pub.pink> User-Agent: mu4e 1.12.1; emacs 31.0.50 Date: Thu, 17 Oct 2024 19:26:03 -0500 Message-ID: <87froup884.fsf@pub.pink> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 73538-done Cc: 73538-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan Monnier writes: >> Here=E2=80=99s an updated patch. Should have all feedback incorporated a= nd >> now with a NEWS entry. > > Thanks, merged into `master` (after which I installed some further tweaks= ). Thanks for your time. I=E2=80=99ll have another one for you to look at soonish. >>> Question: Why is it interactive? >> I have a global mpc-minor-mode that adds a key binding for >> notifications and it must have bled through. > > =F0=9F=99=82 > >> Instead of changing mpc-format I made the customizable variables >> take a list of specs where the first element to return something >> interesting is used and a plain string can be added for fallback: >> >> (setopt mcp-notifications-body-specs >> '("%{Artist}" "%{AlbumArtist}" "Unknown Artist")) >> >> I added your description of the FORMAT-SPEC to the mpc-format >> docstring too. > > I tweaked the docstring a bit further. Regarding the > `mpc-notifications-body/title`, the problem I can see with it is that > the "conditionality" is based on the fact that the overall result is > an empty string, so you can use something like > > (setopt mcp-notifications-body > '("By %{Artist}" "By %{AlbumArtist}" "Unknown Artist")) > > since the first will expand to the non-empty "By ". =F0=9F=99=81 Whoops. I was trying to mimic how other players do it and overlooked that possibility since I don=E2=80=99t think I=E2=80=99ve ever s= een something like that. I guess there is still the chance to tweak it in time for 31 in case the complaints come pouring in. From unknown Sun Aug 10 16:46:47 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 15 Nov 2024 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator