Subject: bug#73868: [PATCH] Fix naming of buffers for tags ending in Y in 'mpc'

From: john muhl <[email-masked]>
Date: Fri, 18 Oct 2024 14:05:24 -0500

Tags: patch

While trying to track down bug#41493 I noticed that the buffer for
the Directory tag was named *MPC Directorys*. This changes buffer
creation to use mpc-tagbrowser-tag-name instead of just adding an
S to the end.

>From e5a1ed0cf2bb8f4826918436bab9babab9d79d41 Mon Sep 17 00:00:00 2001
From: john muhl <[email-masked]>
Date: Tue, 8 Oct 2024 12:24:27 -0500
Subject: [PATCH] Fix naming of buffers for tags ending in Y in 'mpc'

* lisp/mpc.el (mpc-tagbrowser-buf): Use 'mpc-tagbrowser-tag-name'
to ensure buffers corresponding to tags that end in Y are
correctly pluralized; e.g. the tag "Directory" should create a
buffer named "*MPC Directories*" not "*MPC Directorys".
---
 lisp/mpc.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/mpc.el b/lisp/mpc.el
index 9c0bbaaa0f2..ae6a40f9983 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -1572,9 +1572,10 @@ mpc-tagbrowser-tag-name
    (t (concat (symbol-name tag) "s"))))
 
 (defun mpc-tagbrowser-buf (tag)
-  (let ((buf (mpc-proc-buffer (mpc-proc) tag)))
+  (let ((buf (mpc-proc-buffer (mpc-proc) tag))
+        (tag-name (mpc-tagbrowser-tag-name tag)))
     (if (buffer-live-p buf) buf
-      (setq buf (get-buffer-create (format "*MPC %ss*" tag)))
+      (setq buf (get-buffer-create (format "*MPC %s*" tag-name)))
       (mpc-proc-buffer (mpc-proc) tag buf)
       (with-current-buffer buf
         (let ((inhibit-read-only t))
@@ -1585,7 +1586,7 @@ mpc-tagbrowser-buf
           (insert mpc-tagbrowser-all-name "\n"))
         (forward-line -1)
         (setq mpc-tag tag)
-        (setq mpc-tag-name (mpc-tagbrowser-tag-name tag))
+        (setq mpc-tag-name tag-name)
         (mpc-tagbrowser-all-select)
         (mpc-tagbrowser-refresh)
         buf))))
-- 
2.46.2