[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/vcomplete b1fa61dffd 16/91: Change the way the current com
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/vcomplete b1fa61dffd 16/91: Change the way the current completion is highlighted |
Date: |
Tue, 24 May 2022 15:59:06 -0400 (EDT) |
branch: elpa/vcomplete
commit b1fa61dffd655d5d17871296154e9bf1ff599534
Author: Daniel Semyonov <cmstr@dsemy.com>
Commit: Daniel Semyonov <cmstr@dsemy.com>
Change the way the current completion is highlighted
This change should eliminate any differences between the highlighted
completion and the actual completion string.
* vcomplete.el (vcomplete--highlight-completion-at-point): New
function which highlights the completion at point using the same
method used by 'choose-completion' to get the bounds of the completion
string.
(vcomplete--move-n-completions): Use the new function instead of the
previous method of highlighting the completion.
---
vcomplete.el | 50 +++++++++++++++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 17 deletions(-)
diff --git a/vcomplete.el b/vcomplete.el
index 36e2d1bab8..277b90746b 100644
--- a/vcomplete.el
+++ b/vcomplete.el
@@ -117,30 +117,46 @@ While evaluating body, BUFFER and WINDOW are locally
bound to the
(defvar vcomplete--last-completion-overlay nil
"Last overlay created in the ‘*Completions*’ buffer.")
+(defun vcomplete--highlight-completion-at-point ()
+ "Highlight the completion at point in the ‘*Completions*’ buffer.
+The string of the current completion is saved in
+‘vcomplete-current-completion-string’."
+ (while-no-input
+ (redisplay)
+ (if (derived-mode-p 'completion-list-mode)
+ ;; Modified from code in ‘choose-completion’.
+ (let (beg end noop hl)
+ (cond
+ ((and (not (eobp)) (get-text-property (point) 'mouse-face))
+ (setq end (point) beg (1+ (point))))
+ ((and (not (bobp))
+ (get-text-property (1- (point)) 'mouse-face))
+ (setq end (1- (point)) beg (point)))
+ (t (setq noop t)))
+ (unless noop
+ (setq beg (previous-single-property-change beg 'mouse-face))
+ (setq end (or (next-single-property-change end 'mouse-face)
+ (point-max)))
+ (setq vcomplete-current-completion-string
+ (buffer-substring-no-properties beg end))
+ (overlay-put
+ (setq hl (make-overlay beg end)) 'face 'highlight))
+ (when vcomplete--last-completion-overlay
+ (delete-overlay vcomplete--last-completion-overlay))
+ (setq vcomplete--last-completion-overlay hl))
+ (error "Not in a valid completion list buffer"))))
+
(defun vcomplete--move-n-completions (n)
"Move N completions in the ‘*Completions*’ buffer.
-The completion selected is marked with an overlay."
+The index of the current completion is saved in
+‘vcomplete-current-completion-index’."
(vcomplete-with-completions-buffer
(next-completion n)
(setq vcomplete-current-completion-index
(+ n vcomplete-current-completion-index))
(when (= (point) (point-max)) (next-completion -1))
- (let ((beg (set-window-point window (point))) end)
- (unless (or (= beg (point-min))
- (= beg (point-max)))
- (save-excursion
- (pcase (char-before (re-search-forward " \t\\|\n\\|\\'"))
- (?\t (setq end (- (point) 2)))
- (?\n (setq end (- (point) 1)))
- (_ (setq end (point)))))
- (setq vcomplete-current-completion-string
- (buffer-substring-no-properties beg end))
- (when vcomplete--last-completion-overlay
- (delete-overlay vcomplete--last-completion-overlay))
- (overlay-put
- (setq vcomplete--last-completion-overlay
- (make-overlay beg end))
- 'face 'highlight)))))
+ (set-window-point window (point))
+ (vcomplete--highlight-completion-at-point)))
(defun vcomplete-next-completion (&optional n)
"Move to the next item in the ‘*Completions*’ buffer.
- [nongnu] elpa/vcomplete 6a3b02df46 76/91: * vcomplete.el (vcomplete-with-completions-buffer): Allow debugging body, (continued)
- [nongnu] elpa/vcomplete 6a3b02df46 76/91: * vcomplete.el (vcomplete-with-completions-buffer): Allow debugging body, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete dce24e895d 18/91: Replaced current completion variables with a function, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 36ae2920e4 17/91: * vcomplete.el (vcomplete-kill-buffer): Remove to simplify the package, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 12def7b143 19/91: Highlight the completion at point in the completion list buffer, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete a7eb3b9365 25/91: ; Fixes and improvements to the Info node, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 6bc410d948 27/91: Handle cases where 'vcomplete-mode' starts before loading Embark, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete e37470eb13 05/91: ; Fix indentation, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 39f0aead10 13/91: Fix 'vcomplete--update-in-region' added to 'post-command-hook' globally, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete b6fd11b7c4 31/91: ; Update mail address, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 369a9fb9c4 03/91: ; Ignore Emacs' backup files, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete b1fa61dffd 16/91: Change the way the current completion is highlighted,
ELPA Syncer <=
- [nongnu] elpa/vcomplete 14429ac79d 20/91: Exits 'completion-in-region-mode' when completions aren't visible, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 29423a4aa1 37/91: ; Documentation improvements, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 8441803b7a 38/91: Split 'vcomplete--setup-current' into two functions, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 50d812fc6a 39/91: Remove unnecessary hook removal, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 6684bd7640 41/91: ; Update info node to remove disclaimer for bug fixed in last commit, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete b14444ef8a 45/91: ; Edit docstrings to conform completely to 'checkdoc', ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 371e7c9b77 46/91: ; Add requirement for Embark to vcomplete-embark.el, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete d086a33a1a 49/91: * vcomplete.el (vcomplete-with-completions-buffer): Use 'derived-mode-p', ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 20e327acce 53/91: ; Indicate that Embark integration has been moved in the NEWS file, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 89fd222097 56/91: ; Improve docstring of 'vcomplete--disable-completion-in-region', ELPA Syncer, 2022/05/24