all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 74362@debbugs.gnu.org
Subject: bug#74362: 31.0.50; Add completions for font names
Date: Sat, 16 Nov 2024 10:12:21 -0500	[thread overview]
Message-ID: <jwvwmh3p6o3.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <865xonipdj.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 16 Nov 2024 09:55:52 +0200")

>> > Also, the doc string of customize-face should be amended to say that
>> > it offers completion on fonts.
>> Hmm... the docstring currently doesn't describe the UI at all (and
>> I can't think of a reason why it should).  Similarly the manual doesn't
>> seem to describe any part of the UI of `customize-face`.
>> Apparently, we presume the UI is self-explanatory.  If we want to fix
>> that, I think it's beyond the scope of this patch submission.
> How about mentioning the completion in the help-echo of this field?

I don't understand why you'd want that, so I don't know how it should be
phrased.  Can you point to some other help-echo which states such
a thing, for inspiration?

> Btw, could set-face-font also benefit from this improvement?

AFAICT `set-face-font` already has its own completion.

> Btw^2: When we select a font, do we have to change the Foundry as
> well?  Or does Emacs disregard any non-matching foundries (if, for
> example, the selected Family is not available with the specified
> Foundry)?

I can't remember the last time I used the foundry attribute, so you're
asking the wrong guy, sorry.  In my corner of the world, font foundries
are simply never used (and the info I can find about foundries of
installed fonts on my system is weird/poor(?), with non-descript names
suggesting nobody else cares about them).

>> +        ;; Cache the list for a max of 60s.
>> +        (let ((time (float-time)))
>> +         (if (and lastlist (eq (selected-frame) lastframe)
>> +                  (> 60 (- time lasttime)))
> Maybe the 60 thing should be a defvar?

I doubt it's worth the trouble, but if you insist I'll do that.

>> --- 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."))
>
> I'm curious: how come :foreground and :background don't need a
> :completions specifier, and yet they provide completion OOTB?

Because those use the `color` widget defined in `wid-edit.el`:

    (define-widget 'color 'editable-field
      "Choose a color name (with sample)."
      :format "%{%t%}: %v (%{sample%})\n"
      :value-create 'widget-color-value-create
      :size (1+ (apply #'max 13 ; Longest RGB hex string.
                       (mapcar #'length (defined-colors))))
      :tag "Color"
      :value "black"
      :completions (defined-colors)
      :sample-face-get 'widget-color-sample-face-get
      :notify 'widget-color-notify
      :match #'widget-color-match
      :validate #'widget-color-validate
      :action 'widget-color-action)


- Stefan






  reply	other threads:[~2024-11-16 15:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14 22:48 bug#74362: 31.0.50; Add completions for font names Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15  8:39 ` Robert Pluim
2024-11-15 16:50   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 17:38     ` Robert Pluim
2024-11-15 17:48       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 12:24 ` Eli Zaretskii
2024-11-15 17:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16  7:55     ` Eli Zaretskii
2024-11-16 15:12       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-16 16:32         ` Eli Zaretskii
2024-11-17 22:59           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=jwvwmh3p6o3.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=74362@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

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

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

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

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