aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2021-08-15 18:25:04 +0100
committerJoão Távora2021-08-15 18:25:04 +0100
commit70da05ac17094c7d8069ed796204f28e005a1571 (patch)
treef82847edafcd517bd6777e38c6097acc3df8f812
parent704855af17a307077243572a41a9df9343b04ced (diff)
downloademacs-scratch/icomplete-lazy-highlight-attempt-2.tar.gz
emacs-scratch/icomplete-lazy-highlight-attempt-2.zip
Adjust comments and docstrings for completion-lazy-hilit featurescratch/icomplete-lazy-highlight-attempt-2
* lisp/minibuffer.el (completion-lazy-hilit): Adjust docstring. (completion-pcm--hilit-commonality): Adjust comment.
-rw-r--r--lisp/minibuffer.el31
1 files changed, 16 insertions, 15 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 5ca5e8dc43e..c21f2340536 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3513,7 +3513,7 @@ than the latter (which has two \"holes\" and three
3513one-letter-long matches).") 3513one-letter-long matches).")
3514 3514
3515(defvar-local completion-lazy-hilit nil 3515(defvar-local completion-lazy-hilit nil
3516 "If non-nil, request completion lazy hilighting. 3516 "If non-nil, request lazy hilighting of completion matches.
3517 3517
3518Completion-presenting frontends may opt to bind this variable to 3518Completion-presenting frontends may opt to bind this variable to
3519a unique non-nil value in the context of completion-producing 3519a unique non-nil value in the context of completion-producing
@@ -3522,24 +3522,24 @@ the intervening completion styles that they do not need to
3522propertize completion strings with the `face' property. 3522propertize completion strings with the `face' property.
3523 3523
3524When doing so, it is the frontend -- not the style -- who becomes 3524When doing so, it is the frontend -- not the style -- who becomes
3525responsible for `face'-propertizing only the completion strings 3525responsible for `face'-propertizing the completion matches meant
3526that are meant to be displayed to the user. This can be done by 3526to be displayed to the user, frequently a small subset of all
3527calling the function `completion-lazy-hilit' which returns a 3527completion matches. This can be done by calling the function
3528`face'-propertized string. 3528`completion-lazy-hilit' which returns a `face'-propertized
3529 3529string.
3530The value stored in this variable by the completion frontend 3530
3531should be unique to each completion attempt or session that 3531The value stored in this variable by the completion frontend must
3532utilizes the same completion style in `completion-styles-alist'. 3532be unique to each completion attempt/session. For instance,
3533For frontends using the minibuffer as the locus of completion 3533frontends which utilize the minibuffer as the locus of completion
3534calls and display, setting it to a buffer-local value given by 3534may set it to a buffer-local value returned by `gensym'. For
3535`gensym' is appropriate. For frontends operating entirely in a 3535frontends operating within a recursive command loop, let-binding
3536single command, let-binding it to `gensym' is appropriate. 3536it to `gensym' is appropriate.
3537 3537
3538Note that the optimization enabled by variable is only actually 3538Note that the optimization enabled by variable is only actually
3539performed some completions styles. To others, it is a harmless 3539performed some completions styles. To others, it is a harmless
3540and useless hint. To author a completion style that takes 3540and useless hint. To author a completion style that takes
3541advantage of this, look in the source of 3541advantage of this, look in the source of
3542`completion-pcm--hilit-commonality'.") 3542`completion-pcm--hilit-commonality' for ideas.")
3543 3543
3544(defun completion-lazy-hilit (str) 3544(defun completion-lazy-hilit (str)
3545 "Return a copy of completion STR that is `face'-propertized. 3545 "Return a copy of completion STR that is `face'-propertized.
@@ -3576,7 +3576,8 @@ between 0 and 1, and with faces `completions-common-part',
3576 (mapcar 3576 (mapcar
3577 (lambda (str) 3577 (lambda (str)
3578 (unless completion-lazy-hilit 3578 (unless completion-lazy-hilit
3579 ;; Don't modify the string itself. 3579 ;; Make a copy of `str' since in this case we're about to
3580 ;; `face'-propertize it.
3580 (setq str (copy-sequence str))) 3581 (setq str (copy-sequence str)))
3581 (unless (string-match re str) 3582 (unless (string-match re str)
3582 (error "Internal error: %s does not match %s" re str)) 3583 (error "Internal error: %s does not match %s" re str))