[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-30 96f1db89ee7: Avoid errors in 'icomplete-vertical-mode'
From: |
Eli Zaretskii |
Subject: |
emacs-30 96f1db89ee7: Avoid errors in 'icomplete-vertical-mode' |
Date: |
Sat, 20 Jul 2024 01:59:39 -0400 (EDT) |
branch: emacs-30
commit 96f1db89ee7d3696d27a5bf044ada7942e354fda
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Avoid errors in 'icomplete-vertical-mode'
* lisp/minibuffer.el (completion--hilit-from-re): Avoid signaling
an error if STRING does not match REGEXP. Fix doc string and
indentation. (Bug#72176)
---
lisp/minibuffer.el | 38 ++++++++++++++++++++------------------
1 file 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."
(defun completion--hilit-from-re (string regexp &optional point-idx)
"Fontify STRING using REGEXP POINT-IDX.
-`completions-common-part' and `completions-first-difference' are
-used. POINT-IDX is the position of point in the presumed \"PCM\"
-pattern that was used to generate derive REGEXP from."
-(let* ((md (and regexp (string-match regexp string) (cddr (match-data t))))
- (pos (if point-idx (match-beginning point-idx) (match-end 0)))
- (me (and md (match-end 0)))
- (from 0))
- (while md
- (add-face-text-property from (pop md) 'completions-common-part nil string)
- (setq from (pop md)))
- (if (> (length string) pos)
- (add-face-text-property
- pos (1+ pos)
- 'completions-first-difference
- nil string))
- (unless (or (not me) (= from me))
- (add-face-text-property from me 'completions-common-part nil string))
- string))
+Uses `completions-common-part' and `completions-first-difference'
+faces to fontify STRING.
+POINT-IDX is the position of point in the presumed \"PCM\" pattern
+from which REGEXP was generated."
+ (let* ((md (and regexp (string-match regexp string) (cddr (match-data t))))
+ (pos (if point-idx (match-beginning point-idx) (match-end 0)))
+ (me (and md (match-end 0)))
+ (from 0))
+ (while md
+ (add-face-text-property from (pop md)
+ 'completions-common-part nil string)
+ (setq from (pop md)))
+ (if (and (numberp pos) (> (length string) pos))
+ (add-face-text-property
+ pos (1+ pos)
+ 'completions-first-difference
+ nil string))
+ (unless (or (not me) (= from me))
+ (add-face-text-property from me 'completions-common-part nil string))
+ string))
(defun completion--flex-score-1 (md-groups match-end len)
"Compute matching score of completion.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-30 96f1db89ee7: Avoid errors in 'icomplete-vertical-mode',
Eli Zaretskii <=