From 1d84447e6814b5dfc9408b5442654efbbf022d2a Mon Sep 17 00:00:00 2001 From: Maximilian Wolff Date: Sun, 7 Feb 2021 23:01:43 +0100 Subject: [PATCH] [fasd] Revise layer Add missing standard headers Make funcs.el define only functions and move init code for ivy into fasd-init function. --- layers/+tools/fasd/funcs.el | 22 ++++++++++++---------- layers/+tools/fasd/packages.el | 26 +++++++++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/layers/+tools/fasd/funcs.el b/layers/+tools/fasd/funcs.el index 5b89097ba..2d9b27701 100644 --- a/layers/+tools/fasd/funcs.el +++ b/layers/+tools/fasd/funcs.el @@ -1,10 +1,12 @@ -(with-eval-after-load 'fasd - (defun ivy-search-from-action (x) - (if (file-directory-p x) - (spacemacs/counsel-search dotspacemacs-search-tools nil x) - (message "Selected item is not a directory path"))) - - (ivy-set-actions - 'fasd-find-file - '(("o" fasd-find-file-action "find-file") - ("s" ivy-search-from-action "search-from")))) +;;; funcs.el --- fasd Layer packages File for Spacemacs +;; +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defun ivy-search-from-action (x) + (if (file-directory-p x) + (spacemacs/counsel-search dotspacemacs-search-tools nil x) + (message "Selected item is not a directory path"))) diff --git a/layers/+tools/fasd/packages.el b/layers/+tools/fasd/packages.el index 3e6aa04ae..8f0ae3558 100644 --- a/layers/+tools/fasd/packages.el +++ b/layers/+tools/fasd/packages.el @@ -1,11 +1,17 @@ -(setq fasd-packages - '((helm-fasd :requires helm - :location (recipe :repo "ajsalminen/helm-fasd" - :fetcher github - :files ("*.el"))) - (fasd :toggle (not (configuration-layer/layer-used-p 'helm))))) - +;;; packages.el --- fasd Layer packages File for Spacemacs +;; +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 +(defconst fasd-packages + '((helm-fasd :requires helm + :location (recipe :repo "ajsalminen/helm-fasd" + :fetcher github + :files ("*.el"))) + (fasd :toggle (not (configuration-layer/layer-used-p 'helm))))) (defun fasd/init-fasd () "initializes fasd-emacs and adds a key binding to `SPC f z'" @@ -26,6 +32,12 @@ (spacemacs/set-leader-keys "faf" 'fasd-find-file-only) (spacemacs/set-leader-keys "fas" 'fasd-find-file) + (when (configuration-layer/layer-used-p 'ivy) + (ivy-set-actions + 'fasd-find-file + '(("o" fasd-find-file-action "find-file") + ("s" ivy-search-from-action "search-from")))) + ;; we will fall back to using the default completing-read function, which is helm once helm is loaded. (setq fasd-completing-read-function 'nil))))