Subject: bug#58193: 29.0.50; Screen flickers on with-locale-environment

From: Eli Zaretskii <[email-masked]>
Date: Sat, 01 Oct 2022 10:10:03 +0300

> From: Pedro Andres Aranda Gutierrez <[email-masked]>
> Date: Sat, 1 Oct 2022 08:14:36 +0200
> Cc: Lars Ingebrigtsen <[email-masked]>, [email-masked]
> 
> I fear in my case it's the other way round. IMHO, I think I have a minimal clue of what it does ;-)
> Let me expand a bit:
> 
> My use case is that of a multi-lingual writer/programmer who needs the date to appear in the language used
> in the text which is currently being edited. 
> My default locale is "C" because it fits my needs when programming, but then I also produce 'text
> documents' (.tex, .org, .md, .txt) in 3-4 languages.
> I'm lucky, because most of "my multi-linguality" can be handled by changing ispell-dictionary and with \date in
> LaTEX. But in a couple of
> cases, I need the date to appear 'burnt in fire' in the text.
> 
> My questioning the way with-locale-environment works comes from my use case. 
> I need the date to adhere to a 'temporary' locale which only needs to be valid when I generate a string that I
> then insert into the buffer. 
> And to have the screen flickering because I have generated a string is not a 'nice' UI design principle
> IMvvHO.

I understand your use case.  I'm arguing about the default, not about
the need to support your use case.  The default should be to redraw
the frame, and your use case should be supported by having some
variable that you could bind around the call of the macro, to prevent
redrawing.

> Maybe we should leave this macro as-is because of the legacy and work towards something in the line of the
> cl-setlocale function in Common LISP.

Common Lisp is just a programming language, it is not a display
editor.  In Emacs, certain operations that affect the display should
be immediately reflected on display.

> If you look at 'man setlocale' as an inspiration of what I would be dreaming of...

setlocale is a low-level function that is called by Emacs as part of
this macro.