[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/completions-highlight-modifications 102d3be 1/6: Insert some mod
Jimmy Aguilar Mena
feature/completions-highlight-modifications 102d3be 1/6: Insert some modifications to implement completions highlighting.
Mon, 31 Aug 2020 05:28:52 -0400 (EDT)
Author: Jimmy Aguilar Mena <firstname.lastname@example.org>
Commit: Jimmy Aguilar Mena <email@example.com>
Insert some modifications to implement completions highlighting.
This are changes needed in the minibuffer API to do highlighting from a
* 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
(completion--in-region-1) : Modification to funcall
(minibuffer-hide-completions-hook) : New hook to call after
closing *Completions* buffer.
(minibuffer-hide-completions) : Modify to run hook
lisp/minibuffer.el | 44 +++++++++++++++++++++++++++++++++-----------
1 file changed, 33 insertions(+), 11 deletions(-)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 864726e..04eef7b 100644
@@ -1272,6 +1272,27 @@ scroll the window of possible completions."
+(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
+ "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.
@@ -1279,21 +1300,14 @@ scroll the window of possible completions."
(unless (eq 'completion-at-point last-command)
(setq minibuffer-scroll-window nil))
;; 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
+ ;; Action to perform when pressing tab and completions are shown.
+ (funcall minibuffer-tab-through-completions-function)
;; If we're cycling, keep on cycling.
((and completion-cycling completion-all-sorted-completions)
(minibuffer-force-complete beg end)
@@ -2045,12 +2059,20 @@ variables.")
+(defvar minibuffer-hide-completions-hook nil
+ "Normal hook run at the end of completion-hide-completions.
+The hook is called from the minibuffer after hide completions.
+When this hook is run, the current buffer is the minibuffer and
+the *Completions* buffer is already hidden.")
(defun minibuffer-hide-completions ()
"Get rid of an out-of-date *Completions* buffer."
;; FIXME: We could/should use minibuffer-scroll-window here, but it
;; can also point to the minibuffer-parent-window, so it's a bit tricky.
(let ((win (get-buffer-window "*Completions*" 0)))
- (if win (with-selected-window win (bury-buffer)))))
+ (when win
+ (with-selected-window win (bury-buffer))
+ (run-hooks 'minibuffer-hide-completions-hook))))
(defun exit-minibuffer ()
"Terminate this minibuffer argument."
- branch feature/completions-highlight-modifications created (now 56a64ec), Jimmy Aguilar Mena, 2020/08/31
- feature/completions-highlight-modifications 3dafb03 2/6: Document the changes in the API for Completions., Jimmy Aguilar Mena, 2020/08/31
- feature/completions-highlight-modifications b79177f 3/6: Add completions-highlight-mode initial implementation., Jimmy Aguilar Mena, 2020/08/31
- feature/completions-highlight-modifications bc5cd54 4/6: Fix initial comment in completions-highlight file., Jimmy Aguilar Mena, 2020/08/31
- feature/completions-highlight-modifications 102d3be 1/6: Insert some modifications to implement completions highlighting.,
Jimmy Aguilar Mena <=
- feature/completions-highlight-modifications 56a64ec 6/6: Fix recursive set-keymap-parent in completions-highlight., Jimmy Aguilar Mena, 2020/08/31
- feature/completions-highlight-modifications 11d4b15 5/6: Improve keymap handling., Jimmy Aguilar Mena, 2020/08/31