From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pedro Andres Aranda Gutierrez Newsgroups: gmane.emacs.bugs Subject: bug#58193: 29.0.50; Screen flickers on with-locale-environment Date: Sat, 1 Oct 2022 12:46:56 +0200 Message-ID: References: <87wn9l3q5i.fsf@gnus.org> <83sfk8db0m.fsf@gnu.org> <87mtag4vhi.fsf@gnus.org> <83mtagdall.fsf@gnu.org> <87ill44v2o.fsf@gnus.org> <83leq0d83g.fsf@gnu.org> <83y1u0auk4.fsf@gnu.org> <83wn9katho.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d4d2e905e9f6d546" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6653"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 58193@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 01 12:48:15 2022 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 1oea2X-0001Ri-Qh for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Oct 2022 12:48:13 +0200 Original-Received: from localhost ([::1]:59674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oea2W-0007cQ-4d for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Oct 2022 06:48:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oea2M-0007c2-PP for bug-gnu-emacs@gnu.org; Sat, 01 Oct 2022 06:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oea2M-00068E-EF for bug-gnu-emacs@gnu.org; Sat, 01 Oct 2022 06:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oea2M-0004pC-2G for bug-gnu-emacs@gnu.org; Sat, 01 Oct 2022 06:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pedro Andres Aranda Gutierrez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Oct 2022 10:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58193 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 58193-submit@debbugs.gnu.org id=B58193.166462125018406 (code B ref 58193); Sat, 01 Oct 2022 10:48:02 +0000 Original-Received: (at 58193) by debbugs.gnu.org; 1 Oct 2022 10:47:30 +0000 Original-Received: from localhost ([127.0.0.1]:43755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oea1q-0004mo-Al for submit@debbugs.gnu.org; Sat, 01 Oct 2022 06:47:30 -0400 Original-Received: from mail-ej1-f48.google.com ([209.85.218.48]:39496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oea1o-0004mb-7l for 58193@debbugs.gnu.org; Sat, 01 Oct 2022 06:47:29 -0400 Original-Received: by mail-ej1-f48.google.com with SMTP id b2so13699697eja.6 for <58193@debbugs.gnu.org>; Sat, 01 Oct 2022 03:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=LnThCo4gVxUq7upb5h7HqKMXNnxFg0IkL//QA/I1HkM=; b=YMaFa3Ltziwk3RemR47A8ANpFxW2ZJLKfZdPfRCrY2IKmXzKJ3DuPTtb0mMBi2dGnc SpzXFxn4SUPSW2DOG3X//KIOl1TmkMuBY2JuMhA2GZeCv+tW9aEB3YeNJ5ClJNeeu7ff qFjDyLUSbWf9KK0+C0w74S0iNuXTh5d57/vqMVpE57so9kaIB8H2thzDMzcLPJXVK+08 oa5jBqmfDUdPuYbg81AYxkGCAszaNaY/78oiZAgMHnTAOViz6FEWg/AEh6CAfRz8uFED C6W9K/VM2yoKVcI24Cu1ArJTjA+V4UeWQsfjUsUg4fSWEpYBI2cJsvyVAapCgcQ1rgSY OXPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=LnThCo4gVxUq7upb5h7HqKMXNnxFg0IkL//QA/I1HkM=; b=IzZuLwgQ1Yb6/KbkVIX8Um0cZrtU1DU92GruJA/2JuKe7RsQQWwYUE/v4E1GyMnoaS hTHBHzWCn+xFCEiGSksVXNsBbOhPXFXkY11Ljt+GL9lI8MzjHbzwvYMVlSqrpqt8YaWE NDoEv2UFpKXmyKG8eVNckl8VUtB6zj3z+Vf96sdc/45f69yyiii3R0Yrkdr5NqZkUnFl EagMS28sIoXd141TF6/UTE5u8dGPfZrGulK/jZ6yN6YVECHdHixORAfT+D24QsEK5cx3 GHEYIXI3FcjykoU1MaOzBfvkd81vFgez4J1+BPsmhHkHxGvRT6yL676EwxewBY/mlKlF s9Rw== X-Gm-Message-State: ACrzQf0clkpivv7KY9x+Gdiw753H1wsn1IbYZjPv6imEe6wo3is6xp6T 3O5Iu4xB7F92pEJC5QZw4MntXyETCqLL2ReAw+k= X-Google-Smtp-Source: AMsMyM7JbVVrdT+QSGEIBiY/8qLT45uqRyWR7IRPRRfEqqvpcUHs29WlyX4sNljTxJyTh/XCU1cVimg2QuuexHDa3Jo= X-Received: by 2002:a17:907:94d2:b0:783:e5dd:9c79 with SMTP id dn18-20020a17090794d200b00783e5dd9c79mr9633389ejc.18.1664621242272; Sat, 01 Oct 2022 03:47:22 -0700 (PDT) In-Reply-To: <83wn9katho.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:244102 Archived-At: --000000000000d4d2e905e9f6d546 Content-Type: text/plain; charset="UTF-8" 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 wrote: > > From: Pedro Andres Aranda Gutierrez > > 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 --000000000000d4d2e905e9f6d546 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for the idea...I came up with a ma= cro that mimics with-locale-environment (because it is heavily based on it)= :

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

With a quick test tha= t seems to produce what I want:

(with-time-locale = "C"
=C2=A0 (message (format "%s -> %s" sys= tem-time-locale (format-time-string "%d %b %Y"))))
(wit= h-time-locale "it_IT.UTF8"
=C2=A0 (message (format &quo= t;%s -> %s" system-time-locale (format-time-string "%d %b %Y&q= uot;))))
(message (format "%s -> %s" system-time-loc= ale (format-time-string "%d %b %Y")))

<= div>And no flickers...

Would that be something to = contribute to Emacs ?

Best, /PA
<= br>
On Sat,= 1 Oct 2022 at 09:33, Eli Zaretskii <eli= z@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@debb= ugs.gnu.org
>
>=C2=A0 > Maybe we should leave this macro as-is because of the legac= y and work towards something in the
>=C2=A0 line of the
>=C2=A0 > cl-setlocale function in Common LISP.
>
>=C2=A0 Common Lisp is just a programming language, it is not a display<= br> >=C2=A0 editor.=C2=A0 In Emacs, certain operations that affect the displ= ay should
>=C2=A0 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?=C2=A0 Did you= try
that?=C2=A0 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

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

--000000000000d4d2e905e9f6d546--