From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17928 invoked by alias); 5 Dec 2014 14:51:09 -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: 33859 Received: (qmail 29668 invoked from network); 5 Dec 2014 14:51:07 -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-b7fc86d0000066b7-4b-5481c6578147 Date: Fri, 05 Dec 2014 14:50:54 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: Re: Interrupting globs (Re: Something rotten in tar completion) Message-id: <20141205145054.655a2f70@pwslap01u.europe.root.pri> In-reply-to: <141205002023.ZM19736@torch.brasslantern.com> References: <20141202155452.647182b4@pwslap01u.europe.root.pri> <141202084858.ZM31517@torch.brasslantern.com> <20141202172654.30e7d380@pwslap01u.europe.root.pri> <141204085606.ZM9146@torch.brasslantern.com> <20141204171226.301e9d2c@pwslap01u.europe.root.pri> <141205002023.ZM19736@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+NgFlrELMWRmVeSWpSXmKPExsVy+t/xy7rhxxpDDCa1cVscbH7I5MDoserg B6YAxigum5TUnMyy1CJ9uwSujCsf/QvWCFS8e5vXwPiDp4uRk0NCwESi5/9GNghbTOLCvfVA NheHkMBSRomD524xQThLmCQef5rKDuFsY5TYNusFK0gLi4CqxOf+XkYQm03AUGLqptlANgeH iIC2RPtHMZCwsICHxIEtf1hAbF4Be4mZj4+BbeMUsJL4/fImK0i5kMAuJol57CBhfgF9iat/ PzFBHARUfuUMI0SroMSPyffAxjALaEls3tbECmHLS2xe85YZxBYSUJe4cXc3+wRGoVlIWmYh aZmFpGUBI/MqRtHU0uSC4qT0XCO94sTc4tK8dL3k/NxNjJBw/bqDcekxq0OMAhyMSjy8P+Ia Q4RYE8uKK3MPMUpwMCuJ8CbPBgrxpiRWVqUW5ccXleakFh9iZOLglGpgZDtevV937zy17NaO nKPc+70qeMJZct6Vssmxuy07opR02nXuynvsyxjfMU86727k/DnV54T65CvyyTUWk72iN+Sc qZjal7FSJdM4VbfprlhdYNGJ4JzNMRuLAoQvH44/cp4ncBLXWZ1lJ99G1348tIxjmTWru7fH lqqqrwWX1Bf1+67bW7JKiaU4I9FQi7moOBEAnYlhZTUCAAA= On Fri, 05 Dec 2014 00:20:23 -0800 Bart Schaefer wrote: > On Dec 4, 5:12pm, Peter Stephenson wrote: > } > } It's always in _files or _path_files --- kind of where you'd expect from > } the code you quoted. I guess it's the glob that's not very > } interruptible. > > This seems to help: > > diff --git a/Src/glob.c b/Src/glob.c > index ca7bc44..b3903f2 100644 > --- a/Src/glob.c > +++ b/Src/glob.c > @@ -463,7 +463,7 @@ scanner(Complist q, int shortcircuit) > int errssofar = errsfound; > struct dirsav ds; > > - if (!q) > + if (!q || errflag) > return; > init_dirsav(&ds); Not for me: it's more basic than that. The trap in _main_complete isn't working *at all* --- or, rather, it's working too well, by trapping all errors. It's using an eval-style trap, so the "return" in it is forcing the current function in the completion code to return with that status and no error flagged. That might have been good enough to interrupt a simple case, but what's actually needed is returning non-zero from a function-style trap, which causes the default signal handler to run --- I should have spotted this at the time since I've had suspicions since that trap turned up. This actually prevents the message in the trap showing up --- we need some cleverer zle trickery to do that --- and consequently the trap is not actually any use as it stands. But at least interruption is now usable rather than unsuable. diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index fcd6366..765fb4b 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -128,8 +128,11 @@ _completer_num=1 # We assume localtraps to be in effect here ... integer SECONDS=0 -trap 'zle -M "Killed by signal in ${funcstack[1]} after ${SECONDS}s"; - zle -R; return 130' INT QUIT +TRPAINT TRAPQUIT() { + zle -M "Killed by signal in ${funcstack[1]} after ${SECONDS}s"; + zle -R + return 130 +} # Call the pre-functions. pws