emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master da0f8db: Rework face hints for partial-string completion styles


From: João Távora
Subject: master da0f8db: Rework face hints for partial-string completion styles
Date: Sat, 26 Oct 2019 09:34:20 -0400 (EDT)

branch: master
commit da0f8dbf8fea53da65d1990b3f9f235e4fe3f9e0
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Rework face hints for partial-string completion styles
    
    Don't use completions-first-difference for the 'substring', 'flex' and
    'partial-completion' styles, since there can be really no reasonable
    definition of a "first" difference there.
    
    Make completions-common-part inherit from 'underline' so that it is
    useful by default for all completion styles.
    
    * lisp/minibuffer.el (completions-common-part): Adjust
    description and change default value.
    (completions-first-difference): Ajust docstring.
    (completion-pcm--hilit-commonality): Don't use
    completions-first-difference.
---
 lisp/minibuffer.el | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index b61b366..e7d081e 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1684,15 +1684,14 @@ See also `display-completion-list'.")
 
 (defface completions-first-difference
   '((t (:inherit bold)))
-  "Face for the first uncommon character in completions.
+  "Face for the first uncommon character in prefix completions.
 See also the face `completions-common-part'.")
 
-(defface completions-common-part '((t nil))
-  "Face for the common prefix substring in completions.
-The idea of this face is that you can use it to make the common parts
-less visible than normal, so that the differing parts are emphasized
-by contrast.
-See also the face `completions-first-difference'.")
+(defface completions-common-part '((t (:inherit underline)))
+  "Face for parts of completions matching a pattern.
+You can use it to make the common parts less visible than normal,
+so that the differing parts are emphasized by contrast.  See also
+the face `completions-first-difference'.")
 
 (defun completion-hilit-commonality (completions prefix-len &optional 
base-size)
   "Apply font-lock highlighting to a list of completions, COMPLETIONS.
@@ -3082,8 +3081,7 @@ latter (which has two).")
          (setq str (copy-sequence str))
          (unless (string-match re str)
            (error "Internal error: %s does not match %s" re str))
-         (let* ((pos (if point-idx (match-beginning point-idx) (match-end 0)))
-                (md (match-data))
+         (let* ((md (match-data))
                 (start (pop md))
                 (end (pop md))
                 (len (length str))
@@ -3137,10 +3135,6 @@ latter (which has two).")
            (put-text-property start end
                               'font-lock-face 'completions-common-part
                               str)
-           (if (> (length str) pos)
-               (put-text-property pos (1+ pos)
-                                  'font-lock-face 'completions-first-difference
-                                  str))
            (unless (zerop (length str))
              (put-text-property
               0 1 'completion-score



reply via email to

[Prev in Thread] Current Thread [Next in Thread]