From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#51321: 29.0.50; date in modelines Date: Mon, 1 Nov 2021 21:17:36 +0000 Message-ID: References: <83bl35o95u.fsf@gnu.org> <83cznkm25j.fsf@gnu.org> <838ry8lzal.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32293"; mail-complaints-to="usenet@ciao.gmane.io" Cc: nisoni@algon.dk, stefan@marxist.se, 51321@debbugs.gnu.org, mardani29@yahoo.es, larsi@gnus.org, Filipp Gunbin To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 01 22:18:25 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mhehF-0008EK-2n for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Nov 2021 22:18:25 +0100 Original-Received: from localhost ([::1]:33406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhehD-0003AN-4V for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Nov 2021 17:18:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhegs-00039A-Ne for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2021 17:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52963) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhegs-0008Bx-EC for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2021 17:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mhegs-0000f6-8f for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2021 17:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Nov 2021 21:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51321 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51321-submit@debbugs.gnu.org id=B51321.16358014762531 (code B ref 51321); Mon, 01 Nov 2021 21:18:02 +0000 Original-Received: (at 51321) by debbugs.gnu.org; 1 Nov 2021 21:17:56 +0000 Original-Received: from localhost ([127.0.0.1]:36272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhegg-0000ea-S2 for submit@debbugs.gnu.org; Mon, 01 Nov 2021 17:17:56 -0400 Original-Received: from outbound.soverin.net ([116.202.126.228]:32949) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhege-0000eM-LW for 51321@debbugs.gnu.org; Mon, 01 Nov 2021 17:17:49 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 7FA8695; Mon, 1 Nov 2021 21:17:42 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1635801461; bh=MGOB0RL35pbzdE26W/LJtZQipKb16XJIdff+vh3TLOw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KqBTj/8LJDMRc/dXTLBAxJcJXTYtnn29w+O7wWL6JsvKTwNm5AtzlUlytA0nclcqL HznYLxbDbMZHrhjvezNvGoaXZ6XX4CuKR2X7hjd94Qiic3dYnq0FwcbD1dad8bifaO 9/oI8z3hLYt61GMo9sYpMg6WU7Iop7/1utuO8QIwYVeO0CnnO9Hz/0l2vrzHBM1HB9 G505ZjcHMeQLwgv8J2bpsdt7uk1HD4Y/OUImIe89mJnI/N6qCMShqyxs7+LDyt3+oC ZbcLKqt0XRp0lPNd3eR/4nuK6VB5TLbClmHmcdnS64r8tfYhXcMSUvv8BKWwqjZssy GixlrwCaFAT5w== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95-RC2) (envelope-from ) id 1mhegS-0006jx-4h; Mon, 01 Nov 2021 21:17:36 +0000 Mail-Followup-To: Alan Third , Eli Zaretskii , Filipp Gunbin , larsi@gnus.org, nisoni@algon.dk, stefan@marxist.se, 51321@debbugs.gnu.org, mardani29@yahoo.es Content-Disposition: inline In-Reply-To: <838ry8lzal.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:218790 Archived-At: On Mon, Nov 01, 2021 at 04:34:58PM +0200, Eli Zaretskii wrote: > > From: Filipp Gunbin > > 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