From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28253 invoked from network); 15 Oct 2006 23:15:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.6 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Oct 2006 23:15:52 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 49587 invoked from network); 15 Oct 2006 23:15:47 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Oct 2006 23:15:47 -0000 Received: (qmail 17187 invoked by alias); 15 Oct 2006 23:15:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10885 Received: (qmail 17178 invoked from network); 15 Oct 2006 23:15:36 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Oct 2006 23:15:36 -0000 Received: (qmail 48269 invoked from network); 15 Oct 2006 23:15:36 -0000 Received: from vms040pub.verizon.net (206.46.252.40) by a.mx.sunsite.dk with SMTP; 15 Oct 2006 23:15:35 -0000 Received: from torch.brasslantern.com ([71.116.118.106]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J7700LNI9XGOXO3@vms040.mailsrvcs.net> for zsh-users@sunsite.dk; Sun, 15 Oct 2006 18:15:17 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k9FNFF5S001730 for ; Sun, 15 Oct 2006 16:15:16 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k9FNFFXt001729 for zsh-users@sunsite.dk; Sun, 15 Oct 2006 16:15:15 -0700 Date: Sun, 15 Oct 2006 16:15:11 -0700 From: Bart Schaefer Subject: Re: smart-insert-last-word bugs In-reply-to: <061015114655.ZM32612@torch.brasslantern.com> To: zsh-users@sunsite.dk Message-id: <061015161515.ZM1728@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <20061014115617.GA28997@prunille.vinc17.org> <061014142741.ZM22567@torch.brasslantern.com> <20061015005019.GJ28997@prunille.vinc17.org> <061014210451.ZM22937@torch.brasslantern.com> <20061015155843.GN28997@prunille.vinc17.org> <061015114655.ZM32612@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: smart-insert-last-word bugs" (Oct 15, 11:46am) On Oct 15, 11:46am, Bart Schaefer wrote: } } ... there's no way to tell zle what the autoremoval property should } be for a user-defined widget. } } ... perhaps a reasonable fix would be to create } a couple of built-in } widgets that do nothing *except* autoremoval. Here's a patch. I'm not entirely certain whether we also need versions of these that have the ZLE_MENUCMP or ZLE_ISCMP flags, or whether instead of ZLE_NOTCOMMAND these should have ZLE_MENUCMP. I chose to call them auto-suffix-remove and auto-suffix-retain. Better suggestions welcome. Index: Src/Zle/iwidgets.list =================================================================== --- iwidgets.list 31 May 2006 14:11:59 -0000 1.6 +++ iwidgets.list 15 Oct 2006 23:05:04 -0000 @@ -14,6 +14,8 @@ "accept-line", acceptline, 0 "accept-line-and-down-history", acceptlineanddownhistory, 0 "argument-base", argumentbase, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL | ZLE_NOTCOMMAND +"auto-suffix-remove", handlesuffix, ZLE_NOTCOMMAND +"auto-suffix-retain", handlesuffix, ZLE_KEEPSUFFIX | ZLE_NOTCOMMAND "backward-char", backwardchar, 0 "backward-delete-char", backwarddeletechar, ZLE_KEEPSUFFIX "backward-delete-word", backwarddeleteword, ZLE_KEEPSUFFIX Index: Src/Zle/zle_utils.c =================================================================== --- zle_utils.c 1 Oct 2006 02:38:53 -0000 1.10 +++ zle_utils.c 15 Oct 2006 22:11:16 -0000 @@ -865,6 +865,15 @@ return 0; } +/* user control of auto-suffixes -- see iwidgets.list */ + +/**/ +int +handlesuffix(UNUSED(char **args)) +{ + return 0; +} + /***************/ /* undo system */ /***************/ Index: Doc/Zsh/zle.yo =================================================================== --- zle.yo 31 May 2006 14:11:59 -0000 1.20 +++ zle.yo 15 Oct 2006 22:56:54 -0000 @@ -1665,6 +1665,24 @@ Execute the current line, and push the next history event on the the buffer stack. ) +tindex(auto-suffix-remove) +item(tt(auto-suffix-remove))( +If the previous action added a suffix (space, slash, etc.) to the word on +the command line, remove it. Otherwise do nothing. Removing the suffix +ends any active menu completion or menu selection. + +This widget is intended to be called from user-defined widgets to enforce +a desired suffix-removal behavior. +) +tindex(auto-suffix-retain) +item(tt(auto-suffix-retain))( +If the previous action added a suffix (space, slash, etc.) to the word on +the command line, force it to be preserved. Otherwise do nothing. +Retaining the suffix ends any active menu completion or menu selection. + +This widget is intended to be called from user-defined widgets to enforce +a desired suffix-preservation behavior. +) tindex(beep) item(tt(beep))( Beep, unless the tt(BEEP) option is unset. --