all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, 58193@debbugs.gnu.org
Subject: bug#58193: 29.0.50; Screen flickers on with-locale-environment
Date: Sat, 1 Oct 2022 12:46:56 +0200	[thread overview]
Message-ID: <CAO48Bk_oHi1GT6mfgms0JvhrEe6W5AF4UxWRq4=b-sVmnLZPnw@mail.gmail.com> (raw)
In-Reply-To: <83wn9katho.fsf@gnu.org>

[-- 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 --]

  parent reply	other threads:[~2022-10-01 10:46 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAO48Bk_oHi1GT6mfgms0JvhrEe6W5AF4UxWRq4=b-sVmnLZPnw@mail.gmail.com' \
    --to=paaguti@gmail.com \
    --cc=58193@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.