unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* AW: Can't interrupt directory_files_internal run fromtimer-event-handler
@ 2005-08-08 11:27 klaus.berndl
  2005-08-08 20:27 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: klaus.berndl @ 2005-08-08 11:27 UTC (permalink / raw)
  Cc: kzeitler, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1168 bytes --]

>>>     There's no need to run any program just to know if a directory is
>>>     empty.  Emacs has primitives which will tell that directly (e.g.,
>>>     file-attributes) and do that faster.
>>> 
>> How do you determine that from file-attributes?  It is not obvious.

>A combination of file-attributes (looking at the number of links) and
>directory-files should do that, I think.

Hmm, maybe i oversee something here - but when you have to call
directory-files - where is the improvement compared to the problem of the OP?
`directory-files' IS the problem....

Ciao,
Klaus

>> You might try to do it from the number of hard links to the directory,
>> which will normally be 2 for an empty directory, since users normally
>> can't create alternate names for a directory.  But isn't it possible
>> for root to create them?

>I'm not an expert on this, but I think it's impossible to create such
>alternate names, since GNU Find uses this fact to detect directories
>with no subdirectories.


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


[-- Attachment #1.2: Type: text/html, Size: 1926 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: AW: Can't interrupt directory_files_internal run fromtimer-event-handler
  2005-08-08 11:27 klaus.berndl
@ 2005-08-08 20:27 ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2005-08-08 20:27 UTC (permalink / raw)
  Cc: kzeitler, emacs-devel

> Date: Mon, 8 Aug 2005 13:27:46 +0200
> From: <klaus.berndl@sdm.de>
> Cc: <kzeitler@lucent.com>,
> 	<emacs-devel@gnu.org>
> 
> >A combination of file-attributes (looking at the number of links) and
> >directory-files should do that, I think.
> 
> Hmm, maybe i oversee something here - but when you have to call
> directory-files - where is the improvement compared to the problem of
> the OP?

It's an improvement because (1) directory-files is a direct interface
to system calls, and (2) it is more portable since it does not rely on
the existence of `ls', which is only standard on Posix platforms.

> `directory-files' IS the problem....

Well, I'm sorry if I missed something at the beginning of this thread,
but what problem in directory-files are you talking about?

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

* AW: Can't interrupt directory_files_internal run fromtimer-event-handler
@ 2005-08-10  9:35 klaus.berndl
  2005-08-10 19:51 ` Richard M. Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: klaus.berndl @ 2005-08-10  9:35 UTC (permalink / raw)
  Cc: kzeitler, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1450 bytes --]

>> ECB encapslates ist "stealthy" tasks in a loop like:

>>         (while (and (not (input-pending-p))
>>                 ...

>> So IMHO C-g should work....

>Only if each iteration takes a (small) finite time.  The OP's problem is
>that one of the iteration doesn't terminate.

i know - therefore my question concerning while-no-input!
In fact: ECB has some tasks which should be run really(!) stealthy, like
checking if a dir is empty, getting the VC-state of all files in a dir,
checking which files in a dir are read-only... in case of a remote host
an iteration of such a task (i.e. for one file of a dir) can be potentially
long lasting...

With the current available elisp-tools (macos, functions etc.) ECB can run
these tasks only pseudo-stealthy...therefore a way to make this really stealthy
would be very important for ECB so users are not blocked...

I have no preference how to achieve this (while-no-input, with-local-quit etc..),
but i would be great if i could achieve this goal at all!

>> AFAIK there is a new macro in CVS named `while-no-input' (there
>> was a discussion some time ago).... Could using this macro
>> solve problems like that posted from the OP??

>Could be.  Another related new macro is with-local-quit (which uses no new
>internal feature and can thus be backported to other Emacsen).

see above - what would be the best way to enable real stealthiness?

Thanks a lot,
Klaus

[-- Attachment #1.2: Type: text/html, Size: 2200 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: AW: Can't interrupt directory_files_internal run fromtimer-event-handler
  2005-08-10  9:35 AW: " klaus.berndl
@ 2005-08-10 19:51 ` Richard M. Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard M. Stallman @ 2005-08-10 19:51 UTC (permalink / raw)
  Cc: kzeitler, monnier, emacs-devel

    In fact: ECB has some tasks which should be run really(!) stealthy, like
    checking if a dir is empty, getting the VC-state of all files in a dir,
    checking which files in a dir are read-only... in case of a remote host

The best way to do this and make sure it is stealthy is by running a
subprocess.  The subprocess can run in parallel with Emacs.

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

* AW: Can't interrupt directory_files_internal run fromtimer-event-handler
@ 2005-08-12  8:00 klaus.berndl
  2005-08-12 11:59 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: klaus.berndl @ 2005-08-12  8:00 UTC (permalink / raw)
  Cc: kzeitler, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1049 bytes --]

>> With the current available elisp-tools (macos, functions etc.) ECB can run
>> these tasks only pseudo-stealthy...therefore a way to make this really
>> stealthy would be very important for ECB so users are not blocked...

>> I have no preference how to achieve this (while-no-input, with-local-quit
>> etc..), but i would be great if i could achieve this goal at all!

>Do you expect us to figure out what's best for you?

no

>I'd say use while-no-input but you're in a better position to make this call.

the only thing i wanted is: An expert-estimation if while-no-input is a good
way - or with-local-quit - if i remember right you said that this could
easily being backported - maybe its not a really good idea to use a macro
which is only available in forthcoming Emacs 22 - IMHO also users of Emacs 21.X
should get a good solution...

is there a short example how to use this with-local-quit? This would help me
a lot - or a pointer where to find such an example..

Thanks for your help,
Klaus


        Stefan


[-- Attachment #1.2: Type: text/html, Size: 1648 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: Can't interrupt directory_files_internal run fromtimer-event-handler
  2005-08-12  8:00 AW: Can't interrupt directory_files_internal run fromtimer-event-handler klaus.berndl
@ 2005-08-12 11:59 ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2005-08-12 11:59 UTC (permalink / raw)
  Cc: kzeitler, emacs-devel

>> I'd say use while-no-input but you're in a better position to make this call.

> the only thing i wanted is: An expert-estimation if while-no-input is
> a good way - or with-local-quit - if i remember right you said that this
> could easily being backported - maybe its not a really good idea to use
> a macro which is only available in forthcoming Emacs 22 - IMHO also users
> of Emacs 21.X should get a good solution...

while-no-input is a more general and robust way to do what your (while (not
(input-pending-p))) is trying to do.  It's basically designed specifically
for cases like yours.  But it's a new feature in Emacs-22.

with-local-quit is just a convenient macro to temporarily disable
inhibit-quit (that's typically set in timers, post-command-hooks, ...).
The macro-expanded code doesn't use any new feature.  It's not a general
solution to your problem, but it can be used to solve the specific problem
of the OP where C-g wasn't able to unfreeze Emacs.

> is there a short example how to use this with-local-quit? This would help me
> a lot - or a pointer where to find such an example..

cd ...emacs/lisp; grep with-local-quit **/*.el

Read the definition of the macro: it's fairly simple.


        Stefan

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

end of thread, other threads:[~2005-08-12 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-12  8:00 AW: Can't interrupt directory_files_internal run fromtimer-event-handler klaus.berndl
2005-08-12 11:59 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2005-08-10  9:35 AW: " klaus.berndl
2005-08-10 19:51 ` Richard M. Stallman
2005-08-08 11:27 klaus.berndl
2005-08-08 20:27 ` Eli Zaretskii

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