[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/completions-highlight-modifications 2344367 1/9: Insert some mod
From: |
Jimmy Aguilar Mena |
Subject: |
feature/completions-highlight-modifications 2344367 1/9: Insert some modifications to implement completions highlighting. |
Date: |
Sun, 15 Nov 2020 01:27:15 -0500 (EST) |
branch: feature/completions-highlight-modifications
commit 2344367d9dc40700923e883c1be51e6f44316c7a
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>
Insert some modifications to implement completions highlighting.
This are changes needed in the minibuffer API to do highlighting from a
different package.
* lisp/minibuffer.el (minibuffer-tab-through-completions-function) : New
variable containing the action to do when pressing tab in minibuffer
and *Completions* are shown.
(minibuffer-tab-through-completions-default) : Default function value
for minibuffer-tab-through-completions-function.
(completion--in-region-1) : Modification to funcall
minibuffer-tab-through-completions-function.
(minibuffer-hide-completions-hook) : New hook to call after
closing *Completions* buffer.
(minibuffer-hide-completions) : Modify to run hook
minibuffer-hide-completions-hook.
---
lisp/minibuffer.el | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 9d57a81..41a5d40 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1283,6 +1283,27 @@ scroll the window of possible completions."
minibuffer-completion-table
minibuffer-completion-predicate)))
+
+(defun minibuffer-tab-through-completions-default ()
+ "Default action in `minibuffer-scroll-window' WINDOW.
+This is called when *Completions* window is already visible."
+ (let ((window minibuffer-scroll-window))
+ (with-current-buffer (window-buffer window)
+ (if (pos-visible-in-window-p (point-max) window)
+ ;; If end is in view, scroll up to the beginning.
+ (set-window-start window (point-min) nil)
+ ;; Else scroll down one screen.
+ (with-selected-window window
+ (scroll-up)))
+ nil)))
+
+(defvar minibuffer-tab-through-completions-function
+ #'minibuffer-tab-through-completions-default
+ "Function to execute when requested completion.
+This is used when *Completions* frame is already visible and the
+completions command is called again. This function receives the
+window to execute commands as a paramenter.")
+
(defun completion--in-region-1 (beg end)
;; If the previous command was not this,
;; mark the completion buffer obsolete.
@@ -1290,21 +1311,14 @@ scroll the window of possible completions."
(unless (eq 'completion-at-point last-command)
(completion--flush-all-sorted-completions)
(setq minibuffer-scroll-window nil))
-
(cond
;; If there's a fresh completion window with a live buffer,
;; and this command is repeated, scroll that window.
((and (window-live-p minibuffer-scroll-window)
(eq t (frame-visible-p (window-frame minibuffer-scroll-window))))
- (let ((window minibuffer-scroll-window))
- (with-current-buffer (window-buffer window)
- (if (pos-visible-in-window-p (point-max) window)
- ;; If end is in view, scroll up to the beginning.
- (set-window-start window (point-min) nil)
- ;; Else scroll down one screen.
- (with-selected-window window
- (scroll-up)))
- nil)))
+ ;; Action to perform when pressing tab and completions are shown.
+ (funcall minibuffer-tab-through-completions-function)
+ nil)
;; If we're cycling, keep on cycling.
((and completion-cycling completion-all-sorted-completions)
(minibuffer-force-complete beg end)
- 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 <=
- 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, 2020/11/15
- 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