[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 8b7d7872c3 2/2: Simplify consult--default-compl
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 8b7d7872c3 2/2: Simplify consult--default-completion-list-candidate for Emacs 28 |
Date: |
Thu, 14 Nov 2024 12:57:45 -0500 (EST) |
branch: externals/consult
commit 8b7d7872c3d1ddf68c31d6b26197bed9643611fb
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Simplify consult--default-completion-list-candidate for Emacs 28
---
consult.el | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/consult.el b/consult.el
index e9780f49f0..cd111ea649 100644
--- a/consult.el
+++ b/consult.el
@@ -5165,20 +5165,18 @@ automatically previewed."
(defun consult--default-completion-list-candidate ()
"Return current candidate at point from completions buffer."
- (let (beg end)
+ (let (beg)
(when (and
(derived-mode-p 'completion-list-mode)
;; Logic taken from `choose-completion'.
;; TODO Upstream a `completion-list-get-candidate' function.
(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)))))
- (setq beg (previous-single-property-change beg 'mouse-face)
- end (or (next-single-property-change end 'mouse-face) (point-max)))
- (or (get-text-property beg 'completion--string)
- (buffer-substring-no-properties beg end)))))
+ ((and (not (eobp)) (get-text-property (point) 'completion--string))
+ (setq beg (1+ (point))))
+ ((and (not (bobp)) (get-text-property (1- (point))
'completion--string))
+ (setq beg (point)))))
+ (get-text-property (previous-single-property-change beg
'completion--string)
+ 'completion--string))))
;;;;; Integration: Vertico