zsh-users
 help / color / mirror / code / Atom feed
From: Piers Powlesland <pierspowlesland@gmail.com>
To: dana <dana@dana.is>
Cc: zsh-users@zsh.org
Subject: Re: Adding to the history from within a widget
Date: Fri, 3 Jan 2020 11:03:55 +0000	[thread overview]
Message-ID: <CAFXacXkLFtDW=W+-iPBYT4cq4HCa5uh_CTLipGoPmO0h_MHU_A@mail.gmail.com> (raw)
In-Reply-To: <3D72D898-A52E-421E-B05E-6119564791F3@dana.is>

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

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 <dana@dana.is> wrote:

> On 2 Jan 2020, at 11:14, Piers Powlesland <pierspowlesland@gmail.com>
> 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
>
>

  reply	other threads:[~2020-01-03 11:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02 17:14 Piers Powlesland
2020-01-03  3:37 ` dana
2020-01-03 11:03   ` Piers Powlesland [this message]
2020-01-03 23:11     ` dana
2020-01-03 23:46       ` Bart Schaefer
2020-01-04  0:17         ` Piers Powlesland
2020-01-04  1:41           ` Bart Schaefer
2020-01-06 13:40             ` Piers Powlesland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFXacXkLFtDW=W+-iPBYT4cq4HCa5uh_CTLipGoPmO0h_MHU_A@mail.gmail.com' \
    --to=pierspowlesland@gmail.com \
    --cc=dana@dana.is \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).