From: martin rudalics <rudalics@gmx.at>
To: Phil Sung <psung@mit.edu>
Cc: emacs-pretest-bug@gnu.org
Subject: Re: 23.0.50; Deleting files in wdired does not work
Date: Fri, 25 Jan 2008 08:35:58 +0100 [thread overview]
Message-ID: <4799915E.9090400@gmx.at> (raw)
In-Reply-To: <60c603510801202141p7e4fdcfcmddf4d81b330a9715@mail.gmail.com>
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?
next prev parent reply other threads:[~2008-01-25 7:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 5:41 23.0.50; Deleting files in wdired does not work Phil Sung
2008-01-25 7:35 ` martin rudalics [this message]
2008-01-25 10:16 ` Phil Sung
2008-01-25 13:17 ` martin rudalics
2008-01-25 22:43 ` Phil Sung
2008-01-26 17:27 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4799915E.9090400@gmx.at \
--to=rudalics@gmx.at \
--cc=emacs-pretest-bug@gnu.org \
--cc=psung@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).