Emacs has a concept of "current directory", shown by doing

M-x pwd

I can change to specific directory by doing M-x cd

I recently installed swiper/counsel/ivy, to make searching easier. Since the locate command is not that great on MacOS, I added this bit

(setq locate-command "mdfind")
(setq counsel-locate-cmd 'counsel-locate-cmd-mdfind)

My issue is this. Let's say I cd to /folder1/, and then I invoke M-x counsel-locate and start typing

id rsa

I am shown id_rsa.pub files from other folders, for example /folder2/id_rsa.pub. I was expecting counsel-locate to respect my "current directory" when doing its recursive search.

What am I doing wrong?

  • By default spotlight searches the entire disk. mdfind has a parameter -onlyin to limit searches to a specific folder. It may be worth submitting an issue to the ivy github repo to make this available when using a universal argument. – InHarmsWay Jan 25 '18 at 20:02
  • It sounds like you want to find a file in a set of sub directories. I use projectile and its related counsel commands. – eflanigan00 Jan 26 '18 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.