GNU bug report logs - #74362
31.0.50; Add completions for font names

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 14 Nov 2024 22:50:02 UTC

Severity: normal

Found in version 31.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#74362: closed (Re: bug#74362: 31.0.50; Add completions for
 font names)
Date: Sun, 17 Nov 2024 23:00:02 +0000
[Message part 1 (text/plain, inline)]
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 74362 <at> debbugs.gnu.org.

-- 
74362: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74362
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 74362-done <at> debbugs.gnu.org
Subject: Re: bug#74362: 31.0.50; Add completions for font names
Date: Sun, 17 Nov 2024 17:59:22 -0500
> 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


[Message part 3 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Add completions for font names
Date: Thu, 14 Nov 2024 17:48:54 -0500
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




This bug report was last modified 242 days ago.

Previous Next


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