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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14589 invoked from network); 25 Apr 2021 19:35:32 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Apr 2021 19:35:32 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619379332; b=Ro1/P43bm1f1NhEtg05OMl5vP4Z9S/BORrk7Z2K4E7BL4dmuRGn4MnLz4h5Mh79B0hYcJaHlql bRZ8B3mPmU70D5zJt3/AlhVTuW4nzMiaDI+WRhmQRmyRCpSZxs2sHnF1xQdiSU2x7vAj7DLZ3M VzvLXOToSpQJFbZoTMzFqsrVkgzYYRHHSM759OQiC64LO+RzeSdrlJw8PGyY8aSvRtC/ORrWho Gny++aonLIr05BvheAEsA/orr5DIOelT7VhXk0uVHOYN+i9Bo3JsKieeGKHxzO5E1uhtCTBQ74 9B/q7sZsAI4UhmtAFpeUTH5FfTHNT05yV/NK68uXivYojg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f176.google.com) smtp.remote-ip=209.85.167.176; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619379332; bh=1gBZzWzeK5Of+OH+ABVIWekDq9tY2t4xPsj4ngNr89M=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=o5MkaR8MLrPQuN42k50zcOpJMA7McPBw0PwSBcJDLS9fuoZIHw6VfzbATt6XfPVzKVO8yRSWwY b8WnUoHV2NzkDaBHfM1Nu+Zf9NMWBDsH2jZvzcG3ecOs/NN2dxwsqnlcmZxgHNxWu8SSFINzaA edMd8mdBE11IHsca2B8o0vOuhgvod4rcOG6PrkP7z9UgkJ9OVpA4d+k1/Nfyn5JthquV+MjPG0 58iS3bsLuHBswWvo9/V5GHiOT7DKKDHbsUj/DTrorwWUCMWpSdbdQZhZEa+l+ZTNB66xcH/Tvh sfkB5X5EmrC9ABgNDaheDbRFvyZQKyp19y3epDnBTDYKVw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=iVHrMxz3zRskRl1hDUkY4NlXm8shCYcmyEDvRJl/pEg=; b=SWp02jyx/GVBzp9xPL6WP2lIkT SMb6TZvOI2XN8gjubU4ctRSWXS0mnSLcJvp0tmFUI7YLoLxY1oz0drrx0eAa0nSBMWlBQb42lnRd6 LacjZq87UXmnkpoGx0aYsBCgV/s6NoNvr1Ibn9lSXQQnZVX7NqRH0GmORXrksKD4/KSPXiENfErdO RVgr0k4jWf5mymRNL2SKRPKLX2MYbsoUEZGGJS9MAjpSXU2/AGd1k2D/holVlQb6zYsezxz96RZcG yh9it8C71vOvB0iIqYx01SgKR8RdpgGWLoiDqe5uQUCGJ4haoAZiA6s6mHkMLZLMSqEWl1itDTyZ4 84grGUew==; Received: from authenticated user by zero.zsh.org with local id 1lakXS-000L8S-MR; Sun, 25 Apr 2021 19:35:30 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f176.google.com) smtp.remote-ip=209.85.167.176; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oi1-f176.google.com ([209.85.167.176]:39447) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lakXE-000Ktt-BX; Sun, 25 Apr 2021 19:35:17 +0000 Received: by mail-oi1-f176.google.com with SMTP id i81so54528304oif.6 for ; Sun, 25 Apr 2021 12:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=iVHrMxz3zRskRl1hDUkY4NlXm8shCYcmyEDvRJl/pEg=; b=hQxatdC1hLIHz/KW6HwC2hEgarNhoQiaWoRJmQqmLNS49dsNoZS1Otl1m6upbzvrUc ekmLG3WeuXnw4jS96zOv/hPZev6+vXNZHl+z5tBo+WjnvTzhckmsEPBGUWlp7QQicd/J 9RuJp3apGx3VTcYMn+J4WDiv9TJMKtekZ7xIUMW2FEzoNyYIbM6cAd2DcV03GYhz8Qk1 muDUyi4X5PLCgwkzTJKpJlo5LuT47W9DAmfewO8B8UUg9g1/ppKWiN0E3FN6pDYAVLNO X4vqHj5nnRAApwdmXr/3XJ8Gk5UH8LfHO0Cz5P6aSWsCIW99T3y8edbxvVAyjoBV4peO hrAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=iVHrMxz3zRskRl1hDUkY4NlXm8shCYcmyEDvRJl/pEg=; b=Vi9yGjn8sI9ocGi304nkOF1ab3vV9764IHwqBMi+ujQDPMBRNxZm9DwG/ZSLjp9gPe UsRMeYN3v9T6jpuFFbHEOwtZbHPT2C+YQPb5dKe5bAgd10Bd7X8/BR5S4/AAs/9ivrR2 53wDY2vMa8wWOC2eEuZBaENfK8PYdWRcGFa3PJTr9+7yMHU3KN2uQyo8bxsqcfnGS+0f 6/QHsyc9LYYn2SJSb2mpD8aH8Xs6ItlJOYfhSXs2K0PpJLH2zdxM8SDL/jecHkBU/x6o NqpdHsw8ZGM4fXgryYK3NX+KXLBs9bovVWn4K3drsQz8frhoLwvU7DYkbyU4+2zd3e44 Mt5w== X-Gm-Message-State: AOAM5303kYXYnQb5yLTr9mOef5+r/+ToZCu7e1zDUJDdYAGYhtEMTK7G PtZHKaKRetlag2XN4WT5ocgWtvD8ZhLTyFF7/Z6I2RayHRJPdA== X-Google-Smtp-Source: ABdhPJxn1G6MKNFdZtg8JDowd+H/CCeA5ll3JdOLnwFBwJXv4oBsYuVwYk94lEwYOuIR/q9+6PQ0t0CifDuWhH+8XUc= X-Received: by 2002:aca:d90a:: with SMTP id q10mr11415886oig.173.1619379314659; Sun, 25 Apr 2021 12:35:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sun, 25 Apr 2021 12:35:03 -0700 Message-ID: Subject: [PATCH] Re: zed-set-filename breaks zed keymap? To: Zsh hackers list Content-Type: multipart/mixed; boundary="000000000000cec83005c0d120f7" X-Seq: 48707 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --000000000000cec83005c0d120f7 Content-Type: text/plain; charset="UTF-8" Reviving this from a year-ish ago, so including that thread for context ... please see below. On Tue, May 26, 2020 at 8:30 PM Bart Schaefer wrote: > > I was trying to get zed-set-file-name to work with my "zed -h" change, > and discovered that even with plain "zed file" after entering the file > name into read-from-minibuffer, ^X^W no longer works to exit from zed, > and a bare return DOES exit it. Apparently returning from > read-from-minibuffer does not constitute "the next command" for > purposes of zle -K restoring the keymap? Did this work at one time? > > Also, it is possible to execute zed-set-file-name recursively from > inside read-from-minibuffer, which is a bit strange. On Tue, May 26, 2020 at 9:25 PM Bart Schaefer wrote: > > The documentation for zed-set-file-name seems contradictory as well. > In the first paragraph it says: > > ... because of zed's rebindings you will have to type ^j at the > end instead of the return key ... > > but then the second paragraph says > > While zed-set-file-name is running, zed uses the keymap > zed-normal-keymap, which is linked from the main keymap in effect > at the time zed initialised its bindings. (This is to make the > return key operate normally.) ... > > The return key does not in fact "operate normally" during > zed-set-file-name, but something else strange is going on with the > keymaps. After some experimentation ... zed does these things up front: 1. Creates the keymap zed as a copy of main (bindkey -N zed main) 2. Aliases zed-normal-keymap (bindkey -A main zed-normal-keymap) 3. Creates the keymap zed-vicmd as a copy of vicmd It then eventually runs: vared -M zed -m zed-vicmd ... Next bin_vared hides the "main" keymap and renames the keymap passed for -M as "main", so $KEYMAP is not "zed". zed-set-file-name then does this: 1. zle -K zed-normal-keymap 2. read-from-minibuffer However, zle -K is useless, because eventually read-from-minibuffer runs zle recursive-edit -K main and because of vared's dirty trick, this pulls in the "zed" keymap, not the keymap that read-from-minibuffer actually wanted. So ... what's the correct fix here? Shortest is to change zed-set-file-name to use bindkey -A zed-normal-keymap main Attached patch does that. Other options: Change vared to act more like "zle widget -K"? I don't think that breaks any promises, but implicitly $KEYMAP has been "main" inside vared all these years (when not viins). Change read-from-minibuffer to make its own keymap? It's unclear how to accomplish that cleanly when vared has already done its thing, unless we force an explicit set of keybindings. Change read-from-minibuffer to pass in the keymap it should bind for recursive-edit? How? -K option to go with the single existing -k option? Rewrite zed-set-file-name to invoke zle recursive-edit directly, with the correct keymap? --000000000000cec83005c0d120f7 Content-Type: text/plain; charset="US-ASCII"; name="zsfn-patch.txt" Content-Disposition: attachment; filename="zsfn-patch.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_knxklee40 ZGlmZiAtLWdpdCBhL0Z1bmN0aW9ucy9abGUvemVkLXNldC1maWxlLW5hbWUgYi9GdW5jd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