emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 23.0.50; Deleting files in wdired does not work


From: Phil Sung
Subject: Re: 23.0.50; Deleting files in wdired does not work
Date: Fri, 25 Jan 2008 05:16:05 -0500

On Jan 25, 2008 2:35 AM, martin rudalics <address@hidden> 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))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]