From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#23324: shell-resync-dirs does not handle dirs with whitespace Date: Mon, 03 Sep 2018 13:08:42 -0400 Message-ID: <8736uqik4l.fsf@gmail.com> References: <20160420193843.651480.FMU1050@unexploded-cow.prv.splode.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1535994431 31936 195.159.176.226 (3 Sep 2018 17:07:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 3 Sep 2018 17:07:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 23324@debbugs.gnu.org To: Noah Friedman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 03 19:07:07 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fwsJe-0008Dd-Cn for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Sep 2018 19:07:06 +0200 Original-Received: from localhost ([::1]:46178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwsLk-0008JV-Ma for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Sep 2018 13:09:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwsLa-0008Ij-Cg for bug-gnu-emacs@gnu.org; Mon, 03 Sep 2018 13:09:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwsLX-0000Eg-AA for bug-gnu-emacs@gnu.org; Mon, 03 Sep 2018 13:09:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39539) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fwsLX-0000EX-5I for bug-gnu-emacs@gnu.org; Mon, 03 Sep 2018 13:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fwsLW-00083h-Vg for bug-gnu-emacs@gnu.org; Mon, 03 Sep 2018 13:09:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Sep 2018 17:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23324 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 23324-submit@debbugs.gnu.org id=B23324.153599454230967 (code B ref 23324); Mon, 03 Sep 2018 17:09:02 +0000 Original-Received: (at 23324) by debbugs.gnu.org; 3 Sep 2018 17:09:02 +0000 Original-Received: from localhost ([127.0.0.1]:44555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fwsLV-00083L-Qq for submit@debbugs.gnu.org; Mon, 03 Sep 2018 13:09:02 -0400 Original-Received: from mail-io0-f174.google.com ([209.85.223.174]:43742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fwsLS-00082p-0p; Mon, 03 Sep 2018 13:08:58 -0400 Original-Received: by mail-io0-f174.google.com with SMTP id y10-v6so861007ioa.10; Mon, 03 Sep 2018 10:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=T6qj1C40tG4OdcLoUDc+gRpO48rv0znfcvT57bb+VxY=; b=TJI8MOTCX6bPAfUHldsuQBkI5CX9W6IztLQrBQ8nKDtNntVq57XjbgbRgLctHWr1x3 rBfFrxoSNDEsk0kAJaLzIGS/1dgqSfnPTtKH497jSq3zadTVbjVbMjKJWgXDVR2xHUev rbiOlFhKGK+fx8co7N8cLlnp7QF1ZL8pNejMfm/Ag6foc/vLP7OTrh3U2eXe9RSkeKlb OSi4b170NDIAyBtXMCuE20XUtwaOwoVs+gTuFDNuII9m5UCVSa3adkk3jABCOi5BguRJ LbxHT/opS6tFqMVOuiRFZBNWW4b7snS7ctcnYNGFMlU8TMpLsAk+fcr0p4FLTFUXsnUZ 9LMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=T6qj1C40tG4OdcLoUDc+gRpO48rv0znfcvT57bb+VxY=; b=QtgfoljrkFL3+6gMPOhy5joYk96H6LsEz0Q2Xl+ZE2kxVKmamhQUyALicListOteCb LT9fnL3McYiXbe/kFXOAYEQ6Ai1LdVICLxACx0YB316guFf4I4nhdrxFmp32qYU2/Ymg N0lX1HCbVZJXp5w5ry2SlbpgMJbVmljafa/NK8SXjhk63c32rPCtdjOjTGZuNlRdOTvd JBzhvXecnDavZEIq/hIxKl+LF72UBtDDTMacjxbOZEbpksFcT6+JSol9OKOvYNXsQeOq 36pbfNRW+AWJPEKQJYkWTHdcPyqB6LTBrq6MB0vi0ta9cEDRJ2Y1QhMxKpUnkgMI/RBB WbPw== X-Gm-Message-State: APzg51DXSYepRB5R/T1RS6iacOJ/lNoSkD/mNfY/BvRUjyhqv2i717Ro TXSKggtV3+1sr/i0Nibji5ILq11W X-Google-Smtp-Source: ANB0Vdbrq/+fVHnHIzeRx5WfwRaKY/akf1KQqWzffHtcz2d66MHwTPQNv/FnjgM3Mm7monp48C8WjQ== X-Received: by 2002:a5e:890f:: with SMTP id k15-v6mr5801343ioj.9.1535994532237; Mon, 03 Sep 2018 10:08:52 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id n140-v6sm6692198itb.37.2018.09.03.10.08.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Sep 2018 10:08:51 -0700 (PDT) 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)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149991 Archived-At: forcemerge 23324 11608 9379 quit Noah Friedman 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.