GNU bug report logs - #4341
23.1; M-x locate runs synchronously

Previous Next

Package: emacs;

Reported by: Tom Tromey <tromey <at> redhat.com>

Date: Fri, 4 Sep 2009 19:20:04 UTC

Severity: wishlist

Full log


Message #30 received at 4341 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Tom Tromey <tromey <at> redhat.com>, 4341 <at> debbugs.gnu.org
Subject: Re: bug#4341: 23.1; M-x locate runs synchronously
Date: Sun, 15 Nov 2020 22:20:05 +0200
[Message part 1 (text/plain, inline)]
>> Maybe this would be an improvement.  But sorry, I can't help in testing:
>> while slow `M-x locate' used to be a problem in the past, nowadays it
>> finishes within 1 sec, so I simply won't notice the difference :-)
>
> FWIW, here it takes much longer than that.  It would be very welcome if
> someone would want to work on making it asynchronous.

What I can do to help is to post my current customization:

[locate.org (text/x-org, inline)]
* Highlight all matches in the =*Locate*= buffer like in the =*Occur*= buffer:

#+begin_src emacs-lisp
(add-hook 'locate-post-command-hook
          (lambda ()
            (save-excursion
              (goto-char (point-min))
              (when (or (re-search-forward "Matches for .* using filter \\(.*\\):" nil t)
                        (re-search-forward "Matches for \\(.*\\):" nil t))
                (highlight-regexp
                 (match-string-no-properties 1)
                 'match)))))
#+end_src

* Ignore case in locate command

#+begin_src emacs-lisp
(with-eval-after-load 'locate
  ;; Redefine ‘locate-default-make-command-line’.
  (defun locate-make-command-line-ignore-case (search-string)
    (list locate-command "-i" search-string))
  (setq locate-make-command-line 'locate-make-command-line-ignore-case))
#+end_src

[Message part 3 (text/plain, inline)]
With this I see no problems with adding a new option to use ls with switches
as demonstrated by this code:

#+begin_src emacs-lisp
(defun locate-make-command-line-ls (search-string)
  (list shell-file-name
        shell-command-switch
        (format "%s %s %s  | xargs ls -ls" locate-command "-i" search-string) ))
(setq locate-make-command-line 'locate-make-command-line-ls)
#+end_src

Then it's possible to enable 'dired-virtual-mode' in the output buffer
in 'locate-post-command-hook'.

Or maybe locate.el should be obsoleted, and a new option to run 'locate'
should be added to find-dired.el?

This bug report was last modified 4 years and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.