[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Word boundaries in wdired mode
From: |
Henrik Enberg |
Subject: |
Re: Word boundaries in wdired mode |
Date: |
Fri, 5 Jan 2007 22:04:26 +0100 |
martin rudalics <address@hidden> writes:
> > There's something screwy about word boundries in wdired mode. Say I
> > have the following files in a directory:
> >
> > FOO.EXT
> > BAR.EXT
> > BAZ.EXT
> >
> > If I try to downcase them by placing point on F and hitting "M-l" a
> > number of times, then I end up with this:
> >
> > foo.ext
> > BAR.ext
> > BAZ.ext
> >
> > The first two M-l work as expected, but the next two skips over BAR and
> > BAZ respectively.
>
> The patch below should work around this but the bug is inherently with
> `operate_on_word': When you have a buffer line like
>
> FOO.TXT
>
> with point-at-bol and the space before FOO is read-only, `downcase-word'
> will fail to downcase FOO even if it's not read-only.
>
> In principle, `operate_on_word' should skip any non-word syntax first
> before attempting to downcase the following word. Unfortunately, Emacs
> misses a cheap `forward-nonword' primitive, (skip-syntax-forward "^w")
> is a poor substitute.
>
> *** wdired.el.~1.22.~ Sat Dec 9 22:30:12 2006
> --- wdired.el Fri Jan 5 18:22:44 2007
> ***************
> *** 576,583 ****
> (funcall command 1)
> (setq arg (1- arg)))
> (error
> ! (if (not (forward-word 1))
> ! (setq arg 0)))))))
>
> (defun wdired-downcase-word (arg)
> "WDired version of `downcase-word'.
> --- 576,584 ----
> (funcall command 1)
> (setq arg (1- arg)))
> (error
> ! (if (forward-word)
> ! (skip-syntax-forward "^w")
> ! (setq arg 0)))))))
>
> (defun wdired-downcase-word (arg)
> "WDired version of `downcase-word'.
This does indeed fix it. I suggest it be installed even if it's
somewhat suboptimal.