From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 14 17:49:05 2024 Received: (at submit) by debbugs.gnu.org; 14 Nov 2024 22:49:05 +0000 Received: from localhost ([127.0.0.1]:47663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBie8-0000Ap-S2 for submit@debbugs.gnu.org; Thu, 14 Nov 2024 17:49:05 -0500 Received: from lists.gnu.org ([209.51.188.17]:40492) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBie6-0000Af-BL for submit@debbugs.gnu.org; Thu, 14 Nov 2024 17:49:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBie5-00077r-Aj for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 17:49:01 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBie3-0001LI-4T for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 17:49:00 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E221C100180 for ; Thu, 14 Nov 2024 17:48:55 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731624535; bh=LYs2GwjhZg2qm7lbbxgzdVTN0VdPCWKukBhTrcP7v5M=; h=From:To:Subject:Date:From; b=b41x12lME95+g0wupyswmNxX5Pd16+JyzFzNG4SniFx9tn1AU0a8WZHXWMbYIolwv UkcuO93mxbTQasGxHDmnWF2LxC4GPGLkcHeC0RNWQbPeSgHTF+13vOQmzl2dg2Q8Zu yH+s+qRS0KTPveEbJKHYe8uoyMWnX6dIR6KGEH24txBIQAB1cvNtVrhJgd4eOX9wuy T34QIe2w364lu3NG0aMbnbFPcByYxkoKt2ISTfKlT/EMTf5D6cGGpOfHYxRusoVh14 7PDIjE4elaE13bgU5n4Kd4YRC+rXE2wcxdAH3QSUllMV/jwiDIW1hIsxYFAig46Jbv 6L3KfnHtgNaOQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0EBB5100043 for ; Thu, 14 Nov 2024 17:48:55 -0500 (EST) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id EC6041202F2 for ; Thu, 14 Nov 2024 17:48:54 -0500 (EST) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: 31.0.50; Add completions for font names Message-ID: X-Debbugs-Cc: monnier@iro.umontreal.ca Date: Thu, 14 Nov 2024 17:48:54 -0500 MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.016 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 15 03:40:39 2024 Received: (at 74362) by debbugs.gnu.org; 15 Nov 2024 08:40:39 +0000 Received: from localhost ([127.0.0.1]:48502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBrsd-0000s7-4l for submit@debbugs.gnu.org; Fri, 15 Nov 2024 03:40:39 -0500 Received: from mail-wr1-f50.google.com ([209.85.221.50]:61605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBrsb-0000rt-1Z for 74362@debbugs.gnu.org; Fri, 15 Nov 2024 03:40:37 -0500 Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-37d518f9abcso1043182f8f.2 for <74362@debbugs.gnu.org>; Fri, 15 Nov 2024 00:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731659971; x=1732264771; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=8vTibXY3mWTE0ox0P8EdLMYIN+eBijaV8kzwLqY7fVo=; b=Lem0WT0NJrJJIK2eshloki9TfOTrSHxigEkdjWY9Va2xXO+sIIsL35L4K35yg+bZOa arfTcn+tIzjCqa3or1SEkW/P8ypW+FhMMU2a18lI4zkA280ctehuRFsT8+g9q+mQo+kg 5Y9uBZ5gmgg0TI8mHB9giF+GbloIDkozv/6gneDcpnX0ePnp+UmvIE4f+07yi/d9Wzca C2+gFbRPra1sCB4otvq5sES3UtwAwTer00joKjmxV3qMfE/m+BdMzuaj0mvcBFu0uu1s ohhKP41Q8+3AzSlr1DZbFx6FlN7i6/8riohlFGI70EuF2J3i1oLB7Kyo5dZT1OdiQRUJ hKAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731659971; x=1732264771; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8vTibXY3mWTE0ox0P8EdLMYIN+eBijaV8kzwLqY7fVo=; b=ZgfghI+tDDuAoO+n02cL3opWEzxPpEZw71xyq9Q/enE0hksPMb5oDfgRplWBcgSyeX W2Xvlplnv4swfhgWkBt236Suy/gb/R9WL+0+Vfbg1oM0HlxW6CSp2SeQsDZ1gMVOfEGM k6Q/j2YB0nCAmDWF9n4a5Z6+V9iNQn4anZ2LAImum3BOfOdUCv2/cUSzgUsJW7YwkL9F 34RhO3EajC/fca6UcZb1Lgf07ujWT/31lUKy1A14bUpMrbvNfeEGBeWOs1ogSDVYCY8q veEoevFXLjPCyqk6pe+I5kOXhfkTFjgNrR/6/Ahff9eDcB4Wwn+dUn/IIyxG/7q9SN3t pmvg== X-Gm-Message-State: AOJu0YzowxaKZkSOdBrtH5r+6KGVKSvIyygAo6jhp1aGculkscgfEpPT aGHRpAmgPZVpJt1zLvHHQwTmtJxDrfTJUZkg1aTWk6bf/UKlUmJsw2KyRw== X-Google-Smtp-Source: AGHT+IG9sZlUKCnWiJw/5LKJFBwejIP00ZQiSA+aaBPsWwjjsVBLk167YUDRYC/PqISZoRtpvtSlJw== X-Received: by 2002:a5d:5f49:0:b0:374:c92e:f69f with SMTP id ffacd0b85a97d-38225a07313mr1577360f8f.16.1731659970875; Fri, 15 Nov 2024 00:39:30 -0800 (PST) Received: from rltb ([2a01:e0a:3f3:fb51:e339:35d5:c198:d4da]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adad93asm3728987f8f.26.2024.11.15.00.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 00:39:30 -0800 (PST) From: Robert Pluim To: 74362@debbugs.gnu.org Subject: Re: bug#74362: 31.0.50; Add completions for font names In-Reply-To: (Stefan Monnier via's message of "Thu, 14 Nov 2024 17:48:54 -0500") References: Date: Fri, 15 Nov 2024 09:39:29 +0100 Message-ID: <87cyiwq4am.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 74362 Cc: Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>>>> On Thu, 14 Nov 2024 17:48:54 -0500, Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" said: Stefan> Package: Emacs Stefan> Version: 31.0.50 Stefan> In the UI of `customize-face`, the font family name is the main one that Stefan> provides no help to fill it. Stefan> The simple patch below provides completion (I had to put the completion Stefan> function in `cus-edit.el` because of a circularity between Stefan> `cus-face.el` and `minibuffer.el` so we can't call Stefan> `completion-table-dynamic` while loading `cus-face.el`). Stefan> Comments/objections? You have trailing whitespace. Also it would be better if this was wrapped in `completion-table-case-fold', I think (everyone disagrees on how to write "mono"). Robert -- From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 15 07:24:46 2024 Received: (at 74362) by debbugs.gnu.org; 15 Nov 2024 12:24:46 +0000 Received: from localhost ([127.0.0.1]:48914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBvNV-00027Z-Pw for submit@debbugs.gnu.org; Fri, 15 Nov 2024 07:24:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBvNT-00027L-91 for 74362@debbugs.gnu.org; Fri, 15 Nov 2024 07:24:44 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBvNM-0002k3-GB; Fri, 15 Nov 2024 07:24:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=oQ/SRx0cvP+6/TNqQ70hR9Hn4z1HWhrMEyVj8LwiqmQ=; b=VnYHI3jxuIJJ BfLrOQ99+a4CyfS9pbDkFlB9zyMpF+nJH8S+DtcBQVzDC0EIyrLsDyJAj3VLSAs/nYORg7x0rbVJj 9x2tkdSvGip7OCT1rnxNTEeDOCESGs1bphONXG23OLGkXwDCR5U4FC2z4P5Cfh2VyHH0R3hqBfgy7 BpDDNtRiosnD7XldtaWrbbFgjvMowgqKGswGkBrsgSGHTUi53IzIDzVQmxcYl77+hDz/r0fNaY86r PRXPX0Q/RDNrqruYJ/n7sCwpI5CkOemahvj/Rv94h447FJxl11V3+uVFd9ZwQFxdJ9A8pOtVZafAb pvyt3pD/0VQ3TMpkHZVfqQ==; Date: Fri, 15 Nov 2024 14:24:34 +0200 Message-Id: <86iksoit19.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#74362: 31.0.50; Add completions for font names References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74362 Cc: 74362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: monnier@iro.umontreal.ca > Date: Thu, 14 Nov 2024 17:48:54 -0500 > From: Stefan Monnier via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > 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? I suggest to try this on a system that has a lot of fonts installed, to make sure this doesn't slow down customize-face too much. In bug#74337 a user reported that font-family-list returned a list of no fewer than 10775(!) families. I wonder what will that do to this command. Also, the doc string of customize-face should be amended to say that it offers completion on fonts. Btw, how does one invoke completion on the face attributes which are supposed to provide one, such as weight or colors? M-C-i doesn't seem to do it for me, or what am I missing? From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 15 11:50:25 2024 Received: (at 74362) by debbugs.gnu.org; 15 Nov 2024 16:50:25 +0000 Received: from localhost ([127.0.0.1]:50686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBzWb-0005jl-63 for submit@debbugs.gnu.org; Fri, 15 Nov 2024 11:50:25 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBzWY-0005jW-7i for 74362@debbugs.gnu.org; Fri, 15 Nov 2024 11:50:23 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0A53B8099D; Fri, 15 Nov 2024 11:50:16 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731689415; bh=h6q7SG/PeBN4SdkZcBs5p9HtS9WMg7aplhvESwmVB7s=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=FhL5tKVwa6pZq4hiQgNtheKTw9eU2Ee327416vGQOZa946D7tw3aN7e770d4WjxiB FRyicgyteF7upLyRh/Wc8SXsIHXvR66LCYvQ0bKK8LypJ6Vb1WGI3YkXKwAoogIAwX AaksFp6sB1qKqIDtHOahoa+aG0pIluqmc/murTJPzQXl0MLo+YmevktRZ5hO0p1h7S gB0Bo5Iu8E8GzVdw6YnACqzFfurezXD3yEoWZHs7Mw9pf+kG+wdOHo347hD9WlAbs7 s4YGCsPOWYVyUt5W0BQ/GncTBUvtulTC+HO4OOvBgAvy/Gq9CZe0i+kQDOQ3GpIY4b UtQBe42/hutfA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0731780796; Fri, 15 Nov 2024 11:50:15 -0500 (EST) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E1D81120434; Fri, 15 Nov 2024 11:50:14 -0500 (EST) From: Stefan Monnier To: Robert Pluim Subject: Re: bug#74362: 31.0.50; Add completions for font names In-Reply-To: <87cyiwq4am.fsf@gmail.com> (Robert Pluim's message of "Fri, 15 Nov 2024 09:39:29 +0100") Message-ID: References: <87cyiwq4am.fsf@gmail.com> Date: Fri, 15 Nov 2024 11:50:14 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.057 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74362 Cc: 74362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > You have trailing whitespace. Thanks. =F0=9F=99=82 > Also it would be better if this was wrapped in > `completion-table-case-fold', I think (everyone disagrees on how to > write "mono"). So you're saying font family names are case-insensitive? I was wondering about that and couldn't find it documented anywhere. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 15 12:33:24 2024 Received: (at 74362) by debbugs.gnu.org; 15 Nov 2024 17:33:25 +0000 Received: from localhost ([127.0.0.1]:50757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC0CC-0007ah-GJ for submit@debbugs.gnu.org; Fri, 15 Nov 2024 12:33:24 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:57733) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC0CA-0007aU-HF for 74362@debbugs.gnu.org; Fri, 15 Nov 2024 12:33:23 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 46E1C809C2; Fri, 15 Nov 2024 12:33:16 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731691995; bh=mXf+0Dgeq3TvCizJlJQaeo4lBgWJjTUeavZDx0XC+Zc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jGAQUzRQEOafL5iPaX+q92L9OB/LtE7MPuct4byosw7gCIYOp6mwYZJQigEODT5D5 qION3QUCzxAgnZn2wXd3fub6yF6pHuyWUHW4GvNQ5Xoi0D/TFkJTPb7PHjrJ3+3kwg VDBIs5mjxnxUXlTFocUFJgNTNA9dZnxEpCm/XzYBqeYwO7aqboTyJilcmrvNwWd6aN WJccMwt5Exfqp+yGLtL9SZpiPgBfWfIExStYfzTTeihG+yBp1lC8wiz9I/nPWapHg3 0EPm+64wGJmNHCPJgfPWFPo4cV2NssX2Q/O5U06q8yLVurK63/9fS1EHJUHlp77TsW 9eOaSXBGdueWw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 425A18092E; Fri, 15 Nov 2024 12:33:15 -0500 (EST) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1B00F12023A; Fri, 15 Nov 2024 12:33:15 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#74362: 31.0.50; Add completions for font names In-Reply-To: <86iksoit19.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Nov 2024 14:24:34 +0200") Message-ID: References: <86iksoit19.fsf@gnu.org> Date: Fri, 15 Nov 2024 12:33:14 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.056 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74362 Cc: 74362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain >> Comments/objections? > > I suggest to try this on a system that has a lot of fonts installed, I don't have such a thing. My `font-family-list` has only 1k entries. But I tried it with `corfu-mode` on a slow build (debug + enable-checking) and I did not see any lag even though it presumably rebuilds the list after each character I type. This said, clearly, there is room for improvement via caching, so the new patch below does that. > to make sure this doesn't slow down customize-face too much. It should make no difference in general: the list of completions is computed only when a completion is actually requested on that field. > 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. > Btw, how does one invoke completion on the face attributes which are > supposed to provide one, such as weight or colors? M-C-i doesn't seem > to do it for me, or what am I missing? M-TAB worked for me on the "Foregound" color name field. For weights, I see a menu rather than a text field so there doesn't seem to be a "completion" option. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=font-completion.patch 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 15 12:39:36 2024 Received: (at 74362) by debbugs.gnu.org; 15 Nov 2024 17:39:36 +0000 Received: from localhost ([127.0.0.1]:50764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC0IC-0007on-E6 for submit@debbugs.gnu.org; Fri, 15 Nov 2024 12:39:36 -0500 Received: from mail-lf1-f44.google.com ([209.85.167.44]:60447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC0IA-0007oa-NW for 74362@debbugs.gnu.org; Fri, 15 Nov 2024 12:39:35 -0500 Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-539e59dadebso2446697e87.0 for <74362@debbugs.gnu.org>; Fri, 15 Nov 2024 09:39:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731692308; x=1732297108; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Oe/v1XtlCF3NzjPhx2fPVYSwIlx29gpho2tqnZpZlSM=; b=IlvWinGQ6dLenBM/LfJHZ/epCABhq34eyyB7k54BObkYvfx5Uy1tPkpFiUYHgYWTd5 yb3fa26R3TLQCkFw50feejF16A24woxOcC2K6w3R/1+V7ubEh6bJCZWabLjC0cNxokbM V04xrlVQTLrAEy9pPY7K898o3kGZp6LcNp8gk6+YaGyKrNrvwMGk+nM46g6WxrzP55wA 31vjht2qPUpuh72HZk/vWsWa/n+dMtkl4nfg9VkpOqYX3F9cqTlvbtrI1u6YRM5SsivH wgPHVXEqbk/wiPGl0rbeVozVb0eh4WGxgYSZvj8S7ajPiTetz3vUVsn4P+FGrzDDlqeK kWrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731692308; x=1732297108; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Oe/v1XtlCF3NzjPhx2fPVYSwIlx29gpho2tqnZpZlSM=; b=adrKke0sGQR40aMUE7+eNWWlz4081i6sb7zPB+HuaGVZ81nIa3W6h4cJvS0rFrOiJu yY2UhpdeSldNzzA+uq0CATYriIVuRWMoBmmP9Bx/uzORtcJKdCViUxqOMp3tXG5kFMxs 0oPs9hVQ21/DCtNiGjLkT/8ViXSk0YELUXUePw+OBV4X1NrkG46zTVC53TU6ocKm8KLs pH9eEiF8V/6c4iQusLxPszH5qNV1peMvm8cABMSm9EXyBzwRJVoTMneNB7GPbCGk6M++ bYEoxCVEZWho0YHdJUug/9iJj6oUyyRZAEGTMlEewugKxf3+V/AwUO7d+dZFaFLltA5D Larw== X-Gm-Message-State: AOJu0Yw+HpgWGkWfQaWQ8I+X+Y3LY3QKtKPgYpVwAEwloe8wgOc2isrF XcXcL/ntYqjEtSO4Wm4q64UUL5/AtZY0/FECCL6s4wajayIuUuJLA8gz3g== X-Google-Smtp-Source: AGHT+IGIVsUd3jpDwbZr3hy88Icu0mF0K9wBQLcgEqqNxluKbVkqJ9HjBSq4ciAUvpu/zoqbbrPZoA== X-Received: by 2002:a05:6512:1327:b0:539:eb2f:a026 with SMTP id 2adb3069b0e04-53dab2ab670mr1810138e87.33.1731692308069; Fri, 15 Nov 2024 09:38:28 -0800 (PST) Received: from rltb ([2a01:e0a:3f3:fb51:e339:35d5:c198:d4da]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432d48baa42sm73778665e9.1.2024.11.15.09.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 09:38:27 -0800 (PST) From: Robert Pluim To: Stefan Monnier Subject: Re: bug#74362: 31.0.50; Add completions for font names In-Reply-To: (Stefan Monnier's message of "Fri, 15 Nov 2024 11:50:14 -0500") References: <87cyiwq4am.fsf@gmail.com> Date: Fri, 15 Nov 2024 18:38:25 +0100 Message-ID: <878qtkpfce.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 74362 Cc: 74362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>>>> On Fri, 15 Nov 2024 11:50:14 -0500, Stefan Monnier said: Stefan> So you're saying font family names are case-insensitive? Stefan> I was wondering about that and couldn't find it documented anyw= here. No, I=CA=BCm saying that the interface to select them should be case-insensitive. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 15 12:48:15 2024 Received: (at 74362) by debbugs.gnu.org; 15 Nov 2024 17:48:15 +0000 Received: from localhost ([127.0.0.1]:50776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC0QZ-0008D6-CO for submit@debbugs.gnu.org; Fri, 15 Nov 2024 12:48:15 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:63977) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC0QX-0008Ct-Dn for 74362@debbugs.gnu.org; Fri, 15 Nov 2024 12:48:14 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 696661001DE; Fri, 15 Nov 2024 12:48:07 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731692886; bh=4vNGecog7AQ63jS3zNgBKoeSTjW8NREcc2x4yDMi15U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=VuWd7Xqj6VW8wGzTSJG/Afudq6G7e/X2ePHcdy8KvXAd1Dfyhe7lwkl/Tdzzs63di +hf69tKDw41giswLCs6tr/+/azJ0zeeQVyWJ3gne86OaVf9z4lIH1i17FE9IPyM4t4 AddBp7qSYXaDxGcnDxjT1RFFYhrBg6ITC4NOHA98aTVOixJL8si2Db390RurH126hy GvedByJ3Mh0E7FOmyaE/qxZCqpDHVWX+Csnp4LHyu7NWstuDmad/zJbpPWLuSMD5yH mjRrIQZSDxPG2WFIWxjLMTJ7IRI83HXBTguteqlB8AqisQyHP8DeqjB+IeFD6OAQuO IOj0P1AplXlwA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B9708100055; Fri, 15 Nov 2024 12:48:06 -0500 (EST) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9E8641202FD; Fri, 15 Nov 2024 12:48:06 -0500 (EST) From: Stefan Monnier To: Robert Pluim Subject: Re: bug#74362: 31.0.50; Add completions for font names In-Reply-To: <878qtkpfce.fsf@gmail.com> (Robert Pluim's message of "Fri, 15 Nov 2024 18:38:25 +0100") Message-ID: References: <87cyiwq4am.fsf@gmail.com> <878qtkpfce.fsf@gmail.com> Date: Fri, 15 Nov 2024 12:48:05 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.015 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74362 Cc: 74362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >>>>>> On Fri, 15 Nov 2024 11:50:14 -0500, Stefan Monnier said: > Stefan> So you're saying font family names are case-insensitive? > Stefan> I was wondering about that and couldn't find it documented an= ywhere. > No, I=CA=BCm saying that the interface to select them should be > case-insensitive. I see, my last patch does use `completion-table-case-fold` so I think it does provide the behavior you're asking for. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 16 02:56:03 2024 Received: (at 74362) by debbugs.gnu.org; 16 Nov 2024 07:56:03 +0000 Received: from localhost ([127.0.0.1]:51976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCDf1-00047r-4W for submit@debbugs.gnu.org; Sat, 16 Nov 2024 02:56:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCDey-00047F-M8 for 74362@debbugs.gnu.org; Sat, 16 Nov 2024 02:56:02 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCDes-0006LG-C7; Sat, 16 Nov 2024 02:55:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JdKbrPSlfY5il7f7zW5YzIccDZxXnXVHiqoglmw0NkQ=; b=AwmgpMUu3NjS Pp2HaxjfBE7xJf5KZDUFpE3+Ycc7crOyFcCnvAdN74ZE/ZqxPOjRnoWTynVy1NlrNAi7MQI6xHR8b +lulSc1japVs68wF75r6YByH6Xe5HMybUJXNAS35p1ZMcKqUaUVD2iRFnMxXVhpzPwszo9dDIWu+H 2/9l6Yz26fAiYSHoWgt6J2UgoPXOm+zIkyDKwbmzG6q4imlwsZOT8o+LvFF6AB5EJYk2RX40CcLF/ QAB3tYEQAJDlZql/TvcsvubZzf6rv29JlDoL3LaxWVrfcXcZlaDkpIh5sb1BZ/+8ujSpEAvTMLPnX gTjrykWGWveRC4IQKhTSlw==; Date: Sat, 16 Nov 2024 09:55:52 +0200 Message-Id: <865xonipdj.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Fri, 15 Nov 2024 12:33:14 -0500) Subject: Re: bug#74362: 31.0.50; Add completions for font names References: <86iksoit19.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74362 Cc: 74362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 74362@debbugs.gnu.org > Date: Fri, 15 Nov 2024 12:33:14 -0500 > > > 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? Btw, could set-face-font also benefit from this improvement? > > Btw, how does one invoke completion on the face attributes which are > > supposed to provide one, such as weight or colors? M-C-i doesn't seem > > to do it for me, or what am I missing? > > M-TAB worked for me on the "Foregound" color name field. > For weights, I see a menu rather than a text field so there doesn't seem > to be a "completion" option. Right. 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)? > + ;; 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? > --- 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? From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 16 10:12:34 2024 Received: (at 74362) by debbugs.gnu.org; 16 Nov 2024 15:12:34 +0000 Received: from localhost ([127.0.0.1]:54349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCKTR-00082e-TL for submit@debbugs.gnu.org; Sat, 16 Nov 2024 10:12:34 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44207) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCKTQ-00082R-AH for 74362@debbugs.gnu.org; Sat, 16 Nov 2024 10:12:33 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9E249442C11; Sat, 16 Nov 2024 10:12:24 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731769943; bh=DkBIwe9QeGwVHYBxyvxUR9SzNmB2X8ip8Rb/klxT8GQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fOwzp/tEbXO+N8rmL7HjC89a4A70u/iE98r5rhRO4AWc8eyacRvCCxs3KihDygSqW HRQn94VbR/WwtmB22jbxxYYK8xbZ0U5tkTBMcggUOfUV6z10n9r1Oc32awfN/lG9Eb KyEHbSLTgjk74n5SEY3h4HmfuIXOSrEhm4ykdI93tf03hG+EF9yNwMEwmMWcuJwnPV 4osT699QBgCq5CtdmafO9vVAc92kOMMvU0zO2jqTTPpTXBssW2YDZzILVokHDDhv4e CH38jJhhRJy88On7qGFgD14PjWJB3I+euWgiGN49uQp51l4WxIAThQNuh26CFJ0O6M TkB0KHs2khs1Q== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 506E0442C0E; Sat, 16 Nov 2024 10:12:23 -0500 (EST) Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 253121205CC; Sat, 16 Nov 2024 10:12:23 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#74362: 31.0.50; Add completions for font names In-Reply-To: <865xonipdj.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 16 Nov 2024 09:55:52 +0200") Message-ID: References: <86iksoit19.fsf@gnu.org> <865xonipdj.fsf@gnu.org> Date: Sat, 16 Nov 2024 10:12:21 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.021 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74362 Cc: 74362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> > 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 16 11:32:44 2024 Received: (at 74362) by debbugs.gnu.org; 16 Nov 2024 16:32:44 +0000 Received: from localhost ([127.0.0.1]:54511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCLj2-0003U1-25 for submit@debbugs.gnu.org; Sat, 16 Nov 2024 11:32:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCLj0-0003Tl-6L for 74362@debbugs.gnu.org; Sat, 16 Nov 2024 11:32:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCLiu-0000DM-OZ; Sat, 16 Nov 2024 11:32:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ISBQ/seQ0VZ8vkL7bfxzKNP+dSe2vbWR6tDMM0OuQe4=; b=izndINHwDSKt Ok+QY0xUhE2WsxjBMnWPFKVNa0vOObqaCnit6ioe5R4JYiU3H9OBz0NiCBmi9Ft70X26eREfUPQtk QuLcvxIJjteShnKKbhVwcd6V7pLu8eW3aHmgsingh+wgX5kLVdUCAfXBi9x9Mkm59ldLHCXUMWn3m baWQzHt3EUgl8M8da8zcFNcMGNAseraP1iFLYeL/uy3kohNFC/db72KR8rVjktbs9c5wcqfEhFP28 Lm0CYhnvAcBMbejamYEFyjnbgGBq405uMn1SzHqH0eIgxtCvI2xZg3/BNDV7rVoH0DCQSdv+G8G3Z RwA6oZCdgj/zRFbiRTfQOQ==; Date: Sat, 16 Nov 2024 18:32:31 +0200 Message-Id: <86wmh3f8bk.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Sat, 16 Nov 2024 10:12:21 -0500) Subject: Re: bug#74362: 31.0.50; Add completions for font names References: <86iksoit19.fsf@gnu.org> <865xonipdj.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74362 Cc: 74362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 74362@debbugs.gnu.org > Date: Sat, 16 Nov 2024 10:12:21 -0500 > > >> > 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? It is unusual, yes. But it is also unusual to expect completion in any such field, since it is not the minibuffer. Anyway, it isn't worth the argument, just forget it. I can make such a change myself if I think it's a good thing. > > Btw, could set-face-font also benefit from this improvement? > > AFAICT `set-face-font` already has its own completion. Right, it just expects an unusual character as the first character of a font's name. > >> + ;; 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. Someone will ask for that even if I don't ;-) > >> + :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`: Got it, thanks. (Maybe we should have a 'font' widget, then, in some distant future.) From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 17 17:59:32 2024 Received: (at 74362-done) by debbugs.gnu.org; 17 Nov 2024 22:59:32 +0000 Received: from localhost ([127.0.0.1]:59039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCoEu-0003ez-2C for submit@debbugs.gnu.org; Sun, 17 Nov 2024 17:59:32 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:26315) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCoEr-0003em-DB for 74362-done@debbugs.gnu.org; Sun, 17 Nov 2024 17:59:30 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CFE69807F5; Sun, 17 Nov 2024 17:59:23 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731884362; bh=HEWENFedGiSqZq6Kv/iIbngbeAuQd9mu62t0y+M1P1E=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=OXeuWudfWUHSbDo/0VWVdOhriInFv7/awns1RUujhRIp/X2+PhLvNYmWq7EaSpbzu VBwalbLBr3nEewAKDjXAj+GAE4PzT8IHcy+y2Fkw6j7RXk5HccQIqMs7A18NJ0RfCA +7v18OQV9/XyavkRX927FyaODGmFoJl14SZ2yUe8MuoF7gEAZtQIELsHokJSVNZk/P a401YHPWc+n65SyBMeKdiqCPVruwDAn1EyIs9F6B7+irQLLtI9HMYLLx85iT2OOC52 2S+os8IDlXToT5+R6nnfCOcPPjVMUsxaohNEkR3WXl7Vgr4L9L114WyGc2lhEkYrxi vTgdpRRUrYfCA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E57D680191; Sun, 17 Nov 2024 17:59:22 -0500 (EST) Received: from alfajor (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BC776120280; Sun, 17 Nov 2024 17:59:22 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#74362: 31.0.50; Add completions for font names In-Reply-To: <86wmh3f8bk.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 16 Nov 2024 18:32:31 +0200") Message-ID: References: <86iksoit19.fsf@gnu.org> <865xonipdj.fsf@gnu.org> <86wmh3f8bk.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Sun, 17 Nov 2024 17:59:22 -0500 MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.012 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74362-done Cc: 74362-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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 From unknown Sat Aug 16 12:43:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 16 Dec 2024 12:24:13 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator