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: Wed, 17 Mar 2021 10:09:22 -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="18773"; 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 15:10:50 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 1lMWsr-0004mK-E1 for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Mar 2021 15:10:49 +0100 Original-Received: from localhost ([::1]:36082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMWsq-0000Bf-Cn for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Mar 2021 10:10:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMWra-0008B7-0q for emacs-devel@gnu.org; Wed, 17 Mar 2021 10:09:30 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20448) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMWrW-0007LB-Uo for emacs-devel@gnu.org; Wed, 17 Mar 2021 10:09:28 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B0D0E100362; Wed, 17 Mar 2021 10:09:25 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6730C1002F2; Wed, 17 Mar 2021 10:09:24 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1615990164; bh=KSAjFMw9yfaaG6grrr4J3QP/ajI/6DABfD7Yw7DU0Ys=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=QC+Bx+yCZ+wEoeaygdpdVXQqOhyyooy67/JCqKbMu8qgXwuId52v5VikgkLyAs4Qs iS/f2i96lscbXCyyNfXbQWTbu+Ly90SNig/8YTySPWd0WAcqrCeNzIEI5iugOlPCYW 2Z6bGvmkNg0SyGF/RsVwxTtFbe/q7ltqnTu/Kwlx6+Spr6FzYTDS8WOiUICGs1WERy GdtsSyyXw/DZUHnjc+6n5sqR2hcySYyg/zEfHmgt4bn+O8Wf/csmOCRGuIr3lBnqED xRalv/1+Mli9BI2YoVz4AGf/tDL6/Xhgwr1StUVczFLUIxAvdSn8Q+LbzZng/Mbu1/ V/U8EVNJUHwNg== Original-Received: from alfajor (unknown [216.154.43.249]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3E450120230; Wed, 17 Mar 2021 10:09:24 -0400 (EDT) In-Reply-To: (Arthur Miller's message of "Wed, 17 Mar 2021 14:58:47 +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:266524 Archived-At: > The problem here is how aborting changes is implemented in wdired: undo > is disabled and original code just copies entire buffer and pastes it back > when changes are aborted. I think you should be able to leave this part of the code completely unchanged. > I would like to skip copying entire buffer into buffer-string as > wdired does originally. Any particular reason for that? It should be very fast, even for very large directories. > I agree with you, but I am not sure how to implement it. My hack was > literally less than a 5 minute change, I just removed loops and changed > mode name so I can abort it properly. I'd start with the following: When converting to wdired, instead of calling `wdired-preprocess-files`, use (add-hook 'before-change-functions #'wdired--preprocess-lines nil t) and then turn `wdired-preprocess-files` into `wdired--preprocess-lines`, which will `get-text-property` of the first char of each line in the region to see if it's already been marked as `read-only`. If yes, do nothing and if not, do what the old code did on that line. Stefan