[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/completions-highlight-modifications 9ac4a61 7/9: Fix corner case
From: |
Jimmy Aguilar Mena |
Subject: |
feature/completions-highlight-modifications 9ac4a61 7/9: Fix corner case when going out of bounds |
Date: |
Sun, 15 Nov 2020 01:27:17 -0500 (EST) |
branch: feature/completions-highlight-modifications
commit 9ac4a61fde940819e3d7b11c804e331307361c62
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>
Fix corner case when going out of bounds
* lisp/completions-highlight.el : Don't go anywhere when in the fist or
last candidate.
* Remove some redundant calls to with-current-buffer
---
lisp/completions-highlight.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/lisp/completions-highlight.el b/lisp/completions-highlight.el
index 00b7382..f0da382 100644
--- a/lisp/completions-highlight.el
+++ b/lisp/completions-highlight.el
@@ -63,9 +63,15 @@ N is set to 1 if not specified."
"Move to and highlight the next item in the completion list.
With prefix argument N, move N items (negative N means move backward).
If completion highlight is enabled, highlights the selected candidate.
-Returns the completion string if available."
+Returns the completion string if available.
+If N is equal to zero returns the current candidate"
(interactive "p")
- (next-completion n)
+
+ (unless (zerop n)
+ (next-completion n)
+ (cond
+ ((eobp) (next-completion -1))
+ ((bobp) (next-completion 1))))
(let* ((obeg (point))
(oend (next-single-property-change obeg 'mouse-face nil (point-max)))
@@ -108,8 +114,7 @@ alive and active."
`(and (window-live-p minibuffer-scroll-window)
(eq t (frame-visible-p (window-frame minibuffer-scroll-window)))
(with-selected-window minibuffer-scroll-window
- (with-current-buffer (window-buffer minibuffer-scroll-window)
- ,@body))))
+ ,@body)))
(defun minibuffer-next-completion (n)
"Execute `completions-highlight-next-completion' in *Completions*.
@@ -163,7 +168,6 @@ suffix."
(completion-no-auto-exit t))
(with-selected-window minibuffer-window
- (with-current-buffer minibuffer-buffer
(let* ((prompt-end (minibuffer-prompt-end))
(cursor-pos (if obase-position
(cadr obase-position)
@@ -177,7 +181,7 @@ suffix."
(choose-completion-string suffix minibuffer-buffer
(list cursor-pos (point-max)))
(add-face-text-property cursor-pos (+ cursor-pos suffix-len) 'shadow)
- (goto-char cursor-pos))))))
+ (goto-char cursor-pos)))))
(defvar completions-highlight-minibuffer-map
- branch feature/completions-highlight-modifications created (now ede71d0), Jimmy Aguilar Mena, 2020/11/15
- feature/completions-highlight-modifications 2344367 1/9: Insert some modifications to implement completions highlighting., Jimmy Aguilar Mena, 2020/11/15
- feature/completions-highlight-modifications ecc7901 8/9: Simplify numeric argument, Jimmy Aguilar Mena, 2020/11/15
- feature/completions-highlight-modifications e558c57 5/9: Improve keymap handling., Jimmy Aguilar Mena, 2020/11/15
- feature/completions-highlight-modifications 65d1038 3/9: Add completions-highlight-mode initial implementation., Jimmy Aguilar Mena, 2020/11/15
- feature/completions-highlight-modifications 9ac4a61 7/9: Fix corner case when going out of bounds,
Jimmy Aguilar Mena <=
- feature/completions-highlight-modifications 09520f7 4/9: Fix initial comment in completions-highlight file., Jimmy Aguilar Mena, 2020/11/15
- feature/completions-highlight-modifications 094ed4b 2/9: Document the changes in the API for Completions., Jimmy Aguilar Mena, 2020/11/15
- feature/completions-highlight-modifications f12bfdc 6/9: Fix recursive set-keymap-parent in completions-highlight., Jimmy Aguilar Mena, 2020/11/15
- feature/completions-highlight-modifications ede71d0 9/9: Simplify setting keymaps., Jimmy Aguilar Mena, 2020/11/15