From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.devel Subject: Re: Latest commit to dired-aux; maybe add string-multi-replace? Date: Mon, 29 Aug 2016 07:52:24 -0400 Message-ID: References: <87poosj75w.fsf@oremacs.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1472473615 13292 195.159.176.226 (29 Aug 2016 12:26:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 29 Aug 2016 12:26:55 +0000 (UTC) Cc: Emacs developers To: Oleh Krehel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 29 14:26:52 2016 Return-path: Envelope-to: ged-emacs-devel@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 1beLeJ-0002n1-Sc for ged-emacs-devel@m.gmane.org; Mon, 29 Aug 2016 14:26:48 +0200 Original-Received: from localhost ([::1]:43062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beLeH-0002p4-Au for ged-emacs-devel@m.gmane.org; Mon, 29 Aug 2016 08:26:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beL78-0003XS-Es for emacs-devel@gnu.org; Mon, 29 Aug 2016 07:52:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1beL76-0002aM-EI for emacs-devel@gnu.org; Mon, 29 Aug 2016 07:52:29 -0400 Original-Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:35914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beL76-0002a2-6n for emacs-devel@gnu.org; Mon, 29 Aug 2016 07:52:28 -0400 Original-Received: by mail-oi0-x22d.google.com with SMTP id f189so191983294oig.3 for ; Mon, 29 Aug 2016 04:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=yNiQDZnebiNkN0wR7w9CFUb7ElZpDBNKwM4E1muAwEo=; b=yFurcWQdZL8+nsRBUOewXcbQkKZgJuWZpQ4pzdZgLdM/1XKSFH3jAK/rSn75DMZWnk usVR7bgv39z8ERY/lTYtluCviEqzF6K9S4rF0Iaqz75Pdf+IFA5xNqktkFyAHELZ7ep8 pQbwnQyRDjixkAfj+TaT662dpEz6UQDBiW4xgfKJ4+99YMBnB0rRd9aMtI8Vav5YM1x9 Ux6UBg8KVpwGl49D2659PxAG7b51k/g+EBhLtw7EZaSO4ZPGUQ9WeJK2NJnvqjK2vT5+ ZxfeizF8B7LDp2HTqORoR+nOsPi0oJMUoo8qumtj2VJmoJXFATRuEk+CjgRBEU2xipDs lQ+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=yNiQDZnebiNkN0wR7w9CFUb7ElZpDBNKwM4E1muAwEo=; b=AGHcBdDOLCcGO1/U+FuDEUZjQYQfLW3ulE4zA2S8wbMmJ5ANG8/cCs/d5fNC43y8nb 6oQto8femW5Eh6ekZMIU92F25GBYy5sp63VOCKpqKH9TOzAoTtTT+JE3AE8dDwbi4jjJ enxNHPW+2C0V2MwCVrLbKP8+F5FYKs2ACY74O9/NPs5JuBsurYEDOfzu/hoUwPeQ6DL5 nHakQ+NqpOb+Z6zM0IpM/gEbeXsCuZItuNhpupgRTd/LOF1EEr4H8TheS6ka5HwNaRFr Mmz12jRScCbUckTY2Z0GfXK2QoHKKGIkqM4ykr6gHAlgaYwthEMVJ5XANfej/qEOxXnd ctkw== X-Gm-Message-State: AE9vXwMPOOdBF42WbdXRIco7xIJjsHRQ/7+dNAyFM145caBvtLFZImyBNcLDlk/r7HFTn3DWlx+Mo6zXQCH9Uw== X-Received: by 10.202.245.88 with SMTP id t85mr10508998oih.202.1472471545460; Mon, 29 Aug 2016 04:52:25 -0700 (PDT) Original-Received: by 10.157.11.125 with HTTP; Mon, 29 Aug 2016 04:52:24 -0700 (PDT) In-Reply-To: <87poosj75w.fsf@oremacs.com> X-Google-Sender-Auth: r3NOo6uxyhZfL8BaCDbk7f7Hcuc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206864 Archived-At: On Mon, Aug 29, 2016 at 4:44 AM, Oleh Krehel wrote: > Hi all, > > I just fixed the `dired-do-compress' command to work with files and > directories that have spaces in them. > > After the fix, I saw this pattern repeat: > > (dired-shell-command > (replace-regexp-in-string > "%o" (shell-quote-argument out-name) > (replace-regexp-in-string > "%i" (shell-quote-argument (file-name-nondirectory file)) > (cadr suffix) > nil t) > nil t)) > > I've seen the pattern of nested `replace-regexp-in-string' quite a few > times before. It doesn't look great. What about using `format-spec'? I think that would be: (dired-shell-command (format-spec (cadr suffix) `((?o . ,(shell-quote-argument out-name)) (?i . ,(shell-quote-argument (file-name-nondirectory file))))))