From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: file-name-shadow-mode Date: Thu, 24 Mar 2005 01:04:08 +0100 Message-ID: References: <200503180435.j2I4Z2R18621@raven.dms.auburn.edu> <87is3p5zp2.fsf-monnier+emacs@gnu.org> <200503191521.j2JFL8901509@raven.dms.auburn.edu> <87r7ibziw6.fsf-monnier+emacs@gnu.org> <200503200230.j2K2UvS03067@raven.dms.auburn.edu> <87is3lw2yk.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1111622980 28753 80.91.229.2 (24 Mar 2005 00:09:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 24 Mar 2005 00:09:40 +0000 (UTC) Cc: miles@gnu.org, snogglethorpe@gmail.com, teirllm@dms.auburn.edu, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 24 01:12:08 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DEFwt-00009B-2i for ged-emacs-devel@m.gmane.org; Thu, 24 Mar 2005 01:11:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEGC3-0005fM-TJ for ged-emacs-devel@m.gmane.org; Wed, 23 Mar 2005 19:27:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DEG5w-0003jf-R2 for emacs-devel@gnu.org; Wed, 23 Mar 2005 19:21:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DEG5v-0003j1-Cr for emacs-devel@gnu.org; Wed, 23 Mar 2005 19:21:03 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEG5v-0003iw-0M for emacs-devel@gnu.org; Wed, 23 Mar 2005 19:21:03 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DEFph-00026A-ER for emacs-devel@gnu.org; Wed, 23 Mar 2005 19:04:17 -0500 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1DEFpa-0003BQ-JQ; Wed, 23 Mar 2005 19:04:10 -0500 Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Wed, 23 Mar 2005 17:55:28 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:35075 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35075 Stefan Monnier 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