From ded367eef56201604ad3fddd63fe427866328150 Mon Sep 17 00:00:00 2001 From: Aria Date: Wed, 30 May 2018 13:55:09 +1000 Subject: [PATCH] Add posframes to helm in emacs 26+ --- init.example.el | 3 ++- modules/completion/helm/config.el | 19 +++++++++++++++++++ modules/completion/helm/packages.el | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/init.example.el b/init.example.el index 767ea199d..d8328ab96 100644 --- a/init.example.el +++ b/init.example.el @@ -20,7 +20,8 @@ (company ; the ultimate code completion backend +auto ; as-you-type code completion +childframe) ; a nicer company UI (Emacs 26+ only) - ;helm ; the *other* search engine for love and life + ;(helm ; the *other* search engine for love and life + ; +childframe) ; uses childframes for popups (Emacs 26+ only) ;ido ; the other *other* search engine... (ivy ; a search engine for love and life +childframe) ; uses childframes for popups (Emacs 26+ only) diff --git a/modules/completion/helm/config.el b/modules/completion/helm/config.el index 7caa3e8a4..7d22b1c08 100644 --- a/modules/completion/helm/config.el +++ b/modules/completion/helm/config.el @@ -63,6 +63,25 @@ (require 'helm-projectile) (set-keymap-parent helm-projectile-find-file-map helm-map) + ;; Posframes! + (when (and EMACS26+ (featurep! +childframe)) + (defvar helm-posframe-buffer nil) + + (defun helm-posframe-display (buffer &optional _resume) + (posframe-show + (setq helm-posframe-buffer buffer) + :poshandler #'posframe-poshandler-frame-bottom-left-corner + :left-fringe 10 + :width (frame-width) + :height 16 ;; ivy/+childframe uses 16 + :respect-header-line t)) + + (defun helm-posframe-cleanup () + (posframe-hide helm-posframe-buffer)) + + (add-hook! 'helm-cleanup-hook #'helm-posframe-cleanup) + (setq helm-display-function #'helm-posframe-display)) + ;;; Helm hacks (defun +helm*replace-prompt (plist) "Globally replace helm prompts with `+helm-global-prompt'." diff --git a/modules/completion/helm/packages.el b/modules/completion/helm/packages.el index b4199e698..fb11d95b5 100644 --- a/modules/completion/helm/packages.el +++ b/modules/completion/helm/packages.el @@ -10,3 +10,5 @@ (package! helm-projectile) (package! helm-swoop) (package! wgrep) +(when (and EMACS26+ (featurep! +childframe)) + (package! posframe))