[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23324: shell-resync-dirs does not handle dirs with whitespace
From: |
Noam Postavsky |
Subject: |
bug#23324: shell-resync-dirs does not handle dirs with whitespace |
Date: |
Mon, 03 Sep 2018 13:08:42 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
forcemerge 23324 11608 9379
quit
Noah Friedman <friedman@splode.com> writes:
> I have a fix for this, but I'd like for someone else to look over it and
> perhaps sanity check it before I commit it. Volunteers?
> This is a very old limitation.
By now this is a fairly old patch, but still in need of review it seems.
> + (let* ((dls (buffer-substring-no-properties (match-beginning 0) (1-
> (match-end 0))))
> + (dlsl '())
> + (pos 0)
> + (ds '()))
> + ;; Split the dirlist into whitespace and non-whitespace chunks.
> + ;; dlsl will be a reversed list of tokens.
> + (while (string-match "\\(\\S-+\\|\\s-+\\)" dls pos)
> + (push (match-string 1 dls) dlsl)
> + (setq pos (match-end 1)))
> +
> + ;; prepend trailing entries until they form an existing directory,
> + ;; whitespace and all. discard the next whitespace and repeat.
I think this loop is going in the wrong direction (i.e., it should
rather be appending leading entries). Because of this, it can be fooled
by subdirectories with a name matching a substring of a dirs entry:
~$ mkdir -p 'foo bar/bar/'
~$ cd 'foo bar/'
~/foo bar$ command dirs # M-x dirs
# infloops...
> + (let ((newelt "")
> + tem1 tem2)
I'm also not a fan of the somewhat inscrutable tem1 & tem2 names.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#23324: shell-resync-dirs does not handle dirs with whitespace,
Noam Postavsky <=