zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: set temporary environment variables for builtins
Date: Sun, 17 Dec 2023 00:53:12 +0100	[thread overview]
Message-ID: <CAHYJk3T5FJ77bFXU5zATFQNUuYoptQdaSLTozCN44est8Rr_4A@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMqDhNPfw7GdBAEf6HqtR_NuhHK5oEO+naxcx-f0UDhpPA@mail.gmail.com>

On 12/16/23, Roman Perepelitsa <roman.perepelitsa@gmail.com> wrote:
> On Sat, Dec 16, 2023 at 9:28 PM Bart Schaefer <schaefer@brasslantern.com>
> wrote:
>>
>> On Sat, Dec 16, 2023 at 12:22 PM Lawrence Velázquez <larryv@zsh.org>
>> wrote:
>> >
>> > It does work, in general.
>>
>> Well, no, it doesn't.  It works for parameters that zsh separately
>> considers to be "special", which includes all the LC_* variants.  TZ
>> is not special.
>
> In which sense is LC_TIME special for print but TZ is not?

Setting any of the LC_* parameters explicitly calls some locale stuff
(whether or not it is exported), apart from just setting the
parameters:

/**/
void
lcsetfn(Param pm, char *x)
{
    char *x2;
    struct localename *ln;

    strsetfn(pm, x);
    if ((x2 = getsparam("LC_ALL")) && *x2)
	return;
    queue_signals();
    /* Treat empty LC_* the same as unset. */
    if (!x || !*x)
	x = getsparam("LANG");

    /*
     * If we've got no non-empty string at this
     * point (after checking $LANG, too),
     * we shouldn't bother setting anything.
     */
    if (x && *x) {
	for (ln = lc_names; ln->name; ln++)
	    if (!strcmp(ln->name, pm->node.nam))
		setlocale(ln->category, unmeta(x));
    }
    unqueue_signals();
    clear_mbstate();	/* LC_CTYPE may have changed */
    inittyptab();
}


-- 
Mikael Magnusson


  parent reply	other threads:[~2023-12-16 23:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16 17:59 Clinton Bunch
2023-12-16 18:53 ` Lawrence Velázquez
2023-12-16 19:48   ` Clinton Bunch
2023-12-16 20:20     ` Bart Schaefer
2023-12-16 20:21     ` Lawrence Velázquez
2023-12-16 20:27       ` Bart Schaefer
2023-12-16 20:31         ` Roman Perepelitsa
2023-12-16 20:35           ` Bart Schaefer
2023-12-16 23:53           ` Mikael Magnusson [this message]
2023-12-17  0:26         ` Lawrence Velázquez
2023-12-17  7:54           ` Roman Perepelitsa

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=CAHYJk3T5FJ77bFXU5zATFQNUuYoptQdaSLTozCN44est8Rr_4A@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --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).