emacs-diffs
[Top][All Lists]
Advanced

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

feature/completions-highlight-modifications 5dd563f 1/2: Renamed complet


From: Jimmy Aguilar Mena
Subject: feature/completions-highlight-modifications 5dd563f 1/2: Renamed completions-highlight as zcomplete
Date: Sun, 22 Nov 2020 18:00:07 -0500 (EST)

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

    Renamed completions-highlight as zcomplete
---
 lisp/{completions-highlight.el => zcomplete.el} | 114 ++++++++++++------------
 1 file changed, 57 insertions(+), 57 deletions(-)

diff --git a/lisp/completions-highlight.el b/lisp/zcomplete.el
similarity index 72%
rename from lisp/completions-highlight.el
rename to lisp/zcomplete.el
index 7337673..aa88ad8 100644
--- a/lisp/completions-highlight.el
+++ b/lisp/zcomplete.el
@@ -1,4 +1,4 @@
-;;; completions-highlight.el --- highlight and natural move throw 
*Completions* buffer -*- lexical-binding: t -*-
+;;; zcomplete.el --- highlight and natural move throw *Completions* buffer -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2020 Free Software Foundation, Inc.
 
@@ -56,12 +56,12 @@
 (require 'simple)
 (require 'minibuffer)
 
-(defgroup completions-highlight nil
+(defgroup zcomplete nil
   "Highlight candidates in completions buffer."
   :version "28.1"
   :group 'completion)
 
-(defcustom completions-highlight-autoselect nil
+(defcustom zcomplete-autoselect nil
   "Select first candidate without extra tab.
 
 When this variable is nil an extra tab is required to select and
@@ -69,19 +69,19 @@ highlight the first candidate in the *Completions* buffer.  
When
 the value is non-nil the candidate is selected every time the
 buffer is shown and updated."
   :type 'boolean
-  :group 'completions-highlight
+  :group 'zcomplete
   :version "28.1")
 
-(defcustom completions-highlight-set-suffix t
+(defcustom zcomplete-set-suffix t
   "Insert completion candidate in minibuffer
 
 When this variable is nil the completions will be highlighted but
 not inserted in the minibuffer."
   :type 'boolean
-  :group 'completions-highlight
+  :group 'zcomplete
   :version "28.1")
 
-(defcustom completions-highlight-tab-no-scroll nil
+(defcustom zcomplete-tab-no-scroll nil
   "When press tab with too many candidates go to next or scroll.
 
 When non-nil tab always go to next completions independently of
@@ -89,23 +89,23 @@ the *Completions* buffer size.  When this variable is nil 
tab
 scrolls the *Completions* buffer if there are too many candidates
 otherwise it goes to the next completion. "
   :type 'boolean
-  :group 'completions-highlight
+  :group 'zcomplete
   :version "28.1")
 
-(defface completions-highlight
+(defface zcomplete
   '((t :inherit highlight :extend t))
   "Default face for highlighting the current line in Hl-Line mode."
   :version "28.1"
-  :group 'completions-highlight)
+  :group 'zcomplete)
 
-(defvar completions-highlight-overlay (make-overlay 0 0)
+(defvar zcomplete-overlay (make-overlay 0 0)
   "Overlay to use when `completion-highlight-mode' is enabled.")
 
 (defvar minibuffer-tab-through-completions-function-save nil
   "Saves the the original value of completion-in-minibuffer-scroll-window.")
 
 ;; *Completions* side commands
-(defun completions-highlight-select-near ()
+(defun zcomplete-select-near ()
   "Move to and highlight closer item in the completion list."
   (interactive "p")
 
@@ -120,19 +120,19 @@ otherwise it goes to the next completion. "
          (oend (next-single-property-change obeg 'mouse-face nil (point-max)))
          (choice (buffer-substring-no-properties obeg oend)))
 
-    (move-overlay completions-highlight-overlay obeg oend)
-    (when completions-highlight-set-suffix
-      (completions-highlight--set-suffix choice))))
+    (move-overlay zcomplete-overlay obeg oend)
+    (when zcomplete-set-suffix
+      (zcomplete--set-suffix choice))))
 
-(defsubst completions-highlight-completions-visible-p ()
+(defsubst zcomplete-completions-visible-p ()
   "Return t if *Completions* is visible."
   (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)
+(defun zcomplete-from-minibuffer (&optional command)
   (interactive)
-  (and (completions-highlight-completions-visible-p)
+  (and (zcomplete-completions-visible-p)
        (with-selected-window minibuffer-scroll-window
          (when-let ((command (or command
                                  (lookup-key (current-active-maps)
@@ -147,13 +147,13 @@ otherwise it goes to the next completion. "
 (defun minibuffer-choose-completion ()
   "Execute `choose-completion' in *Completions*."
   (interactive)
-  (if (and (completions-highlight-completions-visible-p)
-           (overlay-buffer completions-highlight-overlay))
-      (call-interactively #'completions-highlight-from-minibuffer)
+  (if (and (zcomplete-completions-visible-p)
+           (overlay-buffer zcomplete-overlay))
+      (call-interactively #'zcomplete-from-minibuffer)
     (minibuffer-complete-and-exit)))
 
 ;; General commands
-(defun completions-highlight--set-suffix (choice)
+(defun zcomplete--set-suffix (choice)
   "Set CHOICE suffix to current completion.
 It uses `completion-base-position' to determine the cursor
 position.  If choice is the empty string the command removes the
@@ -179,40 +179,40 @@ suffix."
         (add-face-text-property cursor-pos (+ cursor-pos suffix-len) 'shadow)
         (goto-char cursor-pos)))))
 
-(defun completions-highlight--clear-suffix()
+(defun zcomplete--clear-suffix()
   "Clear completion suffix if set."
-  (completions-highlight--set-suffix ""))
+  (zcomplete--set-suffix ""))
 
-(defvar completions-highlight-minibuffer-map
+(defvar zcomplete-minibuffer-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map minibuffer-local-must-match-map)
     (dolist (key '(up down left right backtab))
-      (define-key map `[(,key)] #'completions-highlight-from-minibuffer))
+      (define-key map `[(,key)] #'zcomplete-from-minibuffer))
 
     (define-key map [remap minibuffer-complete-and-exit] 
#'minibuffer-choose-completion)
     map)
   "Keymap used in minibuffer while *Completions* is active.")
 
-(defvar completions-highlight-completions-map
+(defvar zcomplete-completions-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map completion-list-mode-map)
     (define-key map "\C-g" #'quit-window)
     map)
   "Keymap used in *Completions* while highlighting candidates.")
 
-(defun completions-highlight--minibuffer-tab-through-completions ()
+(defun zcomplete--minibuffer-tab-through-completions ()
   "Default action in `minibuffer-scroll-window' WINDOW.
 This is called when *Completions* window is already visible and
 should be assigned to completion-in-minibuffer-scroll-window."
   (let ((window minibuffer-scroll-window))
     (with-current-buffer (window-buffer window)
-      (if completions-highlight-tab-no-scroll
-          (completions-highlight-from-minibuffer #'next-completion)
+      (if zcomplete-tab-no-scroll
+          (zcomplete-from-minibuffer #'next-completion)
         (if (pos-visible-in-window-p (point-max) window) ;; scroll o go to next
            (if (pos-visible-in-window-p (point-min) window)
                ;; If all completions are shown point-min and point-max
                ;; are both visible.  Then do the highlight.
-               (completions-highlight-from-minibuffer #'next-completion)
+               (zcomplete-from-minibuffer #'next-completion)
              ;; Else the buffer is too long, so better just scroll it to
              ;; the beginning as default behavior.
              (set-window-start window (point-min) nil))
@@ -220,73 +220,73 @@ should be assigned to 
completion-in-minibuffer-scroll-window."
          ;; can scroll.
          (with-selected-window window (scroll-up)))))))
 
-(defun completions-highlight-maybe-close-completions ()
+(defun zcomplete-maybe-close-completions ()
   "Close *Completions* buffer when the command is not in the map."
-  (completions-highlight--clear-suffix)
-  (unless (lookup-key completions-highlight-minibuffer-map
+  (zcomplete--clear-suffix)
+  (unless (lookup-key zcomplete-minibuffer-map
                       (this-single-command-keys))
     (minibuffer-hide-completions)))
 
-(defun completions-highlight--hide-completions-advise ()
+(defun zcomplete--hide-completions-advise ()
   "Function to advise minibuffer-hide-completions."
   (remove-hook 'pre-command-hook
-               #'completions-highlight-maybe-close-completions t))
+               #'zcomplete-maybe-close-completions t))
 
-(defun completions-highlight-setup ()
+(defun zcomplete-setup ()
   "Function to call when enabling the `completion-highlight-mode' mode.
 It is called when showing the *Completions* buffer."
-  (delete-overlay completions-highlight-overlay)
+  (delete-overlay zcomplete-overlay)
 
   (with-current-buffer standard-output
     (when (string= (buffer-name) "*Completions*")
 
-      (add-hook 'pre-command-hook #'completions-highlight--clear-suffix nil t)
-      (add-hook 'post-command-hook #'completions-highlight-select-near nil t)
+      (add-hook 'pre-command-hook #'zcomplete--clear-suffix nil t)
+      (add-hook 'post-command-hook #'zcomplete-select-near nil t)
 
-      ;; Add completions-highlight-completions-map to *Completions*
+      ;; Add zcomplete-completions-map to *Completions*
       (use-local-map (make-composed-keymap
-                      completions-highlight-completions-map 
(current-local-map)))
+                      zcomplete-completions-map (current-local-map)))
 
       ;; Autoselect candidate if enabled
-      (when completions-highlight-autoselect
+      (when zcomplete-autoselect
         (with-selected-window (get-buffer-window (current-buffer) 0)
           (next-completion 1)
-          (completions-highlight-select-near)))))
+          (zcomplete-select-near)))))
 
   (add-hook 'pre-command-hook
-            #'completions-highlight-maybe-close-completions nil t)
+            #'zcomplete-maybe-close-completions nil t)
 
-  ;; Add completions-highlight-minibuffer-map bindings to minibuffer
+  ;; Add zcomplete-minibuffer-map bindings to minibuffer
   (use-local-map (make-composed-keymap
-                  completions-highlight-minibuffer-map (current-local-map))))
+                  zcomplete-minibuffer-map (current-local-map))))
 
 ;;;###autoload
-(define-minor-mode completions-highlight-mode
+(define-minor-mode zcomplete-mode
   "Completion highlight mode to enable candidates highlight in the minibuffer."
   :global t
   :group 'minibuffer
 
-  (if completions-highlight-mode
+  (if zcomplete-mode
       (progn
-        (overlay-put completions-highlight-overlay 'face 
'completions-highlight)
+        (overlay-put zcomplete-overlay 'face 'zcomplete)
 
         (setq minibuffer-tab-through-completions-function-save
              minibuffer-tab-through-completions-function)
 
        (setq minibuffer-tab-through-completions-function
-             #'completions-highlight--minibuffer-tab-through-completions)
+             #'zcomplete--minibuffer-tab-through-completions)
 
-       (add-hook 'completion-setup-hook #'completions-highlight-setup t)
+       (add-hook 'completion-setup-hook #'zcomplete-setup t)
         (advice-add 'minibuffer-hide-completions
-                    :before #'completions-highlight--hide-completions-advise))
+                    :before #'zcomplete--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 #'zcomplete-setup)
     (advice-remove 'minibuffer-hide-completions
-                   #'completions-highlight--hide-completions-advise)))
+                   #'zcomplete--hide-completions-advise)))
 
-(provide 'completions-highlight)
-;;; completions-highlight.el ends here
+(provide 'zcomplete)
+;;; zcomplete.el ends here



reply via email to

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