From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13100 invoked by alias); 1 Oct 2014 14:03:43 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33302 Received: (qmail 22772 invoked from network); 1 Oct 2014 14:03:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7f776d000003e54-18-542c09ad5314 Date: Wed, 01 Oct 2014 15:03:24 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: _expand_alias does not expand aliases that contain an "!" Message-id: <20141001150324.1cdad6c9@pwslap01u.europe.root.pri> In-reply-to: <140914135552.ZM31608@torch.brasslantern.com> References: <140830133206.ZM13172@torch.brasslantern.com> <140831135017.ZM739@torch.brasslantern.com> <140914113029.ZM31296@torch.brasslantern.com> <140914135552.ZM31608@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Fd21nDohBhM6xC0ONj9kcmD0WHXw A1MAYxSXTUpqTmZZapG+XQJXxpENnUwFywQqjjw8x9jA+Ieni5GTQ0LARKJlyz0WCFtM4sK9 9WxdjFwcQgJLGSUu/LzBBOEsZ5LY9auJtYuRg4NFQFWiZVsJSAObgKHE1E2zGUFsEQFxibNr z4MNEhZwk9jc/o0dxOYVsJdYvuo+G4jNKWAlMePMS6iZ15kkOi+fA0vwC+hLXP37iQniCnuJ mVfOMEI0C0r8mAxxHbOAlsTmbSA3gNjyEpvXvGWewCgwC0nZLCRls5CULWBkXsUomlqaXFCc lJ5rpFecmFtcmpeul5yfu4kREoRfdzAuPWZ1iFGAg1GJh1cjXTtEiDWxrLgy9xCjBAezkggv OzCEhXhTEiurUovy44tKc1KLDzEycXBKNTD6Lb+8rfDGkUkGulxMtXIiRX8k39xgiNGa0btH YY8mp50277YbdWGWzmJzD/GsmH1Jn/Na3Hxzc7Xw/TtmrlBO6HB+7Bj8w9x74qkn9WKJPhb9 Hatfn1Wd6jiJe2a2Scc1zoAlTx9tl3F9mPVFdeW31Ng53a4lSla/4tXXt2iZqTl6TPj9e7sS S3FGoqEWc1FxIgBXjJ9MIAIAAA== On Sun, 14 Sep 2014 13:55:52 -0700 Bart Schaefer wrote: > What's happening is that the ISPECIAL bit is never restored in the event > that BANGHIST is toggled off and back on again "in the background"; it > is only set if BANGHIST is toggled interactively, e.g., from an init > file or the command line. > > Src/utils.c: > 3519 if (isset(BANGHIST) && bangchar && interact && isset(SHINSTDIN)) > 3520 typtab[bangchar] |= ISPECIAL; > > There's something wrong with that test. Either we don't need the ISPECIAL > bit on the first character of histchars -- history still seems to work as > long as the BANGHIST option is set, even if '!' is not marked special, but > there may be cases I didn't try -- or we need to fix the conditions in > which ISPECIAL-ness is restored. I haven't thought of a crushingly sane and rational course of action here [so no change there, then]. I've a vague feeling the specialness is only applicable to tests for whether the ! is special "in some general sense", e.g. needs quoting when it gets inserted onto the command line, and that bangchar itself is always used directly in the history code (which is what your results suggest). So if we can do that test other ways we wouldn't need this. But I'm a bit worried there's some non-completion quoting code that might need this, e.g. quotestring() with QT_BACKSLASH. In the case of ! there's perhaps no great problem in quoting it anyway, but it might be different if the character got changed (another feature I hate). On possible fix would be to add a separate variable to remember the original ISPECIAL bit for bangchar (which would be transferable if bangchar became a different character) and restore it at this point if this isn't the original setting up of typtab --- which is where the last two tests really make sense. So only the first two tests would remain here in all cases. That may seem a bit baroque given no other character needs this, but it makes the code relatively insensitive to context. pws