[Top][All Lists]

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

Re: file-name-shadow-mode

From: David Kastrup
Subject: Re: file-name-shadow-mode
Date: Thu, 24 Mar 2005 01:04:08 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> How 'bout the patch below which makes no assumption (that I know of) about
>> substitute-in-file-name, and will thus work correctly even with weird
>> magic file name handlers.
> Regarding performance of my code: I just bumped into a performance
> problem.  The problem is that substitute-in-file-name can take a
> non-negligible amount of time to execute when there's a "~user" in
> the file name, because it calls getpwnam to figure out whether
> "user" actually exists or not.
> At least here with 8K users in our YP database, my code causes
> file-name-shadow-mode to take around 0.5-1s to refresh the screen
> after each key stroke if there's a ~user in the file name I'm
> editing.

You have seen Richard's proposal of going backwards linearly from the
end and only checking at the "critical" characters like ~, / and $?
It should also be possible to cache a piece of the last shadowing
action and don't look again if no "critical" character has been added
after the previous one in the nonshadowed section.

But actually, I think my proposal about a C level interface into
substitute-in-file-name would be most efficient, robust and
unproblematic in the long run, and possibly useful for other
applications as well.

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

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