unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#58193: 29.0.50; Screen flickers on with-locale-environment
@ 2022-09-30 13:05 Pedro Andres Aranda Gutierrez
  2022-09-30 13:50 ` Eli Zaretskii
  2022-09-30 14:14 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-09-30 13:05 UTC (permalink / raw)
  To: 58193

[-- Attachment #1: Type: text/plain, Size: 4002 bytes --]

Include the following code in *scratch*

(with-locale-environment "C"
  (insert (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))

Evaluate with C-c C-e and experience a screen flicker


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.20, cairo version 1.16.0) of 2022-09-25 built on emacs29
Repository revision: d98ee767765032acc7f8f14c86dcbbfb67dbcaee
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.5 LTS

Configured using:
 'configure --prefix=/usr --program-suffix=29 --with-json --with-x
 --with-x-toolkit=gtk3 --with-cairo --with-compress-install
 --with-modules=yes --with-threads --with-included-regex --with-zlib
 --with-native-compilation 'CFLAGS=-g -O2
 -fdebug-prefix-map=/home/paag/emacs=. -fstack-protector-strong -Wformat
 -Werror=format-security' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM
GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: es_ES.UTF-8
  value of $LC_NUMERIC: es_ES.UTF-8
  value of $LC_TIME: es_ES.UTF-8
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date cl-loaddefs
comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra
help-mode bytecomp byte-compile cconv cl-lib rmc iso-transl tooltip
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
faces cus-face macroexp files window text-properties overlay sha1 md5
base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 78797 7326)
 (symbols 48 7139 0)
 (strings 32 19737 1932)
 (string-bytes 1 573331)
 (vectors 16 15678)
 (vector-slots 8 321210 11742)
 (floats 8 29 58)
 (intervals 56 402 1)
 (buffers 1000 12))

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 5388 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 13:05 bug#58193: 29.0.50; Screen flickers on with-locale-environment Pedro Andres Aranda Gutierrez
@ 2022-09-30 13:50 ` Eli Zaretskii
  2022-09-30 14:14 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 33+ messages in thread
From: Eli Zaretskii @ 2022-09-30 13:50 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: 58193

> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> Date: Fri, 30 Sep 2022 15:05:34 +0200
> 
> Include the following code in *scratch*
> 
> (with-locale-environment "C"
>   (insert (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))
> 
> Evaluate with C-c C-e and experience a screen flicker

with-locale-environment calls set-terminal-coding-system, which calls
redraw-frame.  That's the reason you see the flicker.

I see no bug here, FWIW.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 13:05 bug#58193: 29.0.50; Screen flickers on with-locale-environment Pedro Andres Aranda Gutierrez
  2022-09-30 13:50 ` Eli Zaretskii
@ 2022-09-30 14:14 ` Lars Ingebrigtsen
  2022-09-30 15:43   ` Pedro Andres Aranda Gutierrez
  2022-09-30 17:31   ` Eli Zaretskii
  1 sibling, 2 replies; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-30 14:14 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: 58193

Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> Include the following code in *scratch*
>
> (with-locale-environment "C"
>   (insert (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))
>
> Evaluate with C-c C-e and experience a screen flicker

I think I've now fixed this -- can you test?  (I don't see the flicker
myself.)





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 14:14 ` Lars Ingebrigtsen
@ 2022-09-30 15:43   ` Pedro Andres Aranda Gutierrez
  2022-09-30 16:31     ` Lars Ingebrigtsen
  2022-09-30 17:31   ` Eli Zaretskii
  1 sibling, 1 reply; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-09-30 15:43 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 58193

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

It doesn't flicker... but it doesn't seem to change the locale either...
I tried

(message

 (with-locale-environment "es_ES.utf8"

   (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))

and

(message

 (with-locale-environment "C"

   (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))

And in both cases I get the "C" locale :(
Before the strings were correctly generated

Thanks for the patience, /PA

On Fri, 30 Sept 2022 at 16:14, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
>
> > Include the following code in *scratch*
> >
> > (with-locale-environment "C"
> >   (insert (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))
> >
> > Evaluate with C-c C-e and experience a screen flicker
>
> I think I've now fixed this -- can you test?  (I don't see the flicker
> myself.)
>


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 2421 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 15:43   ` Pedro Andres Aranda Gutierrez
@ 2022-09-30 16:31     ` Lars Ingebrigtsen
  2022-10-01  7:26       ` Pedro Andres Aranda Gutierrez
  0 siblings, 1 reply; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-30 16:31 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: 58193

Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> It doesn't flicker... but it doesn't seem to change the locale either... 
> I tried
>
> (message                                                                     
>  (with-locale-environment "es_ES.utf8"                                                
>    (format-time-string ";; %a, %d %b %Y %H:%m:%S %z"))) 
>
> and
>
> (message                                                                     
>  (with-locale-environment "C"                                                
>    (format-time-string ";; %a, %d %b %Y %H:%m:%S %z"))) 
>
> And in both cases I get the "C" locale :(
> Before the strings were correctly generated

Does

(message                                                                     
 (with-locale-environment "es_ES.UTF-8"
   (format-time-string ";; %a, %d %b %Y %H:%m:%S %z"))) 

work better?  If not, do you have the "es_ES.UTF-8" locale in your
environment?

In any case, with this recipe (i.e., the `message' around the
`with-locale--' I can reproduce the flashing, even after the fix.  :-/
But I get

;; vie, 30 sep 2022 18:09:18 +0200





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 14:14 ` Lars Ingebrigtsen
  2022-09-30 15:43   ` Pedro Andres Aranda Gutierrez
@ 2022-09-30 17:31   ` Eli Zaretskii
  2022-09-30 17:34     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2022-09-30 17:31 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 58193, paaguti

> Cc: 58193@debbugs.gnu.org
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Fri, 30 Sep 2022 16:14:49 +0200
> 
> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
> 
> > Include the following code in *scratch*
> >
> > (with-locale-environment "C"
> >   (insert (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))
> >
> > Evaluate with C-c C-e and experience a screen flicker
> 
> I think I've now fixed this -- can you test?  (I don't see the flicker
> myself.)

I'd rather leave the decision whether to redraw or not to the caller.
I don't see how we can safely assume that the caller never wants to
actually use the locale's settings for something display-oriented.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 17:31   ` Eli Zaretskii
@ 2022-09-30 17:34     ` Lars Ingebrigtsen
  2022-09-30 17:40       ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-30 17:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58193, paaguti

Eli Zaretskii <eliz@gnu.org> writes:

> I'd rather leave the decision whether to redraw or not to the caller.
> I don't see how we can safely assume that the caller never wants to
> actually use the locale's settings for something display-oriented.

That's what this does.  If the caller wants to redraw, the caller should
call `redraw-frame' in the body of that macro.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 17:34     ` Lars Ingebrigtsen
@ 2022-09-30 17:40       ` Eli Zaretskii
  2022-09-30 17:43         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2022-09-30 17:40 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 58193, paaguti

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: paaguti@gmail.com,  58193@debbugs.gnu.org
> Date: Fri, 30 Sep 2022 19:34:17 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I'd rather leave the decision whether to redraw or not to the caller.
> > I don't see how we can safely assume that the caller never wants to
> > actually use the locale's settings for something display-oriented.
> 
> That's what this does.  If the caller wants to redraw, the caller should
> call `redraw-frame' in the body of that macro.

IMO, that assumes to much knowledge on the part of the caller.  I'd
prefer a variable that would tell the macro that the body does include
display.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 17:40       ` Eli Zaretskii
@ 2022-09-30 17:43         ` Lars Ingebrigtsen
  2022-09-30 18:34           ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-30 17:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58193, paaguti

Eli Zaretskii <eliz@gnu.org> writes:

> IMO, that assumes to much knowledge on the part of the caller.  I'd
> prefer a variable that would tell the macro that the body does include
> display.

It's a macro that changes the locale.  It doesn't say anything about
doing redisplay at all, so anybody that wants to do redisplay (for
whatever reason) will use the normal ways of doing that.

I.e., there's no particular knowledge needed.






^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 17:43         ` Lars Ingebrigtsen
@ 2022-09-30 18:34           ` Eli Zaretskii
  2022-10-01  6:14             ` Pedro Andres Aranda Gutierrez
  2022-10-01  9:56             ` Lars Ingebrigtsen
  0 siblings, 2 replies; 33+ messages in thread
From: Eli Zaretskii @ 2022-09-30 18:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 58193, paaguti

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: paaguti@gmail.com,  58193@debbugs.gnu.org
> Date: Fri, 30 Sep 2022 19:43:11 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > IMO, that assumes to much knowledge on the part of the caller.  I'd
> > prefer a variable that would tell the macro that the body does include
> > display.
> 
> It's a macro that changes the locale.  It doesn't say anything about
> doing redisplay at all, so anybody that wants to do redisplay (for
> whatever reason) will use the normal ways of doing that.
> 
> I.e., there's no particular knowledge needed.

Many Lisp programmers don't realize what the macro does, in enough
detail to understand that it might affect the display.  Suppressing
redrawing of the frame by default is IMO the wrong default: the
flicker in case redrawing wasn't needed is just an annoyance, whereas
failure to redraw when it is needed is a much more serious problem.

So if we want to make the caller responsible for whether the frame
should be redrawn, the default should to redraw it, and callers that
want to avoid that would need to take some measures to that end.
Which is the opposite of what we have now.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 18:34           ` Eli Zaretskii
@ 2022-10-01  6:14             ` Pedro Andres Aranda Gutierrez
  2022-10-01  7:10               ` Eli Zaretskii
  2022-10-01  9:56             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-01  6:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, 58193

[-- Attachment #1: Type: text/plain, Size: 2756 bytes --]

Hi Eli, Lars

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.

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.
If you look at 'man setlocale' as an inspiration of what I would be
dreaming of...

My .001 c, /PA

On Fri, 30 Sept 2022 at 20:34, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Lars Ingebrigtsen <larsi@gnus.org>
> > Cc: paaguti@gmail.com,  58193@debbugs.gnu.org
> > Date: Fri, 30 Sep 2022 19:43:11 +0200
> >
> > Eli Zaretskii <eliz@gnu.org> writes:
> >
> > > IMO, that assumes to much knowledge on the part of the caller.  I'd
> > > prefer a variable that would tell the macro that the body does include
> > > display.
> >
> > It's a macro that changes the locale.  It doesn't say anything about
> > doing redisplay at all, so anybody that wants to do redisplay (for
> > whatever reason) will use the normal ways of doing that.
> >
> > I.e., there's no particular knowledge needed.
>
> Many Lisp programmers don't realize what the macro does, in enough
> detail to understand that it might affect the display.  Suppressing
> redrawing of the frame by default is IMO the wrong default: the
> flicker in case redrawing wasn't needed is just an annoyance, whereas
> failure to redraw when it is needed is a much more serious problem.
>
> So if we want to make the caller responsible for whether the frame
> should be redrawn, the default should to redraw it, and callers that
> want to avoid that would need to take some measures to that end.
> Which is the opposite of what we have now.
>


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 3887 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  6:14             ` Pedro Andres Aranda Gutierrez
@ 2022-10-01  7:10               ` Eli Zaretskii
  2022-10-01  7:23                 ` Pedro Andres Aranda Gutierrez
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2022-10-01  7:10 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: larsi, 58193

> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> Date: Sat, 1 Oct 2022 08:14:36 +0200
> Cc: Lars Ingebrigtsen <larsi@gnus.org>, 58193@debbugs.gnu.org
> 
> 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.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  7:10               ` Eli Zaretskii
@ 2022-10-01  7:23                 ` Pedro Andres Aranda Gutierrez
  2022-10-01  7:33                   ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-01  7:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, 58193

[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]

On Sat, 1 Oct 2022 at 09:10, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> > Date: Sat, 1 Oct 2022 08:14:36 +0200
> > Cc: Lars Ingebrigtsen <larsi@gnus.org>, 58193@debbugs.gnu.org
>
> 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.
>

Good, I could live with that


> > 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.
>

So, one implication of my question is whether all operations that need a
specific locale to be set need the display redrawn...

> 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.


I know, and I was wondering if we could create an Elisp construct that
*only* uses setlocate if we are sure that we do not need to redraw the
screen

I think we are approaching 'violent agreement' :-)

Thx, /PA


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 2834 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 16:31     ` Lars Ingebrigtsen
@ 2022-10-01  7:26       ` Pedro Andres Aranda Gutierrez
  2022-10-01  9:57         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-01  7:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen, 58193, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]

That seems to work. And I don't see any flicker on a text mode screen
(inside a VM)...
checking on a graphic screen I do see the flickering :( but it works.

Yesterday was a long day ...
Best, /PA

On Fri, 30 Sept 2022 at 18:31, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
>
> > It doesn't flicker... but it doesn't seem to change the locale either...
> > I tried
> >
> > (message
>
> >  (with-locale-environment "es_ES.utf8"
>
> >    (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))
> >
> > and
> >
> > (message
>
> >  (with-locale-environment "C"
>
> >    (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))
> >
> > And in both cases I get the "C" locale :(
> > Before the strings were correctly generated
>
> Does
>
> (message
>
>  (with-locale-environment "es_ES.UTF-8"
>    (format-time-string ";; %a, %d %b %Y %H:%m:%S %z")))
>
> work better?  If not, do you have the "es_ES.UTF-8" locale in your
> environment?
>
> In any case, with this recipe (i.e., the `message' around the
> `with-locale--' I can reproduce the flashing, even after the fix.  :-/
> But I get
>
> ;; vie, 30 sep 2022 18:09:18 +0200
>


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 2717 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  7:23                 ` Pedro Andres Aranda Gutierrez
@ 2022-10-01  7:33                   ` Eli Zaretskii
  2022-10-01  8:19                     ` Pedro Andres Aranda Gutierrez
  2022-10-01 10:46                     ` Pedro Andres Aranda Gutierrez
  0 siblings, 2 replies; 33+ messages in thread
From: Eli Zaretskii @ 2022-10-01  7:33 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: larsi, 58193

> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> Date: Sat, 1 Oct 2022 09:23:12 +0200
> Cc: larsi@gnus.org, 58193@debbugs.gnu.org
> 
>  > 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.
> 
> So, one implication of my question is whether all operations that need a specific locale to be set need the
> display redrawn... 

If all you want is to have time displayed per a certain locale's
conventions, maybe it's enough to set system-time-locale?  Did you try
that?  set-locale-environment (which is what with-locale-environment
uses) does much more than just adjusts the locale's time format.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  7:33                   ` Eli Zaretskii
@ 2022-10-01  8:19                     ` Pedro Andres Aranda Gutierrez
  2022-10-01  9:10                       ` Eli Zaretskii
  2022-10-01 10:46                     ` Pedro Andres Aranda Gutierrez
  1 sibling, 1 reply; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-01  8:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, 58193

Eli
This is just an example. But there are other… currency being one of them.
Best /PA

Enviado desde mi iPhone

> El 1 oct 2022, a las 9:33, Eli Zaretskii <eliz@gnu.org> escribió:
> 
> 
>> 
>> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
>> Date: Sat, 1 Oct 2022 09:23:12 +0200
>> Cc: larsi@gnus.org, 58193@debbugs.gnu.org
>> 
>>> 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.
>> 
>> So, one implication of my question is whether all operations that need a specific locale to be set need the
>> display redrawn... 
> 
> If all you want is to have time displayed per a certain locale's
> conventions, maybe it's enough to set system-time-locale?  Did you try
> that?  set-locale-environment (which is what with-locale-environment
> uses) does much more than just adjusts the locale's time format.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  8:19                     ` Pedro Andres Aranda Gutierrez
@ 2022-10-01  9:10                       ` Eli Zaretskii
  0 siblings, 0 replies; 33+ messages in thread
From: Eli Zaretskii @ 2022-10-01  9:10 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: larsi, 58193

> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> Date: Sat, 1 Oct 2022 10:19:19 +0200
> Cc: larsi@gnus.org, 58193@debbugs.gnu.org
> 
> Eli
> This is just an example. But there are other… currency being one of them.

For each example its solution.  For currency, I don't think Emacs
currently have any solution, and with-locale-environment would not
help you for that reason.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-09-30 18:34           ` Eli Zaretskii
  2022-10-01  6:14             ` Pedro Andres Aranda Gutierrez
@ 2022-10-01  9:56             ` Lars Ingebrigtsen
  2022-10-01  9:57               ` Lars Ingebrigtsen
  2022-10-01 10:01               ` Eli Zaretskii
  1 sibling, 2 replies; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-01  9:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58193, paaguti

Eli Zaretskii <eliz@gnu.org> writes:

> Many Lisp programmers don't realize what the macro does, in enough
> detail to understand that it might affect the display.

I added this macro about a month ago, and I did not have redisplay in
mind -- redisplay is as irrelevant to this macro as it is to macros like
`when-let'.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  9:56             ` Lars Ingebrigtsen
@ 2022-10-01  9:57               ` Lars Ingebrigtsen
  2022-10-01 10:01               ` Eli Zaretskii
  1 sibling, 0 replies; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-01  9:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58193, paaguti

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I added this macro about a month ago

I mean, a year and a month ago.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  7:26       ` Pedro Andres Aranda Gutierrez
@ 2022-10-01  9:57         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-01  9:57 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: Eli Zaretskii, 58193

Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> That seems to work. And I don't see any flicker on a text mode screen
> (inside a VM)...  checking on a graphic screen I do see the flickering
> :( but it works.

Do you still see flickering on the current trunk (I pushed some
additional fixes after the first one).





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  9:56             ` Lars Ingebrigtsen
  2022-10-01  9:57               ` Lars Ingebrigtsen
@ 2022-10-01 10:01               ` Eli Zaretskii
  2022-10-01 10:12                 ` Pedro Andres Aranda Gutierrez
  2022-10-02 11:57                 ` Lars Ingebrigtsen
  1 sibling, 2 replies; 33+ messages in thread
From: Eli Zaretskii @ 2022-10-01 10:01 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 58193, paaguti

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: paaguti@gmail.com,  58193@debbugs.gnu.org
> Date: Sat, 01 Oct 2022 11:56:00 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Many Lisp programmers don't realize what the macro does, in enough
> > detail to understand that it might affect the display.
> 
> I added this macro about a month ago, and I did not have redisplay in
> mind -- redisplay is as irrelevant to this macro as it is to macros like
> `when-let'.

Fair enough, but if this macro is not intended for BODYs that include
visual appearance, the restriction should be mentioned in the doc
string, I think.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01 10:01               ` Eli Zaretskii
@ 2022-10-01 10:12                 ` Pedro Andres Aranda Gutierrez
  2022-10-02 11:57                 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-01 10:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, 58193

[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]

@ Eli, +1
@ Lars I'll test and let you know

/PA

On Sat, 1 Oct 2022 at 12:02, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Lars Ingebrigtsen <larsi@gnus.org>
> > Cc: paaguti@gmail.com,  58193@debbugs.gnu.org
> > Date: Sat, 01 Oct 2022 11:56:00 +0200
> >
> > Eli Zaretskii <eliz@gnu.org> writes:
> >
> > > Many Lisp programmers don't realize what the macro does, in enough
> > > detail to understand that it might affect the display.
> >
> > I added this macro about a month ago, and I did not have redisplay in
> > mind -- redisplay is as irrelevant to this macro as it is to macros like
> > `when-let'.
>
> Fair enough, but if this macro is not intended for BODYs that include
> visual appearance, the restriction should be mentioned in the doc
> string, I think.
>


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 1865 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01  7:33                   ` Eli Zaretskii
  2022-10-01  8:19                     ` Pedro Andres Aranda Gutierrez
@ 2022-10-01 10:46                     ` Pedro Andres Aranda Gutierrez
  2022-10-01 12:05                       ` Lars Ingebrigtsen
  1 sibling, 1 reply; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-01 10:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, 58193

[-- Attachment #1: Type: text/plain, Size: 2143 bytes --]

Thanks for the idea...I came up with a macro that mimics
with-locale-environment (because it is heavily based on it):

(defmacro with-time-locale (locale-name &rest body)
    (declare (indent 1) (debug (sexp def-body)))
    (let ((current (gensym)))
      `(let ((,current system-time-locale))
       (unwind-protect
           (progn
             (setq system-time-locale ,locale-name)
             ,@body)
         (setq system-time-locale ,current)))))

With a quick test that seems to produce what I want:

(with-time-locale "C"
  (message (format "%s -> %s" system-time-locale (format-time-string "%d %b
%Y"))))
(with-time-locale "it_IT.UTF8"
  (message (format "%s -> %s" system-time-locale (format-time-string "%d %b
%Y"))))
(message (format "%s -> %s" system-time-locale (format-time-string "%d %b
%Y")))

And no flickers...

Would that be something to contribute to Emacs ?

Best, /PA

On Sat, 1 Oct 2022 at 09:33, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> > Date: Sat, 1 Oct 2022 09:23:12 +0200
> > Cc: larsi@gnus.org, 58193@debbugs.gnu.org
> >
> >  > 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.
> >
> > So, one implication of my question is whether all operations that need a
> specific locale to be set need the
> > display redrawn...
>
> If all you want is to have time displayed per a certain locale's
> conventions, maybe it's enough to set system-time-locale?  Did you try
> that?  set-locale-environment (which is what with-locale-environment
> uses) does much more than just adjusts the locale's time format.
>


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 3342 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01 10:46                     ` Pedro Andres Aranda Gutierrez
@ 2022-10-01 12:05                       ` Lars Ingebrigtsen
  2022-10-01 13:33                         ` Pedro Andres Aranda Gutierrez
  0 siblings, 1 reply; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-01 12:05 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: Eli Zaretskii, 58193

Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> And no flickers...
>
> Would that be something to contribute to Emacs ?

There should be no flickers with with-locale-environment, either, so it
seems redundant.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01 12:05                       ` Lars Ingebrigtsen
@ 2022-10-01 13:33                         ` Pedro Andres Aranda Gutierrez
  2022-10-02 11:58                           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-01 13:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, 58193

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

And, at least in my initial test it doesn't

Thanks,
/PA

On Sat, 1 Oct 2022 at 14:05, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
>
> > And no flickers...
> >
> > Would that be something to contribute to Emacs ?
>
> There should be no flickers with with-locale-environment, either, so it
> seems redundant.
>


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 1237 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01 10:01               ` Eli Zaretskii
  2022-10-01 10:12                 ` Pedro Andres Aranda Gutierrez
@ 2022-10-02 11:57                 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-02 11:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58193, paaguti

Eli Zaretskii <eliz@gnu.org> writes:

> Fair enough, but if this macro is not intended for BODYs that include
> visual appearance, the restriction should be mentioned in the doc
> string, I think.

It's a macro that sets the locale, evaluates the body, and restores the
previous locale.  I can't for the life of me understand why somebody
would think that it has something to do with the visual appearance of
anything, one way or another.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-01 13:33                         ` Pedro Andres Aranda Gutierrez
@ 2022-10-02 11:58                           ` Lars Ingebrigtsen
  2022-10-03  5:37                             ` Pedro Andres Aranda Gutierrez
  0 siblings, 1 reply; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-02 11:58 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: Eli Zaretskii, 58193

Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> And, at least in my initial test it doesn't 

[...]

>  There should be no flickers with with-locale-environment, either, so it
>  seems redundant.

Does this mean that `with-locale-environment' doesn't flicker the screen
for you any more?  I'm not sure how to parse that response...





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-02 11:58                           ` Lars Ingebrigtsen
@ 2022-10-03  5:37                             ` Pedro Andres Aranda Gutierrez
  2022-10-03  9:03                               ` Lars Ingebrigtsen
  2022-10-03 16:38                               ` Eli Zaretskii
  0 siblings, 2 replies; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-03  5:37 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, 58193

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

Sorry for the "telegram" ;-)

I have been working all day yesterday using my functions using
'with-locale-environment' and I didn't experience any flicker.
On that side good. On the other hand, I still think that a macro only
controlling the system-locale for the time functions may be useful despite,
I admit, being somehow redundant. My feeling is that many of the settings
changed in with-locale-environment don't need to be changed for
format-time-string.

Digression: What about adding a third (optional) parameter to
format-time-string to set the locale for a specific call? This could be an
alternative which might be more-lightweight than with-locale-environment,
wouldn't it?

Best, /PA

On Sun, 2 Oct 2022 at 14:00, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
>
> > And, at least in my initial test it doesn't
>
> [...]
>
> >  There should be no flickers with with-locale-environment, either, so it
> >  seems redundant.
>
> Does this mean that `with-locale-environment' doesn't flicker the screen
> for you any more?  I'm not sure how to parse that response...
>


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 2106 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-03  5:37                             ` Pedro Andres Aranda Gutierrez
@ 2022-10-03  9:03                               ` Lars Ingebrigtsen
  2022-10-03 16:38                               ` Eli Zaretskii
  1 sibling, 0 replies; 33+ messages in thread
From: Lars Ingebrigtsen @ 2022-10-03  9:03 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: Eli Zaretskii, 58193

Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> I have been working all day yesterday using my functions using
> 'with-locale-environment' and I didn't experience any flicker. 

OK; closing this bug report.

> On that side good. On the other hand, I still think that a macro only controlling the
> system-locale for the time functions may be useful despite, I admit, being somehow
> redundant. My feeling is that many of the settings changed in
> with-locale-environment don't need to be changed for format-time-string. 

I don't think there's much need for finer granularity here.

> Digression: What about adding a third (optional) parameter to
> format-time-string to set the locale for a specific call? This could
> be an alternative which might be more-lightweight than
> with-locale-environment, wouldn't it?

It would still have to change the locale, so it wouldn't be more
lightweight.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-03  5:37                             ` Pedro Andres Aranda Gutierrez
  2022-10-03  9:03                               ` Lars Ingebrigtsen
@ 2022-10-03 16:38                               ` Eli Zaretskii
  2022-10-03 16:47                                 ` Pedro Andres Aranda Gutierrez
  1 sibling, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2022-10-03 16:38 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: larsi, 58193

> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> Date: Mon, 3 Oct 2022 07:37:56 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, 58193@debbugs.gnu.org
> 
> On that side good. On the other hand, I still think that a macro only controlling the system-locale for the time
> functions may be useful despite, I admit, being somehow redundant. My feeling is that many of the settings
> changed in with-locale-environment don't need to be changed for format-time-string. 

What's wrong with

  (let ((system-time-local SOME-LOCALE))
     DO-SOMETHING)

> Digression: What about adding a third (optional) parameter to format-time-string to set the locale for a
> specific call?

How is that different from

   (let ((system-time-local SOME-LOCALE))
     (format-time-string ....))






^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-03 16:38                               ` Eli Zaretskii
@ 2022-10-03 16:47                                 ` Pedro Andres Aranda Gutierrez
  2022-10-03 17:30                                   ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-03 16:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, 58193

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

HI Eli,

there's nothing wrong, really. The thing is that you may want to change it
just for one call of format-time-string
(or at least I wanted it) without having to change it permanently.

BTW am I missing something .. would your let just change the value of
system-time-locale in the body of the let and then restore it to its
original value?

/PA

Best, /PA

On Mon, 3 Oct 2022 at 18:38, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> > Date: Mon, 3 Oct 2022 07:37:56 +0200
> > Cc: Eli Zaretskii <eliz@gnu.org>, 58193@debbugs.gnu.org
> >
> > On that side good. On the other hand, I still think that a macro only
> controlling the system-locale for the time
> > functions may be useful despite, I admit, being somehow redundant. My
> feeling is that many of the settings
> > changed in with-locale-environment don't need to be changed for
> format-time-string.
>
> What's wrong with
>
>   (let ((system-time-local SOME-LOCALE))
>      DO-SOMETHING)
>
> > Digression: What about adding a third (optional) parameter to
> format-time-string to set the locale for a
> > specific call?
>
> How is that different from
>
>    (let ((system-time-local SOME-LOCALE))
>      (format-time-string ....))
>
>

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 2375 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-03 16:47                                 ` Pedro Andres Aranda Gutierrez
@ 2022-10-03 17:30                                   ` Eli Zaretskii
  2022-10-04  6:10                                     ` Pedro Andres Aranda Gutierrez
  0 siblings, 1 reply; 33+ messages in thread
From: Eli Zaretskii @ 2022-10-03 17:30 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: larsi, 58193

> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> Date: Mon, 3 Oct 2022 18:47:45 +0200
> Cc: larsi@gnus.org, 58193@debbugs.gnu.org
> 
> BTW am I missing something .. would your let just change the value of system-time-locale in the body of the
> let and then restore it to its original value?

Yes, that's the general feature of let-binding.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* bug#58193: 29.0.50; Screen flickers on with-locale-environment
  2022-10-03 17:30                                   ` Eli Zaretskii
@ 2022-10-04  6:10                                     ` Pedro Andres Aranda Gutierrez
  0 siblings, 0 replies; 33+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2022-10-04  6:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, 58193

[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]

Hmmm.... that is not what I understand from 3.6 in the Introduction to
Emacs Lisp Programming.
If you read the section, it talks about 'local variables'.
Depending on you programming background, local may be different from
local...
I have always understood local as variable that has a meaning within a
context and if I happen to use the name of a global variable that is used
in the system, then bad luck. It would be nice to say that when you put a
variable like system-time-locale in a let, the global variable's value is
'pushed' and will be recovered once you leave the let-binding. Just to make
sure there is no misunderstanding.

I'll try to see how to tackle this in the elisp Introduction and will
propose a patch.

Anyhow, better late than never :-) that's what I like, always learning
something new.

Best, /PA

On Mon, 3 Oct 2022 at 19:31, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> > Date: Mon, 3 Oct 2022 18:47:45 +0200
> > Cc: larsi@gnus.org, 58193@debbugs.gnu.org
> >
> > BTW am I missing something .. would your let just change the value of
> system-time-locale in the body of the
> > let and then restore it to its original value?
>
> Yes, that's the general feature of let-binding.
>


-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 2356 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2022-10-04  6:10 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 13:05 bug#58193: 29.0.50; Screen flickers on with-locale-environment Pedro Andres Aranda Gutierrez
2022-09-30 13:50 ` Eli Zaretskii
2022-09-30 14:14 ` Lars Ingebrigtsen
2022-09-30 15:43   ` Pedro Andres Aranda Gutierrez
2022-09-30 16:31     ` Lars Ingebrigtsen
2022-10-01  7:26       ` Pedro Andres Aranda Gutierrez
2022-10-01  9:57         ` Lars Ingebrigtsen
2022-09-30 17:31   ` Eli Zaretskii
2022-09-30 17:34     ` Lars Ingebrigtsen
2022-09-30 17:40       ` Eli Zaretskii
2022-09-30 17:43         ` Lars Ingebrigtsen
2022-09-30 18:34           ` Eli Zaretskii
2022-10-01  6:14             ` Pedro Andres Aranda Gutierrez
2022-10-01  7:10               ` Eli Zaretskii
2022-10-01  7:23                 ` Pedro Andres Aranda Gutierrez
2022-10-01  7:33                   ` Eli Zaretskii
2022-10-01  8:19                     ` Pedro Andres Aranda Gutierrez
2022-10-01  9:10                       ` Eli Zaretskii
2022-10-01 10:46                     ` Pedro Andres Aranda Gutierrez
2022-10-01 12:05                       ` Lars Ingebrigtsen
2022-10-01 13:33                         ` Pedro Andres Aranda Gutierrez
2022-10-02 11:58                           ` Lars Ingebrigtsen
2022-10-03  5:37                             ` Pedro Andres Aranda Gutierrez
2022-10-03  9:03                               ` Lars Ingebrigtsen
2022-10-03 16:38                               ` Eli Zaretskii
2022-10-03 16:47                                 ` Pedro Andres Aranda Gutierrez
2022-10-03 17:30                                   ` Eli Zaretskii
2022-10-04  6:10                                     ` Pedro Andres Aranda Gutierrez
2022-10-01  9:56             ` Lars Ingebrigtsen
2022-10-01  9:57               ` Lars Ingebrigtsen
2022-10-01 10:01               ` Eli Zaretskii
2022-10-01 10:12                 ` Pedro Andres Aranda Gutierrez
2022-10-02 11:57                 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).