emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/helm c06bcd567d 1/2: Get rid of glob var helm-show-complet


From: ELPA Syncer
Subject: [nongnu] elpa/helm c06bcd567d 1/2: Get rid of glob var helm-show-completion-overlay
Date: Wed, 1 Nov 2023 04:01:00 -0400 (EDT)

branch: elpa/helm
commit c06bcd567d2118eba9a25bec3218d6bd2e53f369
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Get rid of glob var helm-show-completion-overlay
    
    Let bind overlay in the macro and use lexbind.
---
 helm-elisp.el | 68 +++++++++++++++++++++++++++--------------------------------
 1 file changed, 31 insertions(+), 37 deletions(-)

diff --git a/helm-elisp.el b/helm-elisp.el
index 0741597080..4780a9e392 100644
--- a/helm-elisp.el
+++ b/helm-elisp.el
@@ -154,20 +154,6 @@ display."
 ;;
 ;; Provide show completion with macro `with-helm-show-completion'.
 
-(defvar helm-show-completion-overlay nil)
-
-;; Called each time cursor move in helm-buffer.
-(defun helm-show-completion ()
-  (with-helm-current-buffer
-    (overlay-put helm-show-completion-overlay
-                 'display (substring-no-properties
-                           (helm-get-selection)))))
-
-(defun helm-show-completion-init-overlay (beg end)
-  (setq helm-show-completion-overlay (make-overlay beg end))
-  (overlay-put helm-show-completion-overlay
-               'face 'helm-lisp-show-completion))
-
 (defun helm-show-completion-default-display-function (buffer &rest _args)
   "A special resized Helm window is used depending on position in BUFFER."
   (with-selected-window (selected-window)
@@ -194,29 +180,37 @@ completion in `helm-current-buffer'.
 BODY is an Helm call where we want to enable show completion.
 If `helm-turn-on-show-completion' is nil do nothing."
   (declare (indent 2) (debug t))
-  `(unwind-protect
-        (if helm-turn-on-show-completion
-            (let ((helm-move-selection-after-hook
-                   (append (list 'helm-show-completion)
-                           helm-move-selection-after-hook))
-                  (helm-split-window-default-side
-                   (if (eq helm-split-window-default-side 'same)
-                       'below helm-split-window-default-side))
-                  helm-split-window-inside-p
-                  helm-reuse-last-window-split-state)
-              (helm-set-local-variable
-               'helm-display-function
-               (or helm-show-completion-display-function
-                   'helm-default-display-buffer))
-              (with-helm-after-update-hook
-                ;; Show immediately first candidate as soon as helm popup.
-                (helm-show-completion))
-              (helm-show-completion-init-overlay ,beg ,end)
-              ,@body)
-          ,@body)
-     (when (and helm-show-completion-overlay
-                (overlayp helm-show-completion-overlay))
-       (delete-overlay helm-show-completion-overlay))))
+  `(let ((overlay (make-overlay ,beg ,end)))
+     (unwind-protect
+          (if helm-turn-on-show-completion
+              (let ((helm-move-selection-after-hook
+                     (append (list (lambda ()
+                                     (with-helm-current-buffer
+                                       (overlay-put overlay
+                                                    'display 
(substring-no-properties
+                                                              
(helm-get-selection))))))
+                             helm-move-selection-after-hook))
+                    (helm-split-window-default-side
+                     (if (eq helm-split-window-default-side 'same)
+                         'below helm-split-window-default-side))
+                    helm-split-window-inside-p
+                    helm-reuse-last-window-split-state)
+                (helm-set-local-variable
+                 'helm-display-function
+                 (or helm-show-completion-display-function
+                     'helm-default-display-buffer))
+                (with-helm-after-update-hook
+                  ;; Show immediately first candidate as soon as helm popup.
+                  (with-helm-current-buffer
+                    (overlay-put overlay
+                                 'display (substring-no-properties
+                                           (helm-get-selection)))))
+                (overlay-put overlay 'face 'helm-lisp-show-completion)
+                ,@body)
+            ,@body)
+       (when (and overlay
+                  (overlayp overlay))
+         (delete-overlay overlay)))))
 
 
 ;;; Lisp symbol completion.



reply via email to

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