diff options
| author | João Távora | 2021-08-15 18:25:04 +0100 |
|---|---|---|
| committer | João Távora | 2021-08-15 18:25:04 +0100 |
| commit | 70da05ac17094c7d8069ed796204f28e005a1571 (patch) | |
| tree | f82847edafcd517bd6777e38c6097acc3df8f812 | |
| parent | 704855af17a307077243572a41a9df9343b04ced (diff) | |
| download | emacs-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.el | 31 |
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 | |||
| 3513 | one-letter-long matches).") | 3513 | one-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 | ||
| 3518 | Completion-presenting frontends may opt to bind this variable to | 3518 | Completion-presenting frontends may opt to bind this variable to |
| 3519 | a unique non-nil value in the context of completion-producing | 3519 | a unique non-nil value in the context of completion-producing |
| @@ -3522,24 +3522,24 @@ the intervening completion styles that they do not need to | |||
| 3522 | propertize completion strings with the `face' property. | 3522 | propertize completion strings with the `face' property. |
| 3523 | 3523 | ||
| 3524 | When doing so, it is the frontend -- not the style -- who becomes | 3524 | When doing so, it is the frontend -- not the style -- who becomes |
| 3525 | responsible for `face'-propertizing only the completion strings | 3525 | responsible for `face'-propertizing the completion matches meant |
| 3526 | that are meant to be displayed to the user. This can be done by | 3526 | to be displayed to the user, frequently a small subset of all |
| 3527 | calling the function `completion-lazy-hilit' which returns a | 3527 | completion matches. This can be done by calling the function |
| 3528 | `face'-propertized string. | 3528 | `completion-lazy-hilit' which returns a `face'-propertized |
| 3529 | 3529 | string. | |
| 3530 | The value stored in this variable by the completion frontend | 3530 | |
| 3531 | should be unique to each completion attempt or session that | 3531 | The value stored in this variable by the completion frontend must |
| 3532 | utilizes the same completion style in `completion-styles-alist'. | 3532 | be unique to each completion attempt/session. For instance, |
| 3533 | For frontends using the minibuffer as the locus of completion | 3533 | frontends which utilize the minibuffer as the locus of completion |
| 3534 | calls and display, setting it to a buffer-local value given by | 3534 | may set it to a buffer-local value returned by `gensym'. For |
| 3535 | `gensym' is appropriate. For frontends operating entirely in a | 3535 | frontends operating within a recursive command loop, let-binding |
| 3536 | single command, let-binding it to `gensym' is appropriate. | 3536 | it to `gensym' is appropriate. |
| 3537 | 3537 | ||
| 3538 | Note that the optimization enabled by variable is only actually | 3538 | Note that the optimization enabled by variable is only actually |
| 3539 | performed some completions styles. To others, it is a harmless | 3539 | performed some completions styles. To others, it is a harmless |
| 3540 | and useless hint. To author a completion style that takes | 3540 | and useless hint. To author a completion style that takes |
| 3541 | advantage of this, look in the source of | 3541 | advantage 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)) |