help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set default locate switches?


From: Jean Louis
Subject: Re: How to set default locate switches?
Date: Thu, 10 Dec 2020 13:52:12 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Vladimir Nikishkin <lockywolf@gmail.com> [2020-12-10 09:17]:
> Hello, everyone
> 
> I am using locate a lot to find files and directories.
> However, by default locate searches in a case-sensitive way, and in the
> full path. On the other hand, I like searching the way described with
> locate's `-ieb` switches. (existing, case-fold, basename)
> 
> I can, obviously, use C-u locate , but that's more typing.
> 
> Is there a way to set those keys by default?

I am using it this way:

1. I set up the variable: locate-command to following:
   (setq locate-command "/home/data1/protected/bin/locate.sh")

and then in that script I have this:

#!/bin/bash
locate -e -d /home/data1/protected/.locate.database -A -i $@

Which you may customize as you wish.

Normally I am using locate to find my files, not system files. If I
wish to find system files, I run locate in shell.

I do not like that list of my files is available outside of my user
space. My /home is encrypted and list of files should not be on
unencrypted system partition. That is why the -d switch above.

To update my database, I use:

nice -n 19 updatedb -l 0 -U /home/data1/protected -o 
/home/data1/protected/.locate.database #2> /dev/null

Very handy option is -A as it then looks for both terms to be included. For 
term "gnu emacs" it will find this line:
/home/data1/protected/public_html/gnu.support/files/tmp/mtraceEMACS.mtr.7385.lz

You may use several terms to find matching lines containing all of them.

Jean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]