[fasd] Revise layer

Add missing standard headers
Make funcs.el define only functions
and move init code for ivy into
fasd-init function.
This commit is contained in:
Maximilian Wolff 2021-02-07 23:01:43 +01:00
parent dfd5532429
commit 1d84447e68
No known key found for this signature in database
GPG Key ID: 2DD07025BFDBD89A
2 changed files with 31 additions and 17 deletions

View File

@ -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")))

View File

@ -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))))