[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/completions-highlight-modifications 71f60b6 07/18: Fix corner ca
From: |
Jimmy Aguilar Mena |
Subject: |
feature/completions-highlight-modifications 71f60b6 07/18: Fix corner case when going out of bounds |
Date: |
Wed, 18 Nov 2020 22:30:35 -0500 (EST) |
branch: feature/completions-highlight-modifications
commit 71f60b62a8abca84f1bb76c05603afced6a1c000
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
- feature/completions-highlight-modifications a6e73e8 04/18: Fix initial comment in completions-highlight file., (continued)
- feature/completions-highlight-modifications a6e73e8 04/18: Fix initial comment in completions-highlight file., Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications 8a60d7d 08/18: Simplify numeric argument, Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications a686211 10/18: Simplify overlay handling, Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications 34570e1 14/18: Improve completions-highlight description in file header., Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications bfe4747 12/18: Add parent maps, Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications 6db2c4a 17/18: Simplify and rely more in the post-command-hook, Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications d397d2b 13/18: Add # to function bindings, Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications cb02cb6 11/18: Add autoload decorator., Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications 9fe2441 15/18: Add custom variable completions-highlight-autoselect., Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications ff46a8f 18/18: Add backtab commands., Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications 71f60b6 07/18: Fix corner case when going out of bounds,
Jimmy Aguilar Mena <=
- feature/completions-highlight-modifications ac93fdb 16/18: Define completions-highlight face and group, Jimmy Aguilar Mena, 2020/11/18
- feature/completions-highlight-modifications f3ad5c1 09/18: Simplify setting keymaps., Jimmy Aguilar Mena, 2020/11/18