[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 392d66f6f5: Fix wrapping of 'previous-completion' at the beginnin
From: |
Juri Linkov |
Subject: |
master 392d66f6f5: Fix wrapping of 'previous-completion' at the beginning of buffer |
Date: |
Thu, 24 Mar 2022 14:11:33 -0400 (EDT) |
branch: master
commit 392d66f6f5d9962d0b0f96decbebd9db00cce1ab
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Juri Linkov <juri@linkov.net>
Fix wrapping of 'previous-completion' at the beginning of buffer
* lisp/simple.el (next-completion): Prevent an error of
'previous-completion' at the beginning of completions buffer.
Also fix 'previous-completion' to wrap to the last completion.
(bug#54374)
---
lisp/simple.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/simple.el b/lisp/simple.el
index 6dd8d141ae..921fba3416 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9168,6 +9168,13 @@ forward)."
With prefix argument N, move N items (negative N means move
backward)."
(interactive "p")
+ (let ((prev (previous-single-property-change (point) 'mouse-face)))
+ (goto-char (cond
+ ((not prev)
+ (1- (next-single-property-change (point) 'mouse-face)))
+ ((/= prev (point))
+ (point))
+ (t prev))))
(let ((beg (point-min)) (end (point-max)))
(catch 'bound
(while (> n 0)
@@ -9185,7 +9192,7 @@ backward)."
(unless (get-text-property (point) 'mouse-face)
(goto-char (next-single-property-change (point) 'mouse-face nil
end)))
(setq n (1- n)))
- (while (< n 0)
+ (while (and (< n 0) (not (bobp)))
(let ((prop (get-text-property (1- (point)) 'mouse-face)))
;; If in a completion, move to the start of it.
(when (and prop (eq prop (get-text-property (point) 'mouse-face)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 392d66f6f5: Fix wrapping of 'previous-completion' at the beginning of buffer,
Juri Linkov <=