diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 8eba4270bcb..0ef52948b39 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -3425,6 +3425,25 @@ custom-visibility ;;; The `custom-face-edit' Widget. +(defalias 'custom-face--font-completion + (let ((lastlist nil) + (lasttime nil) + (lastframe nil)) + (completion-table-case-fold + (completion-table-dynamic + (lambda (_string) + ;; Cache the list for a max of 60s. + (let ((time (float-time))) + (if (and lastlist (eq (selected-frame) lastframe) + (> 60 (- time lasttime))) + lastlist + (message "last list time: %s" (if lasttime (- time lasttime))) + (setq lasttime time) + (setq lastframe (selected-frame)) + (setq lastlist + (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