diff options
| author | Philip Kaludercic | 2022-03-24 20:11:01 +0200 |
|---|---|---|
| committer | Juri Linkov | 2022-03-24 20:11:01 +0200 |
| commit | 392d66f6f5d9962d0b0f96decbebd9db00cce1ab (patch) | |
| tree | 79930e55039476e8786aed1291a38644c62bdd42 /lisp | |
| parent | 71aec1d0444ab351a4f20ae1ed10dee7bc12af88 (diff) | |
| download | emacs-392d66f6f5d9962d0b0f96decbebd9db00cce1ab.tar.gz emacs-392d66f6f5d9962d0b0f96decbebd9db00cce1ab.zip | |
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)
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/simple.el | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 6dd8d141ae1..921fba34169 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -9168,6 +9168,13 @@ forward)." | |||
| 9168 | With prefix argument N, move N items (negative N means move | 9168 | With prefix argument N, move N items (negative N means move |
| 9169 | backward)." | 9169 | backward)." |
| 9170 | (interactive "p") | 9170 | (interactive "p") |
| 9171 | (let ((prev (previous-single-property-change (point) 'mouse-face))) | ||
| 9172 | (goto-char (cond | ||
| 9173 | ((not prev) | ||
| 9174 | (1- (next-single-property-change (point) 'mouse-face))) | ||
| 9175 | ((/= prev (point)) | ||
| 9176 | (point)) | ||
| 9177 | (t prev)))) | ||
| 9171 | (let ((beg (point-min)) (end (point-max))) | 9178 | (let ((beg (point-min)) (end (point-max))) |
| 9172 | (catch 'bound | 9179 | (catch 'bound |
| 9173 | (while (> n 0) | 9180 | (while (> n 0) |
| @@ -9185,7 +9192,7 @@ backward)." | |||
| 9185 | (unless (get-text-property (point) 'mouse-face) | 9192 | (unless (get-text-property (point) 'mouse-face) |
| 9186 | (goto-char (next-single-property-change (point) 'mouse-face nil end))) | 9193 | (goto-char (next-single-property-change (point) 'mouse-face nil end))) |
| 9187 | (setq n (1- n))) | 9194 | (setq n (1- n))) |
| 9188 | (while (< n 0) | 9195 | (while (and (< n 0) (not (bobp))) |
| 9189 | (let ((prop (get-text-property (1- (point)) 'mouse-face))) | 9196 | (let ((prop (get-text-property (1- (point)) 'mouse-face))) |
| 9190 | ;; If in a completion, move to the start of it. | 9197 | ;; If in a completion, move to the start of it. |
| 9191 | (when (and prop (eq prop (get-text-property (point) 'mouse-face))) | 9198 | (when (and prop (eq prop (get-text-property (point) 'mouse-face))) |