Skip to content

walseb/ellocate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 

Repository files navigation

https://melpa.org/packages/ellocate-badge.svg

Ellocate is a re-implementation of locate written in Emacs-Lisp. It supports all completion backends (ivy, helm, ido, etc)

Comparison

EllocateLocate (and elisp wrappers like counsel-locate)Find (and elisp wrappers like counsel-find)
SpeedFastFastSlow
Easy to configure multiple search pathsYesNoYes (always searches down current directory)
Switch search databases used depending on current directoryYesWith a lot of effortN/A
Works the same on every platform that has the dependenciesYesNo (Some systems use mlocate while others use GNU locate)Yes
DependenciesFindmlocate or GNU locateFind
Tramp supportI think soNoYes

Ellocate search

Usage

The function ellocate scans recursively down the directory and creates a database file to store the results in as specified by ellocate-scan-dirs. By default ellocate only searches all directories below the current directory. To search all files in the current database either run ellocate-all or run ellocate with a universal argument ellocate-scan-dirs is configured like this:

(setq ellocate-scan-dirs '(("~/" "~/ellocate-home-db")
                           ("/mnt/USB" "~/ellocate-usb-drive-db")
                           ;; I want this directory to be re-scanned on first search after every emacs restart by not creating a database file for it
                           ("/mnt/USB2" nil)
                           ;; Never make your scan paths overlap like this:
                           ;; ("/mnt/USB2/newFolder" nil)
                           ;; This is pretty useful if you have many USB devices, but remember to not overlap like this would if it wasn't commented (because the subdirectory /mnt/USB is also scanned as defined above)
                           ;; ("/mnt/" nil)
                           ))

Where the first element in all of the lists inside ellocate-scan-dirs is the base directory to scan and the second is in which file to store the search results so that ellocate can read read it if Emacs is restarted to give ellocate faster initial startup times. If the database is nil, ellocate will have to re-scan the directory if run every time Emacs is restarted instead of just reading a database containing the scanned files.

ellocate-clear clears the cache corresponding to your current directory and ellocate-clear-all clears all defined caches. These both forces ellocate to refresh its search entries. Do this if your file-system has changed and you want that change reflected in ellocate.

Q&A

Why not just use locate with one huge database containing everything?

Let’s say you have a 2 TB HDD mounted in /dev/hdd that you occasionally want to search through, but right now you want to find something new in /home/user but to do that you have to generate a new locate search database which means it has to search through everything inside /dev/hdd and that will probably take like 30 minutes if it’s full of files. With ellocate on the other hand you can selectively delete and reconstruct the search database corresponding to /home/user. You also have a lot more options like you can tell ellocate to not save the database you build from /dev/hdd to disk, so that on every restart after running ellocate you automatically re-scan it. I think you should also be able to create search databases over ssh connections, which is impossible with locate unless you mount the remote computer as a local drive.

About

A more flexible locate implemented in Emacs Lisp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published