On Fri, Aug 19, 2016 at 04:22:16PM -0500, Derek Martin wrote:
> I have a patch that I believe does what's needed.  It passed all my
> testing, including running with my default config, setting locale,
> unsetting locale, adding or removing a ! to the date format in
> index_format.

Thanks Derek!

First, let me make sure everyone saw the change in main.c:

> diff -ur mutt-1.7.0/main.c mutt-1.7.0.locale_patch/main.c
> --- mutt-1.7.0/main.c 2016-08-10 21:47:00.000000000 -0400
> +++ mutt-1.7.0.locale_patch/main.c    2016-08-19 15:12:53.133585104 -0400
> @@ -597,15 +597,14 @@
>      exit(1);
>    }
>  
> +  setlocale (LC_ALL, "");
> +
>  #ifdef ENABLE_NLS
>    /* FIXME what about init.c:1439 ? */
> -  setlocale (LC_ALL, "");
>    bindtextdomain (PACKAGE, MUTTLOCALEDIR);
>    textdomain (PACKAGE);
>  #endif
>  
> -  setlocale (LC_CTYPE, "");
> -
>    mutt_error = mutt_nocurses_error;
>    mutt_message = mutt_nocurses_error;
>    SRAND (time (NULL));

So this is now setting LC_ALL.  Is there a reason this wasn't done
before?  Are there subtle bugs that may ensue because of this?  I have
no idea, so I'd like to hear from everyone familiar with locales issues.

>  - The default locale is now "" allowing it to be set from OS settings

Yup, this sounds right.

>  - I ADDED a call to setlocale() before the index is redrawn

I don't see this change in the patch.  Perhaps related to this, how is
the patch dealing with the user setting $locale either in .muttrc or
during execution of mutt?

> diff -ur mutt-1.7.0/hdrline.c mutt-1.7.0.locale_patch/hdrline.c
> --- mutt-1.7.0/hdrline.c      2016-08-10 21:47:00.000000000 -0400
> +++ mutt-1.7.0.locale_patch/hdrline.c 2016-08-19 16:03:34.923835398 -0400
> @@ -406,10 +403,13 @@
>         tm = gmtime (&T);
>       }
>  
> +        if (!do_locales)
> +       setlocale (LC_TIME, "C");
> +
>       strftime (buf2, sizeof (buf2), dest, tm);
>  
> -     if (do_locales)
> -       setlocale (LC_TIME, "C");
> +     if (!do_locales)
> +       setlocale (LC_TIME, Locale);

It looks like you did this in most places, but make sure to put a NONULL
around Locale here.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to