zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: Feature request: ZSH_XTRACEFD variable
Date: Sun, 3 May 2020 21:06:18 +0000	[thread overview]
Message-ID: <20200503210618.5c639014@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <e909f9a6be010fa1027c465829db7511a334fa35.camel@ntlworld.com>

Peter Stephenson wrote on Sun, 03 May 2020 20:54 +0100:
> On Sun, 2020-05-03 at 06:43 +0200, Roman Perepelitsa wrote:
> > On Sun, May 3, 2020 at 2:07 AM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:  
> > > 
> > > I would have expected the unsetfn to be called for any special parameter.  
> > 
> > I've bumped into a similar issue with LC_* parameters. Here are a
> > couple of test cases:
> > 
> > 1.
> > 
> >   (
> >     unset -m 'LC_*|LANG'
> >     export LC_CTYPE='en_US.UTF-8'  # set this to any UTF-8 locale you have
> >     echo '\u276F'  # this works
> >     () {
> >       local LC_ALL=C  
> >     }  
> >     echo '\u276F'  # this doesn't work
> >   )
> > 
> > 2.
> > 
> >   (
> >     unset -m 'LC_*|LANG'
> >     LC_COLLATE=en_US.UTF-8
> >     x=(-a --b)
> >     print -r -- ${(on)x}  # this prints "-a --b"
> >     () {
> >       local LC_ALL= LC_COLLATE=C
> >       print -r -- ${(on)x}  
> >     }  
> >     print -r -- ${(on)x}  # this prints "--b -a"
> >   )  
> 
> Something like the attached?  Slightly but not extensively tested, so I could easily
> have missed something.

Confirmed it fixes Roman's case (1).

When LC_ALL is unset, the patch calls setlocale() for all known locale
categories (LC_*), not only for the ones that changed, like langsetfn()
and lcsetfn() do.  Is this a problem?  (I guess there was a reason
langsetfn() and lcsetfn() weren't implemented to begin with via the
if/else/for combination you just wrote.)

I had in mind a different approach: I thought of having scanendscope()
call unsetfn for (some subset of?) special parameters and having LANG
and LC_* use a custom unsetfn rather than the default one.  Even if
this is sensible, we can leave it for future work, though; I wouldn't
want to make the perfect the enemy of the good.

Cheers,

Daniel

  reply	other threads:[~2020-05-03 21:07 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 15:08 Timothée Mazzucotelli
2019-05-18  7:55 ` Stephane Chazelas
2019-05-20 10:34   ` Stephane Chazelas
2019-07-21 15:08     ` Timothée Mazzucotelli
2019-07-21 15:22       ` Peter Stephenson
2019-07-31 19:40         ` Timothée Mazzucotelli
2019-07-31 19:45           ` Timothée Mazzucotelli
2019-07-31 21:12             ` Sebastian Gniazdowski
2019-08-13  9:14           ` Peter Stephenson
2019-08-13 15:38           ` Peter Stephenson
2019-09-10 22:19             ` Timothée Mazzucotelli
2019-09-11  8:45               ` Peter Stephenson
2020-04-19 10:30             ` Timothée Mazzucotelli
2020-04-20 14:09               ` Peter Stephenson
2020-05-02 18:02                 ` Timothée Mazzucotelli
2020-05-02 21:15                   ` Bart Schaefer
2020-05-03  0:06                     ` Daniel Shahaf
2020-05-03  4:43                       ` Roman Perepelitsa
2020-05-03 16:21                         ` Daniel Shahaf
2020-05-03 19:54                         ` Peter Stephenson
2020-05-03 21:06                           ` Daniel Shahaf [this message]
2020-05-04  8:35                             ` Peter Stephenson
2020-05-05  0:03                               ` Daniel Shahaf
2020-05-05 16:36                                 ` Timothée Mazzucotelli
2020-05-05 16:47                                   ` Peter Stephenson
2020-05-05 22:19                                     ` Bart Schaefer
2020-09-03 13:51                                       ` Timothée Mazzucotelli
2020-09-04 19:48                                         ` Daniel Shahaf
2020-09-04 19:53                                           ` Bart Schaefer
2020-09-05  9:24                                             ` Timothée Mazzucotelli
2020-05-05 22:11                                   ` Bart Schaefer
2020-05-03  6:01                       ` Stephane Chazelas
2020-05-03  7:07                         ` Stephane Chazelas
2020-05-03 17:30                   ` Peter Stephenson
2020-05-03 21:23                     ` Daniel Shahaf
2020-05-04  8:26                       ` Peter Stephenson
2020-05-05 20:50               ` 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=20200503210618.5c639014@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).