karthink / consult-dir

Insert paths into the minibuffer prompt in Emacs
GNU General Public License v3.0
161 stars 9 forks source link

consult-dir throws error; debugging attached #21

Closed poulpoulsen closed 2 years ago

poulpoulsen commented 2 years ago

hello, i just tested it and unfortunately consult-dir throws an error. consult-dir-jump-file works great. i'm on emacs 29 fedora 35.

any ideas?

regards poul

` Debugger entered--Lisp error: (wrong-type-argument stringp nil) find-file-name-handler(nil abbreviate-file-name) abbreviate-file-name(nil) mapcar(abbreviate-file-name ("~/" "~/.emacs.d/elfeed/" "~/.emacs.d/" "~/.emacs.d/contrib-lisp/consult-notes/" "/tmp/emm.mV0A2P/" "~/Dokumente/zk/" "~/Dokumente/zk/Held/" "~/Dokumente/denote/" "~/src/prot-dotfiles/emacs/.emacs.d/" "~/.emacs.d/url/" "~/.config/nvim/lua/" "~/Dokumente/tidalclub/" "~/.emacs.d/contrib-lisp/empv.el/" "~/Dokumente/" "~/Dokumente/zk/202206/17T205042.481988/" "~/src/emacs/src/" "~/Dokumente/zk/Scheidung/" "/usr/local/share/emacs/29.0.50/lisp/" "~/.emacs.d/prot-lisp/" "~/Dokumente/zk/202205/25T192617.207067/" "~/Downloads/" "~/Dokumente/zk/202205/09T203717.108152/" "~/src/linux-minidisc/netmd/" "/usr/local/share/emacs/29.0.50/etc/" "~/Dokumente/zk/202204/01T204126.860522/" "~/Dokumente/usls/Garten/Grotte/" "~/Dokumente/zk/202203/24T210209.443664/" "~/Schreibtisch/" "~/Dokumente/usls/Held/" "~/.emacs.d/contrib-lisp/" "~/src/haskell-projekte/einführung/" "~/.ssh/" "~/src/haskell-projekte/einführung/src/" "/usr/local/share/emacs/28.0.90/etc/" nil "~/src/emacs/etc/" "~/Downloads/claws-mail-4.0.0/" "/usr/local/bin/" "~/.config/pipewire/media-session.d/" "/usr/local/share/emacs/28.0.50/lisp/" "/usr/bin/")) (seq-filter in-other-source-p (mapcar #'abbreviate-file-name (delete-dups (mapcar #'file-name-directory recentf-list)))) (let* ((current-dirs (consult-dir--default-dirs)) (proj-list-hash (consult-dir--project-list-make)) (in-other-source-p #'(lambda (dir) (not (or (and proj-list-hash ...) (member dir current-dirs)))))) (seq-filter in-other-source-p (mapcar #'abbreviate-file-name (delete-dups (mapcar #'file-name-directory recentf-list))))) consult-dir--recentf-dirs()

f(compiled-function (src) #<bytecode 0x2b520e7bbafeaed>)((:name "Recentf dirs" :narrow 114 :category file :face consult-file :history file-name-history :enabled (closure (projectile-known-projects t) nil recentf-mode) :items consult-dir--recentf-dirs))

mapc(#f(compiled-function (src) #<bytecode 0x2b520e7bbafeaed>) [(:name "Bookmarks" :narrow 109 :category bookmark :face consult-file :history bookmark-history :items consult-dir--bookmark-dirs) (:name "This directory/project" :narrow 46 :category file :face consult-file :history file-name-history :items consult-dir--default-dirs) (:name "Projects" :narrow 112 :category file :face consult-file :history file-name-history :enabled (closure (projectile-known-projects t) nil consult-dir-project-list-function) :items (closure (projectile-known-projects t) nil (let ((current-dirs (consult-dir--default-dirs))) (seq-filter #'(lambda ... ...) (consult-dir--project-dirs))))) (:name "Recentf dirs" :narrow 114 :category file :face consult-file :history file-name-history :enabled (closure (projectile-known-projects t) nil recentf-mode) :items consult-dir--recentf-dirs)]) seq-do(#f(compiled-function (src) #<bytecode 0x2b520e7bbafeaed>) [(:name "Bookmarks" :narrow 109 :category bookmark :face consult-file :history bookmark-history :items consult-dir--bookmark-dirs) (:name "This directory/project" :narrow 46 :category file :face consult-file :history file-name-history :items consult-dir--default-dirs) (:name "Projects" :narrow 112 :category file :face consult-file :history file-name-history :enabled (closure (projectile-known-projects t) nil consult-dir-project-list-function) :items (closure (projectile-known-projects t) nil (let ((current-dirs (consult-dir--default-dirs))) (seq-filter #'(lambda ... ...) (consult-dir--project-dirs))))) (:name "Recentf dirs" :narrow 114 :category file :face consult-file :history file-name-history :enabled (closure (projectile-known-projects t) nil recentf-mode) :items consult-dir--recentf-dirs)]) consult--multi-candidates([(:name "Bookmarks" :narrow 109 :category bookmark :face consult-file :history bookmark-history :items consult-dir--bookmark-dirs) (:name "This directory/project" :narrow 46 :category file :face consult-file :history file-name-history :items consult-dir--default-dirs) (:name "Projects" :narrow 112 :category file :face consult-file :history file-name-history :enabled (closure (projectile-known-projects t) nil consult-dir-project-list-function) :items (closure (projectile-known-projects t) nil (let ((current-dirs (consult-dir--default-dirs))) (seq-filter #'(lambda ... ...) (consult-dir--project-dirs))))) (:name "Recentf dirs" :narrow 114 :category file :face consult-file :history file-name-history :enabled (closure (projectile-known-projects t) nil recentf-mode) :items consult-dir--recentf-dirs)]) consult--multi((consult-dir--source-bookmark consult-dir--source-default consult-dir--source-project consult-dir--source-recentf) :prompt "In directory: " :sort nil) (let ((match (consult--multi consult-dir-sources :prompt (or prompt "Switch directory: ") :sort nil))) (let ((val (plist-get (cdr match) :category))) (cond ((eq val 'bookmark) (let nil (bookmark-get-filename (car match)))) ((eq val 'file) (let nil (car match)))))) consult-dir--pick("In directory: ") (let ((new-dir (consult-dir--pick "In directory: ")) (default-directory new-dir)) (call-interactively consult-dir-default-command)) (if (minibufferp) (let ((enable-recursive-minibuffers t) (file-name (file-name-nondirectory (minibuffer-contents))) (new-dir (consult-dir--pick)) (new-full-name (concat (file-name-as-directory new-dir) file-name))) (if new-dir (progn (if consult-dir-shadow-filenames (insert "/" new-full-name) (delete-minibuffer-contents) (insert new-full-name))))) (let ((new-dir (consult-dir--pick "In directory: ")) (default-directory new-dir)) (call-interactively consult-dir-default-command))) consult-dir() funcall-interactively(consult-dir) call-interactively(consult-dir nil nil) command-execute(consult-dir) `

poulpoulsen commented 2 years ago

i find the mistake! there is a line in recentf-list "~" this is interpreted as nil ??? i delete the line and now it works. but i dont know why this is eval to nil. do you know that? regards poul

karthink commented 2 years ago

there is a line in recentf-list "~" this is interpreted as nil

Thanks, that's useful. "~" is not a valid directory or file, the closest match would be "~/" which is handled correctly by consult-dir. Do you have any ideas why your recentf-list contains "~"?

poulpoulsen commented 2 years ago

hello, unfortunately not. but here ~ is valid. i see the following files if i only input ~. strange.

Bildschirmfoto von 2022-07-23 19-33-26

and i'm suprised, that the program is not simple "hop" over invalid directories, mean simple ignore them.

Regards Poul

karthink commented 2 years ago

Should be fixed in 8abf62df, please test.

karthink commented 2 years ago

I see. I'll fix this soon, but I'm still curious about how you ended up with a directory in your recentf-list. recentf only tracks files by default. Are you using any other packages that modify recentf?

poulpoulsen @.***> writes:

hello, unfortunately not. but here ~ is valid. i see the following files if i only input ~. strange.

Bildschirmfoto von 2022-07-23 19-33-26

and i'm suprised, that the program is not simple "hop" over invalid directories, mean simple ignore them.

Regards Poul

-- Reply to this email directly or view it on GitHub: https://github.com/karthink/consult-dir/issues/21#issuecomment-1193161986 You are receiving this because you commented.

Message ID: @.***>