From: "Phil Sung" <psung@mit.edu>
To: "martin rudalics" <rudalics@gmx.at>
Cc: emacs-pretest-bug@gnu.org
Subject: Re: 23.0.50; Deleting files in wdired does not work
Date: Fri, 25 Jan 2008 05:16:05 -0500 [thread overview]
Message-ID: <60c603510801250216r7f62a876s37a86719d46d7633@mail.gmail.com> (raw)
In-Reply-To: <4799915E.9090400@gmx.at>
On Jan 25, 2008 2:35 AM, martin rudalics <rudalics@gmx.at> wrote:
> For the last filename [...]
>
> (setq file (buffer-substring-no-properties (1+ beg) end)))
>
> fails with a "Wrong type argument: integer-or-marker-p, nil", am I
> right?
That's correct.
> 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.
Sure. The following works for me, assuming (wdired-get-filename t)
ought to return "" rather than nil on a deleted filename:
(if (get-text-property (1+ beg) 'end-name)
(setq file "")
(setq end (next-single-property-change (1+ beg) 'end-name))
(setq file (buffer-substring-no-properties (1+ beg) end)))))
An updated patch follows.
--Phil
*** lisp/wdired.el 8 Jan 2008 20:44:46 -0000 1.33
--- lisp/wdired.el 25 Jan 2008 09:44:35 -0000
***************
*** 324,329 ****
(if old
(setq file (get-text-property beg 'old-name))
! (setq end (next-single-property-change (1+ beg) 'end-name))
! (setq file (buffer-substring-no-properties (1+ beg) end)))
(and file (setq file (wdired-normalize-filename file))))
(if (or no-dir old)
--- 324,331 ----
(if old
(setq file (get-text-property beg 'old-name))
! (if (get-text-property (1+ beg) 'end-name)
! (setq file "")
! (setq end (next-single-property-change (1+ beg) 'end-name))
! (setq file (buffer-substring-no-properties (1+ beg) end)))))
(and file (setq file (wdired-normalize-filename file))))
(if (or no-dir old)
***************
*** 390,394 ****
(when (and file-ori (not (equal file-new file-ori)))
(setq changes t)
! (if (not file-new) ;empty filename!
(setq files-deleted (cons file-ori files-deleted))
(setq file-new (substitute-in-file-name file-new))
--- 392,396 ----
(when (and file-ori (not (equal file-new file-ori)))
(setq changes t)
! (if (zerop (length (wdired-get-filename t))) ; empty filename
(setq files-deleted (cons file-ori files-deleted))
(setq file-new (substitute-in-file-name file-new))
next prev parent reply other threads:[~2008-01-25 10:16 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
2008-01-25 10:16 ` Phil Sung [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60c603510801250216r7f62a876s37a86719d46d7633@mail.gmail.com \
--to=psung@mit.edu \
--cc=emacs-pretest-bug@gnu.org \
--cc=rudalics@gmx.at \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.