emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/completions-highlight-modifications 60a1003: Fix precious commit


From: Jimmy Aguilar Mena
Subject: feature/completions-highlight-modifications 60a1003: Fix precious commit.
Date: Fri, 20 Nov 2020 16:34:42 -0500 (EST)

branch: feature/completions-highlight-modifications
commit 60a1003aeeb3eceb41f40652aba43f9dfa0d02dd
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>

    Fix precious commit.
    
    *
    lisp/completions-highlight.el 
(completions-highlight--hide-completions-advise)
    : New function to advise minibuffer-hide-completions.
    (completions-highlight-select-near) : Unconditional recenter
---
 lisp/completions-highlight.el | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/lisp/completions-highlight.el b/lisp/completions-highlight.el
index ca5cf8f..7337673 100644
--- a/lisp/completions-highlight.el
+++ b/lisp/completions-highlight.el
@@ -109,14 +109,12 @@ otherwise it goes to the next completion. "
   "Move to and highlight closer item in the completion list."
   (interactive "p")
 
+  (next-completion -1)
+  (next-completion 1)
   ;; Try to find the closest completion if not in one
-  (unless (get-text-property (point) 'mouse-face)
-    (next-completion -1)
-    (next-completion 1)
-
-    (cond
-     ((eobp) (next-completion -1))
-     ((bobp) (next-completion 1))))
+  (cond
+   ((eobp) (next-completion -1))
+   ((bobp) (next-completion 1)))
 
   (let* ((obeg (point))
          (oend (next-single-property-change obeg 'mouse-face nil (point-max)))
@@ -128,7 +126,8 @@ otherwise it goes to the next completion. "
 
 (defsubst completions-highlight-completions-visible-p ()
   "Return t if *Completions* is visible."
-  (and (window-live-p minibuffer-scroll-window)
+  (and (windowp minibuffer-scroll-window)
+       (window-live-p minibuffer-scroll-window)
        (eq t (frame-visible-p (window-frame minibuffer-scroll-window)))))
 
 (defun completions-highlight-from-minibuffer (&optional command)
@@ -226,10 +225,13 @@ should be assigned to 
completion-in-minibuffer-scroll-window."
   (completions-highlight--clear-suffix)
   (unless (lookup-key completions-highlight-minibuffer-map
                       (this-single-command-keys))
-    (remove-hook 'pre-command-hook
-                 #'completions-highlight-maybe-close-completions t)
     (minibuffer-hide-completions)))
 
+(defun completions-highlight--hide-completions-advise ()
+  "Function to advise minibuffer-hide-completions."
+  (remove-hook 'pre-command-hook
+               #'completions-highlight-maybe-close-completions t))
+
 (defun completions-highlight-setup ()
   "Function to call when enabling the `completion-highlight-mode' mode.
 It is called when showing the *Completions* buffer."
@@ -274,13 +276,17 @@ It is called when showing the *Completions* buffer."
        (setq minibuffer-tab-through-completions-function
              #'completions-highlight--minibuffer-tab-through-completions)
 
-       (add-hook 'completion-setup-hook #'completions-highlight-setup t))
+       (add-hook 'completion-setup-hook #'completions-highlight-setup t)
+        (advice-add 'minibuffer-hide-completions
+                    :before #'completions-highlight--hide-completions-advise))
 
     ;; Restore the default completion-in-minibuffer-scroll-window
     (setq minibuffer-tab-through-completions-function
          minibuffer-tab-through-completions-function-save)
 
-    (remove-hook 'completion-setup-hook #'completions-highlight-setup)))
+    (remove-hook 'completion-setup-hook #'completions-highlight-setup)
+    (advice-remove 'minibuffer-hide-completions
+                   #'completions-highlight--hide-completions-advise)))
 
 (provide 'completions-highlight)
 ;;; completions-highlight.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]