bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Pedro Andres Aranda Gutierrez
Subject: bug#58193: 29.0.50; Screen flickers on with-locale-environment
Date: Sat, 1 Oct 2022 12:46:56 +0200

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]