all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to set default locate switches?
@ 2020-12-10  6:16 Vladimir Nikishkin
  2020-12-10 10:52 ` Jean Louis
  2020-12-10 14:06 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: Vladimir Nikishkin @ 2020-12-10  6:16 UTC (permalink / raw)
  To: help-gnu-emacs

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?

Thanks,
Vlad

-- 
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to set default locate switches?
  2020-12-10  6:16 How to set default locate switches? Vladimir Nikishkin
@ 2020-12-10 10:52 ` Jean Louis
  2020-12-10 14:06 ` Eli Zaretskii
  1 sibling, 0 replies; 4+ messages in thread
From: Jean Louis @ 2020-12-10 10:52 UTC (permalink / raw)
  To: Vladimir Nikishkin; +Cc: help-gnu-emacs

* 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to set default locate switches?
  2020-12-10  6:16 How to set default locate switches? Vladimir Nikishkin
  2020-12-10 10:52 ` Jean Louis
@ 2020-12-10 14:06 ` Eli Zaretskii
  2020-12-10 17:31   ` Michael Heerdegen
  1 sibling, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2020-12-10 14:06 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Vladimir Nikishkin <lockywolf@gmail.com>
> Date: Thu, 10 Dec 2020 14:16:43 +0800
> 
> 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?

You should be able to provide your own function to compute the
'locate' command line, and set the variable locate-make-command-line
to point to that function instead of locate-default-make-command-line.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to set default locate switches?
  2020-12-10 14:06 ` Eli Zaretskii
@ 2020-12-10 17:31   ` Michael Heerdegen
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Heerdegen @ 2020-12-10 17:31 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

> You should be able to provide your own function to compute the
> 'locate' command line, and set the variable locate-make-command-line
> to point to that function instead of locate-default-make-command-line.

Additionally enabling `locate-prompt-for-command' comes handy so that
you sees what you get.

Michael.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-10 17:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-10  6:16 How to set default locate switches? Vladimir Nikishkin
2020-12-10 10:52 ` Jean Louis
2020-12-10 14:06 ` Eli Zaretskii
2020-12-10 17:31   ` Michael Heerdegen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.