From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 807b82dd for ; Fri, 3 Jan 2020 11:04:51 +0000 (UTC) Received: (qmail 14178 invoked by alias); 3 Jan 2020 11:04:44 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24594 Received: (qmail 9364 invoked by uid 1010); 3 Jan 2020 11:04:44 -0000 X-Qmail-Scanner-Diagnostics: from mail-lj1-f178.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25677. spamassassin: 3.4.2. Clear:RC:0(209.85.208.178):SA:0(-2.0/5.0):. Processed in 1.528827 secs); 03 Jan 2020 11:04:44 -0000 X-Envelope-From: pierspowlesland@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.208.178 as permitted sender) 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:cc; bh=Y0Rblg1dE22311c2LxmXylqGWBlBhYSblgThwRcCSEI=; b=ZM0Imief5ywwr6SSwkFxqMHCxnetDHl5L5hpGsLMm0+Ka2n1U/U46Y2xB66R+PBhdD ml04xbbxTCwjUStI73gXq51aqjv7pCNku03xHU7g3iBbG27TDrhRoQOLZkRJjpz6MNoB 5vFjmECE7TueQnvJTft89Kf3WmlA9FeJPPxl2IMNXaC/FYLQhmyHxuHPukasOKVg+CyZ M2x4/oz+H5Lta3w9GNYWbC+kjagTyuNCFa/popOApB1efJci+1c4HEWfsn8NMzmWP1tO WOG9+IM0c1Ot7iPqr2iazIQsvdh1auFgg8hibgeFjl6GDoTTCB7s4qQ5nblCXGnLGDnP 1OnA== X-Gm-Message-State: APjAAAVMSBm7kI5FxBxEAPZkqhavDyoPCbiFN/GSOHSStSMQn+8HMr9f PTLuynXc/wJX6QveC24SepwLdRVGX/0lplKxPIk= X-Google-Smtp-Source: APXvYqz6p9Wahd6vUQEAfppqLc2tl6aU5JRSx+S6F6e5AXpLuhswI0TzcXYs5vxDuoDz9HLWdLHtXnywl6VrfdrYne8= X-Received: by 2002:a2e:8316:: with SMTP id a22mr972910ljh.141.1578049447207; Fri, 03 Jan 2020 03:04:07 -0800 (PST) MIME-Version: 1.0 References: <3D72D898-A52E-421E-B05E-6119564791F3@dana.is> In-Reply-To: <3D72D898-A52E-421E-B05E-6119564791F3@dana.is> From: Piers Powlesland Date: Fri, 3 Jan 2020 11:03:55 +0000 Message-ID: Subject: Re: Adding to the history from within a widget To: dana Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="000000000000bd2542059b3a44d5" --000000000000bd2542059b3a44d5 Content-Type: text/plain; charset="UTF-8" Hi Dana, The example you posted works, and also my widget works if i use 'fc -l' to view the history after executing it. What doesn't work for me though is pressing up after executing the widget, I don't see the entry added with 'print -s'. If I execute another command in the shell I am then able to see the entry added with 'print -s' by pressing up twice. I'm wondering if you experience the same, possibly this has been fixed in newer versions of zsh? I'm on - zsh 5.4.2 (x86_64-ubuntu-linux-gnu) On Fri, Jan 3, 2020 at 3:35 AM dana wrote: > On 2 Jan 2020, at 11:14, Piers Powlesland > wrote: > > I tried to use "print -s xxxxx" to add entries to the history from > within a > > widget but it doesn't seem to work, although executing the function not > as > > a widget does allow me to add entries to the history. > > Maybe i misunderstand, but it seems to work for me: > > % zsh -f > % foo() { print -s foo test }; zle -N foo; bindkey '^r' foo > % # Press Ctrl+R > % fc -l > 1 foo() { print -s foo test }; zle -N foo; bindkey '^r' foo > 2 foo test > % > > What exactly are you doing that's not working? > > dana > > --000000000000bd2542059b3a44d5--