unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4341: 23.1; M-x locate runs synchronously
@ 2009-09-04 19:15 Tom Tromey
  2009-09-10  1:17 ` Juri Linkov
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2009-09-04 19:15 UTC (permalink / raw)
  To: bug-gnu-emacs


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:


Today I ran M-x locate.
This took a little while -- long enough to bother me that Emacs was
locked up for the entire time it was running.

I think it would be preferable to run locate in asynchronously.



If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.5)
 of 2009-08-24 on x86-2.fedora.phx.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.10601901
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i586-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i586-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-bu
 ffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Texinfo

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  auto-fill-function: do-auto-fill
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  flyspell-mode: t
  erc-status-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<switch-frame> <down-mouse-1> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <down-mouse-1> <mouse-1> C-x C-e C-a 
C-x b SPC * h t <tab> <tab> <tab> < <tab> <return> 
M-v M-v C-z o C-x b C-g <switch-frame> <next> <next> 
<prior> C-x k <return> C-x b SPC * h t <tab> <return> 
C-x k <return> <f10> M-v C-l C-u C-n C-u C-n C-l C-n 
C-n C-l M-> p m <tab> y e a h , SPC e x c e p t SPC 
o f t e n y o u <backspace> <backspace> SPC <backspace> 
<backspace> SPC y o u SPC w a n SPC t C-t t o SPC g 
o SPC d e b u g SPC <M-backspace> <M-backspace> s e 
t SPC a SPC b r e a k p o i n t SPC a n d SPC d e b 
u g SPC a n SPC e x p l i c i t SPC c a l l . SPC SPC 
a n SPC o p t i o n SPC m i g h t SPC b e SPC n i c 
e , SPC I SPC d u n n o . <backspace> <return> <f10> 
<f10> <f10> <f10> <f10> <f10> <f10> M-x e m m s - p 
a u s e <return> C-z o C-z o <f10> C-c b C-z o C-a 
<switch-frame> <switch-frame> <switch-frame> <f10> 
<f10> <f10> <f10> <f10> <switch-frame> <switch-frame> 
M-x l o c a t e <return> g n u - s C-t m l . e l <return> 
C-f C-z o C-z o C-z o C-h f l o c a t e <return> C-x 
o C-x 1 C-c b M-x s <backspace> e m a c s - <M-backspace> 
r e p r <backspace> o r t - e m <tab> b <tab> <ret
urn>

Recent messages:
Contacting host: localhost:3128
Reading [text/html]... 1k of 1k (101%)
Reading... done.
#<buffer  *http localhost:3128*<2>>
Making completion list...
call-interactively: Beginning of buffer
Quit
call-interactively: End of buffer
Mark set
Type C-x 1 to delete the help window, C-M-v to scroll help.

Tom






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

* bug#4341: 23.1; M-x locate runs synchronously
  2009-09-04 19:15 bug#4341: 23.1; M-x locate runs synchronously Tom Tromey
@ 2009-09-10  1:17 ` Juri Linkov
  2020-11-03 17:04   ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2009-09-10  1:17 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 4341

> Today I ran M-x locate.
> This took a little while -- long enough to bother me that Emacs was
> locked up for the entire time it was running.
>
> I think it would be preferable to run locate in asynchronously.

This would be possible when `locate' were more similar to `find-dired'.
I don't mean its output should be formatted as files in dired.
For that we could create a new command like `locate-dired'.
But maybe internals of `find-dired' should be generalized to
accept arbitrary commands.  This would allow implementing
`locate-dired', `rgrep-dired', `lgrep-dired', i.e. any command
that searches files with their output formatted for dired
like `find-name-dired', `find-grep-dired' and `find-dired'.

-- 
Juri Linkov
http://www.jurta.org/emacs/





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

* bug#4341: 23.1; M-x locate runs synchronously
  2009-09-10  1:17 ` Juri Linkov
@ 2020-11-03 17:04   ` Michael Heerdegen
  2020-11-03 19:45     ` Juri Linkov
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2020-11-03 17:04 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Tom Tromey, 4341

Juri Linkov <juri@jurta.org> writes:

> > I think it would be preferable to run locate in asynchronously.
>
> This would be possible when `locate' were more similar to `find-dired'.
> I don't mean its output should be formatted as files in dired.
> For that we could create a new command like `locate-dired'.
> But maybe internals of `find-dired' should be generalized to
> accept arbitrary commands.  This would allow implementing
> `locate-dired', `rgrep-dired', `lgrep-dired', i.e. any command
> that searches files with their output formatted for dired
> like `find-name-dired', `find-grep-dired' and `find-dired'.

That sounds nice.

It's not trivial: find calls ls by itself.  From processes Emacs can
receive anything, and it would have to decide by itself on the fly if
it's an ok file line and call "ls" to format the file line.  "locate"
for example can report files that have been deleted in the meantime.

Michael.





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

* bug#4341: 23.1; M-x locate runs synchronously
  2020-11-03 17:04   ` Michael Heerdegen
@ 2020-11-03 19:45     ` Juri Linkov
  2020-11-04 11:14       ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2020-11-03 19:45 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Tom Tromey, 4341

>> > I think it would be preferable to run locate in asynchronously.
>>
>> This would be possible when `locate' were more similar to `find-dired'.
>> I don't mean its output should be formatted as files in dired.
>> For that we could create a new command like `locate-dired'.
>> But maybe internals of `find-dired' should be generalized to
>> accept arbitrary commands.  This would allow implementing
>> `locate-dired', `rgrep-dired', `lgrep-dired', i.e. any command
>> that searches files with their output formatted for dired
>> like `find-name-dired', `find-grep-dired' and `find-dired'.
>
> That sounds nice.
>
> It's not trivial: find calls ls by itself.  From processes Emacs can
> receive anything, and it would have to decide by itself on the fly if
> it's an ok file line and call "ls" to format the file line.  "locate"
> for example can report files that have been deleted in the meantime.

Is it possible to avoid using "ls"?  If ls formatting is not needed,
then the output buffer will look like a Dired buffer with enabled
'dired-hide-details-mode' that shows only file names.





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

* bug#4341: 23.1; M-x locate runs synchronously
  2020-11-03 19:45     ` Juri Linkov
@ 2020-11-04 11:14       ` Michael Heerdegen
  2020-11-08 19:47         ` Juri Linkov
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2020-11-04 11:14 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Tom Tromey, 4341

Juri Linkov <juri@jurta.org> writes:

> Is it possible to avoid using "ls"?  If ls formatting is not needed,
> then the output buffer will look like a Dired buffer with enabled
> 'dired-hide-details-mode' that shows only file names.

I guess it is possible, I have no clue.  It's what we do now.

A downside is that developers would have to keep this in mind when
working on dired, otherwise things may work only partially or break.
For example, if you (in current Emacs master) mark files in a *locate*
output buffer, they get marked and you can act on them, but marked files
are not highlighted.

OTOH, if we leave the corner case of non-existing files aside for now -
when we do call ls (what would be the downsides?), we would get a fully
functional dired support out of the box.

Privately, I have adviced `locate' to insert the list of found files
into a new dired buffer (by calling `dired' with the explicit list of
files), and so far I find it better.  That is actually already all I can
contribute so far.


Regards,

Michael.





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

* bug#4341: 23.1; M-x locate runs synchronously
  2020-11-04 11:14       ` Michael Heerdegen
@ 2020-11-08 19:47         ` Juri Linkov
  2020-11-08 20:23           ` Stefan Kangas
  0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2020-11-08 19:47 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Tom Tromey, 4341

>> Is it possible to avoid using "ls"?  If ls formatting is not needed,
>> then the output buffer will look like a Dired buffer with enabled
>> 'dired-hide-details-mode' that shows only file names.
>
> I guess it is possible, I have no clue.  It's what we do now.
>
> A downside is that developers would have to keep this in mind when
> working on dired, otherwise things may work only partially or break.
> For example, if you (in current Emacs master) mark files in a *locate*
> output buffer, they get marked and you can act on them, but marked files
> are not highlighted.
>
> OTOH, if we leave the corner case of non-existing files aside for now -
> when we do call ls (what would be the downsides?), we would get a fully
> functional dired support out of the box.
>
> Privately, I have adviced `locate' to insert the list of found files
> into a new dired buffer (by calling `dired' with the explicit list of
> files), and so far I find it better.  That is actually already all I can
> contribute so far.

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 :-)





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

* bug#4341: 23.1; M-x locate runs synchronously
  2020-11-08 19:47         ` Juri Linkov
@ 2020-11-08 20:23           ` Stefan Kangas
  2020-11-15 20:20             ` Juri Linkov
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Kangas @ 2020-11-08 20:23 UTC (permalink / raw)
  To: Juri Linkov, Michael Heerdegen; +Cc: Tom Tromey, 4341

Juri Linkov <juri@jurta.org> writes:

> 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.





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

* bug#4341: 23.1; M-x locate runs synchronously
  2020-11-08 20:23           ` Stefan Kangas
@ 2020-11-15 20:20             ` Juri Linkov
  0 siblings, 0 replies; 8+ messages in thread
From: Juri Linkov @ 2020-11-15 20:20 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Michael Heerdegen, Tom Tromey, 4341

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]

>> 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:


[-- Attachment #2: locate.org --]
[-- Type: text/x-org, Size: 846 bytes --]


* 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


[-- Attachment #3: Type: text/plain, Size: 599 bytes --]


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?

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

end of thread, other threads:[~2020-11-15 20:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-04 19:15 bug#4341: 23.1; M-x locate runs synchronously Tom Tromey
2009-09-10  1:17 ` Juri Linkov
2020-11-03 17:04   ` Michael Heerdegen
2020-11-03 19:45     ` Juri Linkov
2020-11-04 11:14       ` Michael Heerdegen
2020-11-08 19:47         ` Juri Linkov
2020-11-08 20:23           ` Stefan Kangas
2020-11-15 20:20             ` Juri Linkov

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).