From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: BIKESHED: completion faces Date: Wed, 6 Nov 2019 15:31:09 +0000 Message-ID: References: <4c5631d4-9dfd-04c6-c573-b83c67fcc2fa@yandex.ru> <87pni7p83l.fsf@gmail.com> <87h83ipoi0.fsf@gmail.com> <3f7afc8e-b3d1-07a4-9350-3bfc5775ba21@yandex.ru> <87sgn1yl4b.fsf@gmail.com> <87bltp1eug.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000097bd4a0596af3d06" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="127025"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Stefan Monnier , emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 06 16:31:32 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iSNHP-000WnT-A9 for ged-emacs-devel@m.gmane.org; Wed, 06 Nov 2019 16:31:31 +0100 Original-Received: from localhost ([::1]:60124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSNHO-0005do-3b for ged-emacs-devel@m.gmane.org; Wed, 06 Nov 2019 10:31:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45177) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSNHH-0005dX-0C for emacs-devel@gnu.org; Wed, 06 Nov 2019 10:31:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iSNHF-000631-Hw for emacs-devel@gnu.org; Wed, 06 Nov 2019 10:31:22 -0500 Original-Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:45757) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iSNHF-00062e-CR for emacs-devel@gnu.org; Wed, 06 Nov 2019 10:31:21 -0500 Original-Received: by mail-il1-x134.google.com with SMTP id o18so9970987ils.12 for ; Wed, 06 Nov 2019 07:31:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q190wbl6EBRgC9Vfh/HYxepX6tRrBpsHOdYpHwUzy/8=; b=SZ5Im6I0b+pUz45AKewXu7U83yIC5TikbK0BcNHle8xW8rpWK8R2IU4rcODbxLllpX MUM/N3Vp4Drp1qlOEjsT5OG6ehomSouqZI7ufAfxt8LBAyHiEJwjUuDEpb5Qb4QLakrW A8/Gnqwf0/VLOLAmeqEnD+wd3obg3d6zij56iMdTo2BWC+n6rVliAnn2alPKv5HF/w1E 0HFiJkylfkZQf7dUYK9FxnMYE5x4/K9UqVorRO+Sj0YWK33cEUYtISmjaPbnRg3XLpqk R2O+bMCl1xLSYfncv2kYzgW3T7Kd2InzLO2wXT2JndpyZTp09vPOKBfE+FWEWe6Civ9D 0R8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q190wbl6EBRgC9Vfh/HYxepX6tRrBpsHOdYpHwUzy/8=; b=UG56kPP2RfxX5bTSF84W6GVbhT/eIGib72iCtXEJxLxeNce2XVmgjLruLi9HxR0ZcL VHUJPxiohqv7nY1jRhH4hjZfjXRqXzIqD/1amlX/nfKB44dlvXxOM/H+M/Bhdsn5hDST Uuj1jrjGbvTxjSXDSea8d6yeculrq4C5c+URF0ljoDxri89dK8qmffqKiWkUDWfJzXsW rJp0w2/eNauLmo1RRI+B9wA24d/e3ESvoWSV1YfdwE3uKSxPjuy45hff32DWB9bNZ3iQ 02fp8Zx/wYE2vj78B2AjmN3ainVK5vyjNATJt7BU1v4Ya3aLdNsP19v7DiqO6Rg1BSsR 8/UA== X-Gm-Message-State: APjAAAWjuQstZ8xRgybClWgP6mbpEjHT9SmPB3LXWIYBYbfG+acGekhc YQxgQ2PcbC0Eybhm4E8XUQrmv69dnDuaal2Kvhg= X-Google-Smtp-Source: APXvYqwJzHyoTHu79cOujm2AD3d92eG7e03aHo4WzVSTwxXpc6SPV6JPgwX4KESPd0v2QiW2ydF+7v9nCN8dVHuspWE= X-Received: by 2002:a92:dd88:: with SMTP id g8mr3292276iln.199.1573054280348; Wed, 06 Nov 2019 07:31:20 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::134 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:241853 Archived-At: --00000000000097bd4a0596af3d06 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 6, 2019 at 3:11 PM Dmitry Gutov wrote: > OK, thank you. I'm sorry to say, it's too convoluted for my liking. But > others' opinions are welcome. Really, you think the patch below is "convoluted"? Jo=C3=A3o? diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 43dd277a2e..c202863ee0 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1682,14 +1682,19 @@ completion-setup-hook The completion list buffer is available as the value of `standard-output'. See also `display-completion-list'.") -(defface completions-first-difference +(defface completions-emphasis '((t (:inherit bold))) - "Face for the first character after point in completions. -See also the face `completions-common-part'.") + "Primary face for highlighting important parts of completions. +See also the face `completions-secondary-emphasis'.") -(defface completions-common-part '((t nil)) - "Face for the parts of completions which matched the pattern. -See also the face `completions-first-difference'.") +(defface completions-secondary-emphasis '((t nil)) + "Secondary face for highlighting important parts of completions. +See also the face `completions-emphasis'.") + +(define-obsolete-face-alias + 'completions-first-difference 'completion-emphasis "27.1") +(define-obsolete-face-alias + 'completions-common-part 'completion-secondary-emphasis "27.1") (defun completion-hilit-commonality (completions prefix-len &optional base-size) "Apply font-lock highlighting to a list of completions, COMPLETIONS. @@ -1721,11 +1726,11 @@ completion-hilit-commonality ;; values, all-completions may return strings ;; that don't contain the prefix. (min com-str-len (length str)) - 'face 'completions-common-part str) + 'face 'completions-secondary-emphasis str) (if (> (length str) com-str-len) (font-lock-prepend-text-property com-str-len (1+ com-str-len) 'face - 'completions-first-difference + 'completions-emphasis str))) elem) completions) @@ -3145,16 +3150,16 @@ completion-pcm--hilit-commonality (while md (funcall update-score start (car md)) (put-text-property start (pop md) - 'font-lock-face 'completions-common-part + 'font-lock-face 'completions-emphasis str) (setq start (pop md))) (funcall update-score len len) (put-text-property start end - 'font-lock-face 'completions-common-part + 'font-lock-face 'completions-emphasis str) (if (> (length str) pos) (put-text-property pos (1+ pos) - 'font-lock-face 'completions-first-difference + 'font-lock-face 'completions-secondary-emphasis str)) (unless (zerop (length str)) (put-text-property --00000000000097bd4a0596af3d06 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Nov 6, 2019 at 3:11 PM Dmitry Gutov <dgutov@yandex.ru> wrote:

> OK, t= hank you. I'm sorry to say, it's too convoluted for my liking. But<= br>
> others' opinions are welcome.

Rea= lly, you think the patch below is "convoluted"?

Jo=C3=A3o?

diff --git a/lisp/minibuffer.el = b/lisp/minibuffer.el
index 43dd277a2e..c202863ee0 100644
--- a/lisp/m= inibuffer.el
+++ b/lisp/minibuffer.el
@@ -1682,14 +1682,19 @@ complet= ion-setup-hook
=C2=A0The completion list buffer is available as the valu= e of `standard-output'.
=C2=A0See also `display-completion-list'= .")
=C2=A0
-(defface completions-first-difference
+(defface c= ompletions-emphasis
=C2=A0 =C2=A0'((t (:inherit bold)))
- =C2=A0&= quot;Face for the first character after point in completions.
-See also = the face `completions-common-part'.")
+ =C2=A0"Primary fac= e for highlighting important parts of completions.
+See also the face `c= ompletions-secondary-emphasis'.")
=C2=A0
-(defface completio= ns-common-part '((t nil))
- =C2=A0"Face for the parts of comple= tions which matched the pattern.
-See also the face `completions-first-d= ifference'.")
+(defface completions-secondary-emphasis '((t= nil))
+ =C2=A0"Secondary face for highlighting important parts of = completions.
+See also the face `completions-emphasis'.")
+<= br>+(define-obsolete-face-alias
+ =C2=A0'completions-first-differenc= e 'completion-emphasis "27.1")
+(define-obsolete-face-alia= s
+ =C2=A0'completions-common-part 'completion-secondary-emphasi= s "27.1")
=C2=A0
=C2=A0(defun completion-hilit-commonality = (completions prefix-len &optional base-size)
=C2=A0 =C2=A0"Appl= y font-lock highlighting to a list of completions, COMPLETIONS.
@@ -1721= ,11 +1726,11 @@ completion-hilit-commonality
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 ;; values, all-completions may return strings
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; that don't contain the= prefix.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (min com-str-l= en (length str))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 'face &= #39;completions-common-part str)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 'face 'completions-secondary-emphasis str)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (> (length str) com-str-len)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(font-lock-pr= epend-text-property com-str-len (1+ com-str-len)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 'face
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 'completions-first-difference=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 'completions-emphasis
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 str)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0elem)
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0completions)
@@ -3145,16 +3150,16 @@ completi= on-pcm--hilit-commonality
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (whi= le md
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (funcall update-s= core start (car md))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (p= ut-text-property start (pop md)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&#= 39;font-lock-face 'completions-common-part
+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0'font-lock-face 'completions-emphasis
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0str)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (setq start (pop md)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (funcall update-score len len)
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 (put-text-property start end
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0'font-lock-face 'completions-common-part
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0'font-lock-face 'completions-emphasis
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0str)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (if (> (length str) pos)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (put-text-property pos (1+ pos)
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0'font-lock-face 'completions-first-diffe= rence
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'font-lock-face = 'completions-secondary-emphasis
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0str))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless= (zerop (length str))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= put-text-property
--00000000000097bd4a0596af3d06--