From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: 23.0.50; Deleting files in wdired does not work Date: Fri, 25 Jan 2008 08:35:58 +0100 Message-ID: <4799915E.9090400@gmx.at> References: <60c603510801202141p7e4fdcfcmddf4d81b330a9715@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1201250593 6983 80.91.229.12 (25 Jan 2008 08:43:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Jan 2008 08:43:13 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org To: Phil Sung Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 25 09:43:31 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JIK9m-00048V-2y for ged-emacs-devel@m.gmane.org; Fri, 25 Jan 2008 09:43:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JIK9L-0008CL-MM for ged-emacs-devel@m.gmane.org; Fri, 25 Jan 2008 03:42:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JIK97-00089f-2s for emacs-devel@gnu.org; Fri, 25 Jan 2008 03:42:45 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JIK93-00086V-Vi for emacs-devel@gnu.org; Fri, 25 Jan 2008 03:42:42 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JIK92-00086D-Pm for emacs-devel@gnu.org; Fri, 25 Jan 2008 03:42:41 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JIK92-0000h5-Ee for emacs-devel@gnu.org; Fri, 25 Jan 2008 03:42:40 -0500 Original-Received: from mx10.gnu.org ([199.232.76.166]) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JIK1l-0008QQ-1w for emacs-pretest-bug@gnu.org; Fri, 25 Jan 2008 03:35:09 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JIK1h-00064d-UA for emacs-pretest-bug@gnu.org; Fri, 25 Jan 2008 03:35:08 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JIK1h-00063Y-G8 for emacs-pretest-bug@gnu.org; Fri, 25 Jan 2008 03:35:05 -0500 Original-Received: (qmail invoked by alias); 25 Jan 2008 07:35:01 -0000 Original-Received: from N817P029.adsl.highway.telekom.at (EHLO [62.47.46.29]) [62.47.46.29] by mail.gmx.net (mp049) with SMTP; 25 Jan 2008 08:35:01 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18/SKpjCPM/bBEDI0xgHqH5R39EtpX7PpVnrw7u+S WNdV++V8P37iDn User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <60c603510801202141p7e4fdcfcmddf4d81b330a9715@mail.gmail.com> X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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 Xref: news.gmane.org gmane.emacs.devel:87480 gmane.emacs.pretest.bugs:20744 Archived-At: Thank you for your report and the patch. Sorry for the delay in answering it. > It looks like wdired-get-filename adds a spurious newline to the result > whenever the filename has been deleted in wdired. The 'end-name text property assigned by `wdired-preprocess-files' covers exactly one character after the filename, usually the newline. Deleting the filename and calling `next-single-property-change' from (1+ beg) will thus return the position after the newline and set `file' to "\n" in `wdired-get-filename' - as you observed. For the last filename the 'end-name text-property remains constant till the end of the buffer, (setq end (next-single-property-change (1+ beg) 'end-name)) returns nil, and the subsequent (setq file (buffer-substring-no-properties (1+ beg) end))) fails with a "Wrong type argument: integer-or-marker-p, nil", am I right? Hence, you indeed detected two different bugs. > In addition, in > wdired-finish-edit, to test whether a filename has been deleted, we should look > at (wdired-get-filename t), which returns the basename only, and see whether it > equals "". > > I propose the following patch: Your patch fixes both bugs. However, I'd prefer if you replaced the original (setq end (next-single-property-change (1+ beg) 'end-name)) by something like the untested (if (get-text-property (1+ beg) 'end-name) "" (setq end (next-single-property-change (1+ beg) 'end-name)) (setq file (buffer-substring-no-properties (1+ beg) end)))) It would allow this part of wdired to also work in the case where the filename does not appear at the end of the line in dired listings. I don't know how realistic that is - but we shouldn't hardcode anything into wdired which wasn't there initially. Could you try to do that?