diff options
| -rw-r--r-- | lisp/minibuffer.el | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 0f6e3518758..baed4edcf89 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -4051,24 +4051,26 @@ details." | |||
| 4051 | 4051 | ||
| 4052 | (defun completion--hilit-from-re (string regexp &optional point-idx) | 4052 | (defun completion--hilit-from-re (string regexp &optional point-idx) |
| 4053 | "Fontify STRING using REGEXP POINT-IDX. | 4053 | "Fontify STRING using REGEXP POINT-IDX. |
| 4054 | `completions-common-part' and `completions-first-difference' are | 4054 | Uses `completions-common-part' and `completions-first-difference' |
| 4055 | used. POINT-IDX is the position of point in the presumed \"PCM\" | 4055 | faces to fontify STRING. |
| 4056 | pattern that was used to generate derive REGEXP from." | 4056 | POINT-IDX is the position of point in the presumed \"PCM\" pattern |
| 4057 | (let* ((md (and regexp (string-match regexp string) (cddr (match-data t)))) | 4057 | from which REGEXP was generated." |
| 4058 | (pos (if point-idx (match-beginning point-idx) (match-end 0))) | 4058 | (let* ((md (and regexp (string-match regexp string) (cddr (match-data t)))) |
| 4059 | (me (and md (match-end 0))) | 4059 | (pos (if point-idx (match-beginning point-idx) (match-end 0))) |
| 4060 | (from 0)) | 4060 | (me (and md (match-end 0))) |
| 4061 | (while md | 4061 | (from 0)) |
| 4062 | (add-face-text-property from (pop md) 'completions-common-part nil string) | 4062 | (while md |
| 4063 | (setq from (pop md))) | 4063 | (add-face-text-property from (pop md) |
| 4064 | (if (> (length string) pos) | 4064 | 'completions-common-part nil string) |
| 4065 | (add-face-text-property | 4065 | (setq from (pop md))) |
| 4066 | pos (1+ pos) | 4066 | (if (and (numberp pos) (> (length string) pos)) |
| 4067 | 'completions-first-difference | 4067 | (add-face-text-property |
| 4068 | nil string)) | 4068 | pos (1+ pos) |
| 4069 | (unless (or (not me) (= from me)) | 4069 | 'completions-first-difference |
| 4070 | (add-face-text-property from me 'completions-common-part nil string)) | 4070 | nil string)) |
| 4071 | string)) | 4071 | (unless (or (not me) (= from me)) |
| 4072 | (add-face-text-property from me 'completions-common-part nil string)) | ||
| 4073 | string)) | ||
| 4072 | 4074 | ||
| 4073 | (defun completion--flex-score-1 (md-groups match-end len) | 4075 | (defun completion--flex-score-1 (md-groups match-end len) |
| 4074 | "Compute matching score of completion. | 4076 | "Compute matching score of completion. |