From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26767 invoked from network); 4 May 2008 00:52:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 May 2008 00:52:58 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 17993 invoked from network); 4 May 2008 00:52:52 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 May 2008 00:52:52 -0000 Received: (qmail 4727 invoked by alias); 4 May 2008 00:52:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24905 Received: (qmail 4703 invoked from network); 4 May 2008 00:52:44 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 4 May 2008 00:52:44 -0000 Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by bifrost.dotsrc.org (Postfix) with ESMTP id 8746080ED172 for ; Sun, 4 May 2008 02:52:41 +0200 (CEST) Received: from torch.brasslantern.com ([71.116.113.54]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0K0B0062QJR8ZP01@vms042.mailsrvcs.net> for zsh-workers@sunsite.dk; Sat, 03 May 2008 19:52:21 -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 m440qJnG011803 for ; Sat, 03 May 2008 17:52:20 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id m440qJO6011802 for zsh-workers@sunsite.dk; Sat, 03 May 2008 17:52:19 -0700 Date: Sat, 03 May 2008 17:52:19 -0700 From: Bart Schaefer Subject: Identify "active" region? To: zsh-workers@sunsite.dk Message-id: <080503175219.ZM11801@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.91.2/7015/Sat May 3 13:57:16 2008 on bifrost X-Virus-Status: Clean I'd like to write a widget that does if [[ there is an active region ]] then zle kill-region else zle backward-kill-word fi (In fact, I'm tempted to write it in C and make it the default binding for ^W, but that's somewhat beside the point of this message.) There doesn't seem to be any way to determine that there's an active region except to override set-mark-command and exchange-point-and-mark to stash something in a global variable. Have I missed something? (I thought perhaps I could peek into $region_highlight in the latest from CVS, but that doesn't update on the fly.) Opinions on usefulness going forward of detecting the active region? A distinguished value of MARK appears too problematic, so it'd have to be another zle variable, or ...? For the time being I'm using the less-than-satisfactory (( MARK > 0 && MARK != CURSOR )) which isn't *that* bad since if I meant to kill all the way to the beginning of the line I'd probably use kill-whole-line, and at worst I just have to do exchange-point-and-mark first.