Subject: bug#74362: closed (Re: bug#74362: 31.0.50; Add completions for font names)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 17 Nov 2024 23:00:02 +0000

Your bug report

#74362: 31.0.50; Add completions for font names

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
74362: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74362
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#74362: 31.0.50; Add completions for font names
From: Stefan Monnier <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Sun, 17 Nov 2024 17:59:22 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

> Someone will ask for that even if I don't ;-)

OK, pushed with that and an attempt at mentioning in the help-echo that
completion is available.
Thanks, closing.

>> Because those use the `color` widget defined in `wid-edit.el`:
> Got it, thanks.
> (Maybe we should have a 'font' widget, then, in some distant future.)

It's used a lot less often than color, and there's a lot more variety
(read: complexity) in the notion of "font" so I suspect "distant" is quite right.

        Stefan

Subject: 31.0.50; Add completions for font names
From: Stefan Monnier <[email-masked]>
To: [email-masked]
Date: Thu, 14 Nov 2024 17:48:54 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Package: Emacs
Version: 31.0.50

In the UI of `customize-face`, the font family name is the main one that
provides no help to fill it.
The simple patch below provides completion (I had to put the completion
function in `cus-edit.el` because of a circularity between
`cus-face.el` and `minibuffer.el` so we can't call
`completion-table-dynamic` while loading `cus-face.el`).

Comments/objections?

        Stefan

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 8eba4270bcb..763dfc31fb8 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -3425,6 +3425,12 @@ custom-visibility
 
 ;;; The `custom-face-edit' Widget.
 
+(defalias 'custom-face--font-completion 
+  (completion-table-dynamic
+   (lambda (_string)
+     (nconc (mapcar #'car face-font-family-alternatives)
+            (font-family-list)))))
+
 (define-widget 'custom-face-edit 'checklist
   "Widget for editing face attributes.
 The following properties have special meanings for this widget:
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index d0a1a66e29f..9a0ab4b47c7 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -48,6 +48,7 @@ custom-declare-face
 (defconst custom-face-attributes
   `((:family
      (string :tag "Font Family"
+	     :completions custom-face--font-completion
 	     :help-echo "Font family or fontset alias name."))
 
     (:foundry