From 9f7914fa049a3742f4ba7113097a90c75e9aa238 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Sun, 10 Jan 2016 01:21:52 -0500 Subject: [PATCH] helm: unified :config blocks in init-helm --- layers/+completion/spacemacs-helm/packages.el | 103 +++++++++--------- 1 file changed, 51 insertions(+), 52 deletions(-) diff --git a/layers/+completion/spacemacs-helm/packages.el b/layers/+completion/spacemacs-helm/packages.el index b4688b587..db7c67af6 100644 --- a/layers/+completion/spacemacs-helm/packages.el +++ b/layers/+completion/spacemacs-helm/packages.el @@ -36,58 +36,6 @@ (use-package helm :defer 1 :commands (spacemacs/helm-find-files) - :config - (progn - (when (and dotspacemacs-helm-resize - (or (eq dotspacemacs-helm-position 'bottom) - (eq dotspacemacs-helm-position 'top))) - (setq helm-autoresize-min-height 10) - (helm-autoresize-mode 1)) - - ;; from https://www.reddit.com/r/emacs/comments/2z7nbv/lean_helm_window/ - (defvar helm-source-header-default-background - (face-attribute 'helm-source-header :background)) - (defvar helm-source-header-default-foreground - (face-attribute 'helm-source-header :foreground)) - (defvar helm-source-header-default-box - (face-attribute 'helm-source-header :box)) - (defvar helm-source-header-default-height - (face-attribute 'helm-source-header :height) ) - - (defun helm-toggle-header-line () - "Hide the `helm' header is there is only one source." - (when dotspacemacs-helm-no-header - (if (> (length helm-sources) 1) - (set-face-attribute - 'helm-source-header - nil - :foreground helm-source-header-default-foreground - :background helm-source-header-default-background - :box helm-source-header-default-box - :height helm-source-header-default-height) - (set-face-attribute - 'helm-source-header - nil - :foreground (face-attribute 'helm-selection :background) - :background (face-attribute 'helm-selection :background) - :box nil - :height 0.1)))) - (add-hook 'helm-before-initialize-hook 'helm-toggle-header-line) - - (defun spacemacs/helm-find-files (arg) - "Custom spacemacs implementation for calling helm-find-files-1. - -Removes the automatic guessing of the initial value based on thing at point. " - (interactive "P") - (let* ((hist (and arg helm-ff-history (helm-find-files-history))) - (default-input hist ) - (input (cond ((and (eq major-mode 'dired-mode) default-input) - (file-name-directory default-input)) - ((and (not (string= default-input "")) - default-input)) - (t (expand-file-name (helm-current-directory)))))) - (set-text-properties 0 (length input) nil input) - (helm-find-files-1 input )))) :init (progn (setq helm-prevent-escaping-from-minibuffer t @@ -339,6 +287,57 @@ Removes the automatic guessing of the initial value based on thing at point. " (progn (helm-mode +1) + (when (and dotspacemacs-helm-resize + (or (eq dotspacemacs-helm-position 'bottom) + (eq dotspacemacs-helm-position 'top))) + (setq helm-autoresize-min-height 10) + (helm-autoresize-mode 1)) + + ;; from https://www.reddit.com/r/emacs/comments/2z7nbv/lean_helm_window/ + (defvar helm-source-header-default-background + (face-attribute 'helm-source-header :background)) + (defvar helm-source-header-default-foreground + (face-attribute 'helm-source-header :foreground)) + (defvar helm-source-header-default-box + (face-attribute 'helm-source-header :box)) + (defvar helm-source-header-default-height + (face-attribute 'helm-source-header :height) ) + + (defun helm-toggle-header-line () + "Hide the `helm' header is there is only one source." + (when dotspacemacs-helm-no-header + (if (> (length helm-sources) 1) + (set-face-attribute + 'helm-source-header + nil + :foreground helm-source-header-default-foreground + :background helm-source-header-default-background + :box helm-source-header-default-box + :height helm-source-header-default-height) + (set-face-attribute + 'helm-source-header + nil + :foreground (face-attribute 'helm-selection :background) + :background (face-attribute 'helm-selection :background) + :box nil + :height 0.1)))) + (add-hook 'helm-before-initialize-hook 'helm-toggle-header-line) + + (defun spacemacs/helm-find-files (arg) + "Custom spacemacs implementation for calling helm-find-files-1. + +Removes the automatic guessing of the initial value based on thing at point. " + (interactive "P") + (let* ((hist (and arg helm-ff-history (helm-find-files-history))) + (default-input hist ) + (input (cond ((and (eq major-mode 'dired-mode) default-input) + (file-name-directory default-input)) + ((and (not (string= default-input "")) + default-input)) + (t (expand-file-name (helm-current-directory)))))) + (set-text-properties 0 (length input) nil input) + (helm-find-files-1 input ))) + ;; helm-locate uses es (from everything on windows, ;; which doesnt like fuzzy) (helm-locate-set-command)