On Fri, Aug 19, 2016 at 02:23:32PM -0700, Kevin J. McCarthy wrote:
> Most places, such as in crypt.c, crypt-gpgme.c, hdrline.c, and pgpkey.c
> all take pains to reset the LC_TIME back to "C".  However,
> folder_format_str() in browser.c does *not* set it back!
> 
> I would like to change $locale to default to "".  But I need feedback
> about what to do with LC_TIME.  Is it important to Mutt that this
> defaults to "C" for other cases?

That behavior is exactly wrong, actually.  Mutt should NEVER
explicitly set it to "C", EXCEPT when it is overriding what is set by
the user because their configured time format string (which may be
part of index_format, date_format, etc.) starts with a '!' char.

In a general sense, Mutt should plan to set the locale exactly once,
at initialization, based on the combination of the OS settings and the
user's setting of $locale, and not muck with it other than for the
above reason.  This means, when the above exception occurs, Mutt
should:

  setlocale(LC_TIME, "C");
  strftime(...);
  /* Locale now defaults to "", using OS settings */
  setlocale(LC_TIME, Locale); 
 
Strategically speaking, Mutt should plan to never set locale settings
at any other time.

Of course since the user can change $locale at run time, you need to
be sure to provide a way for that to happen.  Setting a variable
doesn't really allow for behaviors to be immediately triggered, as far
as I can tell, EXCEPT for a handful of hard-coded things like
redrawing the screen, which it just so happens is needed to make the
$locale setting take effect.  So, to ensure changed settings take
effect, one sensible place to call setocale() is whenever the screen
is redrawn.

If the above steps are taken, any other call to setlocale() is
superfluous, and can be removed.

The patch I posted does all of the above. =8^)

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

Attachment: pgpM8B04S3veZ.pgp
Description: PGP signature

Reply via email to