From: Noam Postavsky <npostavs@gmail.com>
To: Noah Friedman <friedman@splode.com>
Cc: 23324@debbugs.gnu.org
Subject: bug#23324: shell-resync-dirs does not handle dirs with whitespace
Date: Mon, 03 Sep 2018 13:08:42 -0400 [thread overview]
Message-ID: <8736uqik4l.fsf@gmail.com> (raw)
In-Reply-To: <20160420193843.651480.FMU1050@unexploded-cow.prv.splode.com> (Noah Friedman's message of "Wed, 20 Apr 2016 19:38:43 -0700 (PDT)")
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.
next prev parent reply other threads:[~2018-09-03 17:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 2:38 bug#23324: shell-resync-dirs does not handle dirs with whitespace Noah Friedman
2018-09-03 17:08 ` Noam Postavsky [this message]
2020-08-12 11:44 ` Lars Ingebrigtsen
2020-08-19 14:00 ` bug#11608: " Lars Ingebrigtsen
2019-06-27 16:25 ` bug#9379: " Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8736uqik4l.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=23324@debbugs.gnu.org \
--cc=friedman@splode.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.