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,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26481 invoked from network); 24 Aug 2023 14:02:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Aug 2023 14:02:58 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1692885778; b=HMt0oz8Hqd3SDHTs2sMl6kJi87vOsCx86VZP6ak9MxEs/fwjEfB8MtKB0tPmNlr4teDENEXTsE nz7qXMyEm4yRunaAj/+3SzrexcaqkqAqiYsFyAH/rMye5zFA/ReKsK6U6KmsIdwibc2smiITJJ ezTC3WQiQqDXeeR5VJzV5DKHGoDvuoY0KdFRM+dBR6eff6go9PWp/PNJ2Sl9//FZ06iQuXpx72 Ciewhhd0wuWIzjieaBJ6dZQiX4/jyfT9cUdQqxOCXU4cnE9T8GJNNAuaYlsN3Zo0r7Ie1GxgJd nsJ1EZtMscCJPZXHnYLb3ZjbVD5iJ2mY+K1f+OEwWoS5gQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f169.google.com) smtp.remote-ip=209.85.219.169; dkim=pass header.d=gmail.com header.s=20221208 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1692885778; bh=FdWzIPzAEWSGDT1MTKQMFvEHjRYbc4K9lOmxwqkLJjo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=ixJ2lAAVrsFc/M2AArUEWkAfABAy/LcsppxG8n/gt7+10+8IrGJkkMgCGPgYyNRbVd/GGKlXaN +A3wBiitExCOHZTZCXY4FI2/Wd3EZmyMmzy6ODUNiwD/1bDfjwdLCpQqrUkakcCw2hTdvxmb79 W4MzRM9nhp3frGBliOjHZP1kiegof3hfI/HOzHbVFZUpcFPBNoLKcFqcW3skjcebAEuDMJUeru j36JIMXrqSbn8U9uvPCqIL0Dn+VcAcjB2Nfqy6hAB4UVULHwbqk+61LGVYTG+NMNT6HNlBh47X 7BAtq7a3XQzOX/TR27nhzvTWorHI7AD9TkHlw0Q5jGOlww==; 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-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=9vGkbd2RXHUnXj/K6trIDTFueWSOixtW1wlprVKw5UU=; b=JRccqHXxe+0iutGerDZqGjy2NG RXwmz0Bt+WDaiYqsskaGkyboTAUCgYmfaKoF3Lm8f7L4Lwz+ERCDGc1wjc1/K4fYDMHke3t0WTn2T dRi8a1RPNMwITzrpUppdgbCVO+7my8wGDIbJ8/Rgl+XbSdLM01xUpNk4CgklSjaWV1jUoU/264Ca4 RhIuoImzHZ7E29WO7d8M2lFSVA3XBTKj8dOmqXvcyVEbhyhh+OWy8WpMXIyileyCX5UFJmJB5TwuF CxMJY8EtMOl/N2HQDqyyb9BlQWLqK9F0YKQiXmkUTUU6c/oy6yv5tKj6wdMzXcNUPaU6JQUcpt1EJ ZsoYtYFQ==; Received: by zero.zsh.org with local id 1qZAvK-000Nto-5P; Thu, 24 Aug 2023 14:02:58 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f169.google.com) smtp.remote-ip=209.85.219.169; dkim=pass header.d=gmail.com header.s=20221208 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-yb1-f169.google.com ([209.85.219.169]:53570) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qZAuG-000NBH-A9; Thu, 24 Aug 2023 14:01:57 +0000 Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-d776e1f181bso3323227276.3 for ; Thu, 24 Aug 2023 07:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692885711; x=1693490511; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9vGkbd2RXHUnXj/K6trIDTFueWSOixtW1wlprVKw5UU=; b=mbFBSTU3xD3z8DX0gcolpaDU4rZQIxWZHiuZJhxWw70TXoo/4lwbETvQUh+ykFo00A C8FK4A11e8pB4Yfm5NYnmMarHQkCtejmLdWws8GSicdHVVgDBOxuDgSTOepVZBs/o2ob t5uah0nSmrRQD+UQ39Mf+q7jrFBwLrrhFNeHq7wylMZl+QpKBn9xZDGimys0YBQfyMHK YNhUEw5myivqCv3iJdxqktcu5Gs8dO3unGH2k4P/rud9w5lSW91mG+AYfXIlQeSlNja4 ZppYKGOgBzdmeKeKkLfrRSA1mR2JghI43MZs7ImX6mcL3fooHANTz6m29+LxDR1DaCOg CSOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692885711; x=1693490511; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9vGkbd2RXHUnXj/K6trIDTFueWSOixtW1wlprVKw5UU=; b=XPdk3yMhOF+2ERnadECH/YrJM8OTnol1TcRxqQrZu3ZdZ12PJWFFXAjKV1PqxyYWyx soPYOwDAGIeQRCfvBELHuwvWJ7gTuwfBlVbLXgx/r+XGDAIgvX+tCOLw/ElkI0Xs8teH Pym+qw9Yw9ahcxlZJBl47zWxm3nylq9WdlrtTQxR9cGFzOxjMtmmwSpLQJar4/zBiBj7 7yJbReqDXcHlyAYhAlAaNdC1KgIRu+GR+9ZLZ+zVq8b/VzVzya2MRCFhZfoLrJ9GrADb UvnnnKrvoRpE2SEM/kpxk7w3OtTh7BgBejJ2JlOo/pxo9oLJKqfWjJ3+fyIjWoY5oSqD RX7A== X-Gm-Message-State: AOJu0Yz6h/IseDpbF/pc/HDvngNJ1Yaj1SQFI7XE0C4JgMKQjmxtBALP iyuUO9UYSPDG0GPZcT+myuFktYiPzcfTwO8A6Y0= X-Google-Smtp-Source: AGHT+IGCJu5iQSoEFHn+wdNLUGqNm3/EtPi1E1cA5qaTjiyYahZDm4XJ9wJ92XRVaADk7tvh4oykDAd7Ge+2cMbwQ8k= X-Received: by 2002:a25:5044:0:b0:d05:3d5b:b63 with SMTP id e65-20020a255044000000b00d053d5b0b63mr16430799ybb.25.1692885710888; Thu, 24 Aug 2023 07:01:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Pier Paolo Grassi Date: Thu, 24 Aug 2023 16:01:14 +0200 Message-ID: Subject: Re: widget accept-no-history To: Bart Schaefer Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="0000000000007164540603ababd3" X-Seq: 29195 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: --0000000000007164540603ababd3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I see, I wasn't aware of the zshaddhistory hook thanks Bart Pier Paolo Grassi Il giorno gio 24 ago 2023 alle ore 05:20 Bart Schaefer < schaefer@brasslantern.com> ha scritto: > On Wed, Aug 23, 2023 at 7:41=E2=80=AFAM Pier Paolo Grassi > wrote: > > > > Years ago I created a widget that allows me to accept a line without > committing it to the history: > [...] > > So I wonder, what would be a better implementation? > > How about something along the lines of: > > execute_no_history() { > setopt hist_ignore_space > zle .accept-line > } > zshaddhistory() { > [[ -o hist_ignore_space ]] && return 2 > } > precmd() { > unsetopt hist_ignore_space > } > > You can use a global variable instead of any otherwise-unused setopt > if you prefer. > --0000000000007164540603ababd3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I see, I wasn't aware of the zshaddhistory hook
th= anks Bart

Pier Paolo Grassi


Il giorno gio 24 ago 2023 alle ore 05:20= Bart Schaefer <schaefer@br= asslantern.com> ha scritto:
On Wed, Aug 23, 2023 at 7:41=E2=80=AFAM Pier Paolo Grass= i <pierpaolog@= gmail.com> wrote:
>
> Years ago I created a widget that allows me to accept a line without c= ommitting it to the history:
[...]
> So I wonder, what would be a better implementation?

How about something along the lines of:

execute_no_history() {
=C2=A0 setopt hist_ignore_space
=C2=A0 zle .accept-line
}
zshaddhistory() {
=C2=A0 [[ -o hist_ignore_space ]] && return 2
}
precmd() {
=C2=A0 unsetopt hist_ignore_space
}

You can use a global variable instead of any otherwise-unused setopt
if you prefer.
--0000000000007164540603ababd3--