From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: nisoni@algon.dk, stefan@marxist.se, 51321@debbugs.gnu.org,
mardani29@yahoo.es, larsi@gnus.org,
Filipp Gunbin <fgunbin@fastmail.fm>
Subject: bug#51321: 29.0.50; date in modelines
Date: Mon, 1 Nov 2021 21:17:36 +0000 [thread overview]
Message-ID: <YYBZcIRB4SJlvqsv@idiocy.org> (raw)
In-Reply-To: <838ry8lzal.fsf@gnu.org>
On Mon, Nov 01, 2021 at 04:34:58PM +0200, Eli Zaretskii wrote:
> > From: Filipp Gunbin <fgunbin@fastmail.fm>
> > Cc: alan@idiocy.org, larsi@gnus.org, nisoni@algon.dk, stefan@marxist.se,
> > 51321@debbugs.gnu.org, mardani29@yahoo.es
> > Date: Mon, 01 Nov 2021 17:21:36 +0300
> >
> > >> So maybe we should check that the locale is valid before setting it...
> > >
> > > "Valid" in what sense? Is that locale not installed on your system,
> > > or are you saying that it cannot exist?
> >
> > I think in the sense of 'locale -a | grep ru' in this case:
> >
> > ru_RU.ISO8859-5
> > ru_RU.CP866
> > ru_RU.CP1251
> > ru_RU.UTF-8
> > ru_RU.KOI8-R
> > ru_RU
> >
> > Maybe it could exist, but it doesn't on macOS.
> >
> > > (And why does the warning come from Bash when it was Emacs who sets
> > > the locale?)
> >
> > Forgot to tell - this output shows up when running shell command from
> > emacs (M-! or similar).
>
> Hmm... actually, why do we call setenv instead of calling setlocale
> directly? Doesn't macOS support setlocale? AFAIU, calling setlocale
> would then only affect Emacs itself, not its sub-processes.
The point of this is to affect Emacs's sub-processes.
I know almost nothing about the locale, but from reading the man pages
I can't understand why we need to set LC_ALL when we're already
setting LANG. Isn't LANG the fallback if LC_ALL isn't set?
Anyway, I think we can use setlocale to test if the locale string is
valid, but I don't know if there are any other problems with that.
Would we want to reset it after testing?
I suppose it might also be preferable to not even try doing this if
Emacs was run from a terminal since the original problem really only
manifests when Emacs is run from the GUI.
Fillip, can you please try this:
modified src/nsterm.m
@@ -543,10 +543,13 @@ - (NSColor *)colorUsingDefaultColorSpace
NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
[locale localeIdentifier]];
- /* Set LANG and LC_ALL to locale, but not if the variables are
- already set. */
- setenv("LANG", [localeID UTF8String], 0);
- setenv("LC_ALL", [localeID UTF8String], 0);
+ if (!isatty (STDIN_FILENO) && setlocale (LC_ALL, [localeID UTF8String]))
+ {
+ /* Set LANG and LC_ALL to locale, but not if the variables are
+ already set. */
+ setenv("LANG", [localeID UTF8String], 0);
+ setenv("LC_ALL", [localeID UTF8String], 0);
+ }
}
@catch (NSException *e)
{
--
Alan Third
next prev parent reply other threads:[~2021-11-01 21:17 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 15:24 bug#51321: 29.0.50; date in modelines Niels Søndergaard
2021-10-21 17:00 ` Eli Zaretskii
2021-10-21 18:09 ` Niels Søndergaard
2021-10-21 18:13 ` Niels Søndergaard
2021-10-21 18:18 ` Eli Zaretskii
2021-10-22 1:37 ` Niels Søndergaard
2021-10-22 6:34 ` Eli Zaretskii
2021-10-22 13:27 ` Niels Søndergaard
2021-10-22 14:11 ` Eli Zaretskii
2021-10-23 12:16 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-23 12:23 ` Eli Zaretskii
2021-10-23 12:52 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-23 16:00 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-30 15:41 ` Stefan Kangas
2021-10-30 18:09 ` Alan Third
2021-10-31 9:06 ` Eli Zaretskii
2021-10-31 10:14 ` Alan Third
2021-10-31 13:01 ` Eli Zaretskii
2021-11-01 13:04 ` Filipp Gunbin
2021-11-01 13:33 ` Eli Zaretskii
2021-11-01 14:21 ` Filipp Gunbin
2021-11-01 14:34 ` Eli Zaretskii
2021-11-01 14:45 ` Filipp Gunbin
2021-11-01 21:17 ` Alan Third [this message]
2021-11-01 22:17 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-02 3:40 ` Niels Søndergaard
2021-11-02 16:10 ` Filipp Gunbin
2021-11-02 18:22 ` Stefan Kangas
2021-11-09 7:52 ` Stefan Kangas
2021-11-09 14:13 ` Filipp Gunbin
2022-09-10 5:09 ` Lars Ingebrigtsen
2021-11-02 1:10 ` Filipp Gunbin
2021-10-23 12:34 ` Niels Søndergaard
2021-10-23 12:55 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-23 12:58 ` Niels Søndergaard
2021-10-22 14:40 ` Lars Ingebrigtsen
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=YYBZcIRB4SJlvqsv@idiocy.org \
--to=alan@idiocy.org \
--cc=51321@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=fgunbin@fastmail.fm \
--cc=larsi@gnus.org \
--cc=mardani29@yahoo.es \
--cc=nisoni@algon.dk \
--cc=stefan@marxist.se \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.