From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Partial wdired (edit just filename at the point) Date: Tue, 16 Mar 2021 21:18:47 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1789"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 17 02:19:47 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMKqg-0000ME-PY for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Mar 2021 02:19:46 +0100 Original-Received: from localhost ([::1]:56062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMKqf-0005kL-OX for ged-emacs-devel@m.gmane-mx.org; Tue, 16 Mar 2021 21:19:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMKps-0005Ik-Ld for emacs-devel@gnu.org; Tue, 16 Mar 2021 21:18:57 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMKpp-00052e-1M for emacs-devel@gnu.org; Tue, 16 Mar 2021 21:18:55 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6414380438; Tue, 16 Mar 2021 21:18:51 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 61DD8805EF; Tue, 16 Mar 2021 21:18:49 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1615943929; bh=4e806vlO0qgJPkQDVlAvu3ZV3U0iZ7xwuE7bjAg6sfw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Wv3gpt5H8lTSaXges5iXOhfUB9OqS84dPa65Py+Ful1VKye1+aLzbs0S56Bfi3dVT WMPoy4pmwmEf/4r0uQCo60+29+0crLMqlceJ5XdgOy8cKI2zYcGI6co2xem+GnWQJk WcK2wLGGrDNIewCHCPt6JvmuTJT2u79l5T4fgC+K5XHvU59adko4ZzrvBR0nW55IXC JGx7BzapM0U8uhqWkJ6NsytXTB1Hm8WSqp+LNIIs33bRIIku+M58vkzIrgcm+yb1cj bSNbTy+uPB28fQn9WnM9Gw5/0fC9eypvfB+HGpCwIj22G8pGhz0qM+3T9gilMHdv4f 9XK1raVmxVccw== Original-Received: from alfajor (unknown [216.154.43.249]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2D7F412023C; Tue, 16 Mar 2021 21:18:49 -0400 (EDT) In-Reply-To: (Arthur Miller's message of "Tue, 16 Mar 2021 19:23:12 +0100") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:266514 Archived-At: > Wdired is really nice for batch renaming files, but I have noticed that > in case there are lots of files, starting wdired mode and finalizing > changes can take a while. Sometimes I switch to wdired mode just to rename > a single file. On my machine, a directory with ~700 - 800 files causes > a noticable delay. I haven't measured but it is in range of 2-3 > seconds I would guess. I had one directory with almost 2000 files and > when tested it took quite a bit of time. It seems to scale linearly, so it will indeed get slower with very large directories, tho it should stay manageable (i.e. if it took 2-3s for 700 files, it should still take less than 6-9s for 2000 files). But yes, it's a problem. > I traced it down to how dired/wdired use text properties to controll if > text is writable or not. When switching to, wdired goes three times > through entire buffer (filenames, perms and symlinks) and changes text > properties to writable text. The profiler suggests that most of the time is spent in `wdired-preprocess-files` which does one of those traversals. > I have rewritten those few functions to drop to wdired mode to only work > on a line under the point; it is just quick copy/paste hack. It > works fine for my needs and wdired starts without noticable delay, but > there is one cosmetic detail: despite me changing properties only for > current line, wdired still let me edit other text in dired buffer > itself. I'd rather try and speed up the general code. How 'bout making `wdired-preprocess-files` work one line at a time and do it lazily, using a `before-change-function`? This way entering `wdired` should be instantaneous but you can still edit any line you like. The actual edits would be slightly slowed down, but that shouldn't be nearly as problematic. Stefan