From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 23827 invoked from network); 19 Feb 2021 12:17:46 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Feb 2021 12:17:46 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1613737066; b=QD49jCAki2nCOWHt1MKgZUG0HKVYvKnmHmRtAwoZ92ri333WaZ/8FmNBtXnxnLNZQ/KMrdXuHE N6IhzW992jrT2hoIibs4ayy/Shmr/8s/iPgepZ5pvNvung7Y50Kf7aCvIwnGlrj68r4Pnecpv1 /o1dRp8R+91vB581pkE+TUVul9fKF8uuO7GSYtvnxSmpb3EqoVb361jh4QDO3L6yDwFzxd/3eF cR3SUfSjxltEZ5CwE/BP+tMV2tfXlV6GtuduRkHzcUgrAjYfWuHeOxdUtoJUWCtLVA2r+dlub9 z8xH4Oy/UnMkC/dEGn7NToLqBqg6iOLHHqVa3/52hZZg6w==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1613737066; bh=b8kfMaRkMrpRqXdjb6BjLqRbSz4V4lCKGrIyEV+HVYE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature; b=bvReQFYirzrBCvMEr6TdqpVthxD+X+KPd9Ez8UGB/uZ3DLqBbIqMLOKOIot5MRqcATsQM0Ng0V /WwJR84D8lJC76+Nt9m73c24kBUOwszxwriBT4Hu+NjA15Ot4S+BABMp8gYZaZY4uUW789m/dE gZuN7xGjRDxJKkpv095rHKDd3rpadNMOBa/82DhyDPBQH44rD/PiqTRUNQQlTkzm20ra+/aGOi XqoRfs3uamFzhFHkvzx13ILv5f5IXBj6p28E7Sv9rPlGal/0I09Rfph6PCVieWnOg028uFyjo/ dQ67EXtfefCRo45xEwcGmLLJeh7EGzJn04cgb/TCJzU/Cw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=mTZloeU3Xdw/o812mRAzWIyHbnPJJGvdqU0oKFCONLs=; b=rF+5OTx0CxUatBWqAHKlrEh0hH 7Pqjpco9vxN0ouMdxYm7hwSazENuLS7ZTY38LWxE+0+ifZ5ITsksoUo2mN1mTau68h4d8+/0oF6g7 u84JkTz0e9f+PKDx1+y3il8Li4aYYI26v0ltF52M5gNIoQRS/hqKGOnWczlqXBWrEDeIMPftaUkMS uHBdHv75NDxT3F1gl43Ull6a2f+YkJofgTFvQVvophRXosXzhTVihnEArzGUZip3ozlYSP0V8U9eb uyOPva9GnkNEmkKjD7t0w7fYfp8+XwEnKTKbOLkItE0YQWZgOKzLJUzq/s8RsYttGQbZGW7gYQ5pl i44/XDDw==; Received: from authenticated user by zero.zsh.org with local id 1lD4jB-000Ino-Bk; Fri, 19 Feb 2021 12:17:45 +0000 Authentication-Results: zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none Received: from joooj.vinc17.net ([155.133.131.76]:41492) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lD4iZ-000IQq-5Y; Fri, 19 Feb 2021 12:17:08 +0000 Received: from smtp-zira.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128]) by joooj.vinc17.net (Postfix) with ESMTPSA id 0B601A7; Fri, 19 Feb 2021 13:17:06 +0100 (CET) Received: by zira.vinc17.org (Postfix, from userid 1000) id B4A49C20349; Fri, 19 Feb 2021 13:17:05 +0100 (CET) Date: Fri, 19 Feb 2021 13:17:05 +0100 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: auto-quoting inside braces in arguments Message-ID: <20210219121705.GA1706306@zira.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20210218134039.GA1492462@zira.vinc17.org> <8b3a9f93-5eb4-4d4d-8312-58c371e12239@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.0.5+113 (9635fad4) vl-132933 (2021-02-17) X-Seq: 26540 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: On 2021-02-18 10:30:50 -0800, Bart Schaefer wrote: > On Thu, Feb 18, 2021 at 9:35 AM Daniel Shahaf wrote: > > > > Vincent Lefevre wrote on Thu, 18 Feb 2021 13:40 +00:00: > > > Is there a way to get auto-quoting inside braces in arguments? > > > > Proof of concept: > > > > f() { > > local l=\{ r=\} > > CURSOR=${BUFFER[(i)$l]} MARK=${BUFFER[(i)$r]} > > (( -- CURSOR )) > > zle quote-region > > } > > It needs to be a bit more complicated than that, because you first > have to be sure that the braces are not already quoted and do not form > a valid comma-separated (or ".." range) brace expression. Also, > should anything special happen if there is a valid brace expression > inside the invalid brace pair? Is this single- or double-quote > equivalent, or something new? I think that { would just appear as a quote mechanism until a matching }. This should probably similar to double-quote. For instance echo {ab cd"ef }" $ZSH_VERSION {0..2} } should be equivalent to echo "{ab cdef } $ZSH_VERSION {0..2} }" though in practice, there would be only something simple inside { }. For instance: svn diff -r{1 hour ago} -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)