zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: <zsh-workers@zsh.org>
Subject: Re: Unset “zle_bracketed_paste” .zshrc
Date: Thu, 6 Feb 2020 12:40:23 +0000	[thread overview]
Message-ID: <20200206124023.450ee3f3@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <1580297021.5380.17.camel@samsung.com>

Peter Stephenson wrote on Wed, 29 Jan 2020 11:23 +0000:
> On Tue, 2020-01-28 at 11:09 +0000, Peter Stephenson wrote:
> > % zmodload -Fa zsh/datetime p:EPOCHSECONDS
> > % print $EPOCHSECONDS
> > 1580209515
> > % zmodload -Fl zsh/datetime
> > -b:strftime
> > +p:EPOCHSECONDS
> > -p:EPOCHREALTIME
> > -p:epochtime
> > 
> > This is another way of fixing the underlying problem --- e.g. here
> > you don't need to "unset EPOCHREALTIME" because it wasn't provided
> > as a feature in the first place.  You can turn on and off the
> > feature as needed once the module is loaded.  
> 
> I see parameters used by ZLE are only fairly weakly linked into this
> mechanism, however.  At least one reason for that is because of the
> unhelpfully tight linkage between ZLE and the main shell, so it's
> not simply a straightforward plugin.  However, I haven't looked
> further so I don't know if that's an issue with zle_bracketed_paste.
> There may be some scope for rationalisation.
> 

zle_bracketed_paste isn't declared special; it's just getaparam()'d in
the guts of a random C function.

> Loading a module for your own purposes --- for which Sebastian
> no doubt provides a good deal of support --- is in any case a
> rather different thing from the shell loading a module to provide
> its own basic features, so this may not be going anywhere particularly
> useful in this case.

Well, it's an option.  It would result in the following interface:
to prevent $zle_bracketed_paste from being defined one will have to run
«unset zle_bracketed_paste» if zsh/zle has been loaded, or «zmodload -Fa
zsh/zle -p:zle_bracketed_paste» otherwise.

On the other hand, the approach I described in 45339 aimed to make it
possible to just do «unset zle_bracketed_paste» to unset that parameter
(and keep it unset), regardless of whether zsh/zle has or hasn't been
loaded.

I find the latter option preferable.  (Assuming it can be implemented
without errors about readonly parameters cropping up at unexpected
times, as discussed upthread)

In the meantime, here's a test for -Fa.

diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst
index 1bd8c1900..6a4e34d2d 100644
--- a/Test/V01zmodload.ztst
+++ b/Test/V01zmodload.ztst
@@ -348,6 +348,20 @@
 ?(eval):6: unknown function: systell
 ?(eval):9: file descriptor out of range
 
+ $ZTST_testdir/../Src/zsh -fc '
+  zmodload zsh/zutil
+  zmodload -Fal zsh/zutil | grep parse
+  zmodload -u zsh/zutil
+  #
+  zmodload -Fa zsh/zutil -b:zregexparse
+  zmodload zsh/zutil
+  zmodload -Fal zsh/zutil | grep parse >&2
+ '
+0:zmodload -Fa can disable features from being loaded
+>b:zparseopts
+>b:zregexparse
+?b:zparseopts
+
 %clean
 
  eval "$deps"

Sorry for the delays responding to this thread; life has been getting
in the way.

Daniel

  reply	other threads:[~2020-02-06 12:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17 23:20 Andrew Reyes
2020-01-18 19:40 ` Daniel Shahaf
2020-01-23  3:12   ` Daniel Shahaf
2020-01-23  9:53     ` Peter Stephenson
2020-01-26  0:45       ` Daniel Shahaf
2020-01-27 14:01         ` Peter Stephenson
2020-01-28 11:09           ` Peter Stephenson
2020-01-29 11:23             ` Peter Stephenson
2020-02-06 12:40               ` Daniel Shahaf [this message]
2020-02-06 13:32                 ` Mikael Magnusson
2020-02-06 14:09                   ` Peter Stephenson
2020-03-14  3:28                     ` Daniel Shahaf
2020-01-29  8:34           ` Daniel Shahaf

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=20200206124023.450ee3f3@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@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).