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: Tue, 26 Sep 2006 02:55:35 +0200

On Sat, 2006-09-23 at 22:11 -0400, Richard Stallman wrote:
> I will install the patch.  Thanks.

The installed patch isn't quite right.

The
        (setq count (1+ count))
and
        (dired-alist-add-1 new-dir-name ...)
should be inside the (unless ...).

We don't want to add anything to dired-subdir-alist when we're looking
at a line which represents a file whose name ends with a colon, and we
don't want to include such lines in the count of directories found.

Note also that the unnecessary call to save-match-data is still there.
I've not removed it again, since it does no harm other that being
wasteful.

Here's a patch which fixes the problem.  Again I've not reindented the
code, in the interest of keeping the patch short:

----------
--- Backup/dired.el.~1~ 2006-09-26 02:44:53.000000000 +0200
+++ dired.el    2006-09-26 02:47:25.000000000 +0200
@@ -2225,14 +2225,14 @@
                                (substring new-dir-name (match-end 0)))
                      (expand-file-name new-dir-name))))
            (delete-region (point) (match-end 1))
-           (insert new-dir-name)))
+           (insert new-dir-name))
        (setq count (1+ count))
        (dired-alist-add-1 new-dir-name
                         ;; Place a sub directory boundary between lines.
                         (save-excursion
                           (goto-char (match-beginning 0))
                           (beginning-of-line)
-                          (point-marker))))
+                          (point-marker)))))
       (if (and (> count 1) (interactive-p))
          (message "Buffer includes %d directories" count)))
     ;; We don't need to sort it because it is in buffer order per
----------

Chris.





reply via email to

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