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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24031 invoked from network); 8 Feb 2022 17:17:14 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 8 Feb 2022 17:17:14 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1644340634; b=XKxsYe9enk1oB2ySQVzv3w/0w58FlCHwo4JdKeScTtm5kVDzyCaljS8DM6N0VHZ6lCCvngUEr5 QysWw8DYBXz7D2YwvhiIVNidvH2dXsRFUc//qlZzs+Q7fQ4RaY1L8UMKZpZbGITOMtBTRmCIQr 63AE7pS7SFKDwznXvUjBTfrcHfpW5HCvCd4FAdBlYhjGXG9SB4wgtNhinA2Ki6PvQ0EZsxC0Kt YZWPw1E0xow6fw4p3yIw35s5wA3C29qdWdT3TOsZCcuBqCPqyuiEPkQWUaBtGtpBQbD8pWfBAx HKG3wEeu3vB78Syc09H35mr0IiYhyx1CUzki74WGnAvaxQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97; dkim=pass header.d=virgin.net header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=virgin.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1644340634; bh=tPp1SqWEdRmJEKPUfobJWkmBwWzdkC57J51d3t9SLuE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Date:Subject:To:From:DKIM-Signature:DKIM-Signature; b=ZjxSN4FYajHh+sOp+B8wioT6INB719Gpr5BJQRW2XZpv0VyjhFjO4fkv4L4MjoTFPGKZ7BHqQb X7Vzyq+7vwV2NB/v/e+ycc6PmkkRdIhzEWKaYINAKTwhb6DzV28Djj3Y3K6BJX7sjEwLzrJlSt CZQyzvHv40Vik70Q/Jlb+aj15nGZymf/EDyRUqJN6LRFwx4os96OzMF0KvBAzMc/DTEJ0SK2Sy wB+xckXKr/u7ENQDAniS5A/KfMa5Q1XKzJ8hhmGKNSP5+LtBnhQg1vuH6pDyw5mtKvw8BDOwK5 vgccrYWnfO+EUXMHMK7DQ6rScs7dyRqJ5ZfDyGELEei0NA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=0TtmV0gx6EUfMoHqpMGrIoXjYUPkvWDMk/Fdwvogejk=; b=UubBA+tMNuR9dAPxC854OKhsWv jmYuq9zBA9GpVSB3aRX+Kvje/uICkqAGm8DWx1P5RPPwztR+NLRa5CgqXyYLLMJlsOmDf6hnFHz6E H1iwd3Yy25uwrT8LAnK4C1qk8gqxOTAkaofg0JLmxCpYoS8fGF9KDG0jyig/Wn7Yz2on8+T2ALsNc jIkg+gBTeVtzMhj6nCASm6XQCBUVMYLaSXp9O+dxlL0588NxmDhOBlJijmp8s9cQHda918VnrDJxD qY+1KTaEDplbfc6eMleSGJwLwlSKomlXP6Fr7Z/xmNF5O2J9Wm+OrTpE56loEQf1VrTWTADwY5uiO c6PrNROw==; Received: from authenticated user by zero.zsh.org with local id 1nHU76-000I1G-HC; Tue, 08 Feb 2022 17:17:12 +0000 Authentication-Results: zsh.org; iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97; dkim=pass header.d=virgin.net header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=virgin.net; arc=none Received: from smtpq2.tb.ukmail.iss.as9143.net ([212.54.57.97]:38920) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1nHU67-000HHb-GQ; Tue, 08 Feb 2022 17:16:15 +0000 Received: from [212.54.57.108] (helo=csmtp4.tb.ukmail.iss.as9143.net) by smtpq2.tb.ukmail.iss.as9143.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHU67-0007mx-7N for zsh-users@zsh.org; Tue, 08 Feb 2022 18:16:11 +0100 Received: from vCholatse.rt ([92.24.148.230]) by cmsmtp with ESMTPA id HU66ndARRpODMHU67nk5uE; Tue, 08 Feb 2022 18:16:11 +0100 X-SourceIP: 92.24.148.230 X-Authenticated-Sender: thomas.lauer@virgin.net X-Spam: 0 X-Authority: v=2.4 cv=GcsEICbL c=1 sm=1 tr=0 ts=6202a55b cx=a_exe a=WO3mUOHEnGCuICAdczvSqQ==:117 a=WO3mUOHEnGCuICAdczvSqQ==:17 a=kj9zAlcOel0A:10 a=oGFeUVbbRNcA:10 a=MVxlS3zi6z2aCoOUpS0A:9 a=CjuIK1q_8ugA:10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virgin.net; s=meg.feb2017; t=1644340571; bh=0TtmV0gx6EUfMoHqpMGrIoXjYUPkvWDMk/Fdwvogejk=; h=From:To:Subject:Date; b=APl64YEHaxO+ehbhrLSD4CJmu6DrsBGT7AsxR+EhQFu4YOVCUVfhMOy79rd5Garmg GbHBMw5SCqNa9QVIUt4Gv475TfRt/nZm190ML8Izbgoc0u84HRwN3yz5eV2vrNjeTW eafYYtBlj5aq/fwGr4vNAzVxJqCN1/8RXDZhZp9Ot0FcwYPTo8ZAZIv//C43HSmCKK cRuJ+iBnZSMB+Aq/eJWCcvhLstYCl5VinGWqZtTE2GgjboPITiBi7t884UBvmhkclk CCrIsoqs+ZJfwtBFKLhZsLyjH1jXjQNbKDSiPbPicmr8vNxipXhiOIvWQBsKT3fy9i 7oT20wjlEQNIQ== From: Thomas Lauer To: Zsh Users Subject: zsh function breaks after error Date: Tue, 08 Feb 2022 17:16:14 +0000 Organization: TL Message-ID: User-Agent: ForteAgent/7.00.32.1200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-CMAE-Envelope: MS4xfKrdO/5XE+ChH/IppsuI4MCbJAhAtlsKnDBrlOOQoqlnHTA58qlVXEcK2dq4iBJhUEEQF0ZgU9UW3ytWiyaeChR2ZlXs13IwY28w1gdBbCnH9U4Xt1ya uU7QI0jLa0Iv3IpF+hBkTdveoV+ef9A1m4+6Nzd0s6AsF3y7MY8Ow/gR3nys9XjHvAi4Oh8C8ryAGQ== X-Seq: 27496 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: I have googled for what seems to be an simple and obvious thing but somehow I seem to be unable to find what I'm looking for. So here goes. I have this function, called via keyboard shortcut while editing a line: expandDir2() { zle backward-kill-word local _dir=3D$CUTBUFFER _dir=3D${_dir:gs/*/.+/} _dir=3D${_dir:gs/?/./} _dir=3D${_dir:gs/:/(?i)/} _dir=3D$(command grep -hP "$_dir" ~/other/dirlist_*.txt | rofi -dmenu -p \"Directory\") echo Never reached on Esc. [[ "$_dir" =3D=3D "" ]] && BUFFER=3D$BUFFER$CUTBUFFER || = BUFFER=3D$BUFFER$_dir CURSOR=3D$#BUFFER } This basically reads a search string (say "u*sh*z"), greps a set of files with directory lists (created by a custom script) and runs rofi in dmenu mode to select one directory which then replaces the search string. This works very well. The trouble starts when rofi is terminated not via selecting one of the shown directories (exit value 0) but with Esc/Ctrl-G (exit value 1). In this case the function just breaks and I have found no way to actually check for either the returned string of rofi or its exit value. Bash has set +-e and I am sure there is sth similar for zsh but I can't for the life of me find it (I have for now "solved" the problem by writing a two-liner that calls rofi and always returns exit 0 but that's a kludge at best). THX Tom