Closed muralikodali closed 3 years ago
There was a typo in the code. Please check now?
now it gives the following error :
symbol's value as variable is void: consult-dir-sources
Just tested it, it works for me. This error sounds like you ran this code before consult-dir was loaded. Can you try running consult-dir once and then running the fasd integration code?
my consult-dir configuration is as shown below :
;; consult-dir - directory jump
(use-package consult-dir
:straight t
:bind (("C-x C-d" . consult-dir)
:map minibuffer-local-completion-map
("C-x C-d" . consult-dir)
("C-x C-j" . consult-dir-jump-file)))
(setq consult-dir-project-list-function nil)
;; A function that returns a list of directories
(defun consult-dir--fasd-dirs ()
"Return list of fasd dirs."
(split-string (shell-command-to-string "fasd -ld") "\n" t))
; A consult source that calls this function
(defvar consult-dir--source-fasd
`(:name "Fasd dirs"
:narrow ?f
:category file
:face consult-file
:history file-name-history
:enabled ,(lambda () (executable-find "fasd"))
:items ,#'consult-dir--fasd-dirs)
"Fasd directory source for `consult-dir'.")
;; Adding to the list of consult-dir sources
(add-to-list 'consult-dir-sources 'consult-dir--source-fasd t)
It looks like you forgot a :config block. Try this:
;; consult-dir - directory jump
(use-package consult-dir
:straight t
:bind (("C-x C-d" . consult-dir)
:map minibuffer-local-completion-map
("C-x C-d" . consult-dir)
("C-x C-j" . consult-dir-jump-file))
;; THIS BLOCK TO BE LOADED AFTER LOADING CONSULT-DIR
:config
(setq consult-dir-project-list-function nil)
;; A function that returns a list of directories
(defun consult-dir--fasd-dirs ()
"Return list of fasd dirs."
(split-string (shell-command-to-string "fasd -ld") "\n" t))
; A consult source that calls this function
(defvar consult-dir--source-fasd
`(:name "Fasd dirs"
:narrow ?f
:category file
:face consult-file
:history file-name-history
:enabled ,(lambda () (executable-find "fasd"))
:items ,#'consult-dir--fasd-dirs)
"Fasd directory source for `consult-dir'.")
;; Adding to the list of consult-dir sources
(add-to-list 'consult-dir-sources 'consult-dir--source-fasd t))
thanks for your reply.
it is a configuration problem. After changing configuration as suggested by you, it is working fine now.
i have added fasd example given in the README.
it has shown the error Symbol's function definition is void: :name