emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: directory names ending with a colon confuse dired


From: Chris Moore
Subject: Re: directory names ending with a colon confuse dired
Date: Sat, 23 Sep 2006 04:10:39 +0200

On Fri, 2006-09-22 at 13:01 -0400, Richard Stallman wrote: 
>     Here's a patch.  I've left the indendation as it was to make the patch
>     shorter, but the function will need reindenting.  I removed a seemingly
>     unneeded call to save-match-data():
> 
> The reason for the call to `save-match-data' is so that
> 
>           (save-excursion
>             (goto-char (match-beginning 1))
> 
> will get what was matched by the previous search.
> In fact, I am surprised it works at all once you delete that
> call to `save-match-data'.

If the (looking-at dired-re-perms) succeeds, then we're looking at a
file ending with a colon.  The unless will fail, and so the loop will go
on to the next iteration, and the

            (save-excursion
              (goto-char (match-beginning 1))

won't be used on this iteration, so there's no need to save the match data.

The function works with or without the save-match-data call, since the match 
data is never used.

The match data which the (match-beginning 1) refers to is that which was saved 
by the

    (re-search-forward dired-subdir-regexp nil t)

not by the looking-at, and so the save-match-data call is really not needed.

Do you agree?

Chris.





reply via email to

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