Don't refresh the frame in with-locale-environment

* lisp/international/mule-cmds.el (with-locale-environment):
Inhibit refresh so that there's no flickering (bug#58193).
(set-locale-environment): Allow inhibiting the refresh.
* lisp/international/mule.el (set-terminal-coding-system): Ditto.
This commit is contained in:
Lars Ingebrigtsen 2022-09-30 16:14:20 +02:00
parent a80cfb7473
commit b858acde25
2 changed files with 16 additions and 8 deletions

View file

@ -2666,11 +2666,11 @@ For example, translate \"swedish\" into \"sv_SE.ISO8859-1\"."
`(let ((,current current-locale-environment))
(unwind-protect
(progn
(set-locale-environment ,locale-name)
(set-locale-environment ,locale-name nil t)
,@body)
(set-locale-environment ,current)))))
(set-locale-environment ,current nil t)))))
(defun set-locale-environment (&optional locale-name frame)
(defun set-locale-environment (&optional locale-name frame inhibit-refresh)
"Set up multilingual environment for using LOCALE-NAME.
This sets the language environment, the coding system priority,
the default input method and sometimes other things.
@ -2699,6 +2699,9 @@ This function sets the `current-locale-environment' variable. To
change the locale temporarily, `with-locale-environment' can be
used.
By default, this function will redraw the current frame. If
INHIBIT-REFRESH is non-nil, this isn't done.
See also `locale-charset-language-names', `locale-language-names',
`locale-preferred-coding-systems' and `locale-coding-system'."
(interactive (list (completing-read "Set environment for locale: "
@ -2865,7 +2868,7 @@ See also `locale-charset-language-names', `locale-language-names',
(or output-coding (setq output-coding code-page-coding))
(unless frame (setq locale-coding-system locale-coding))
(set-keyboard-coding-system code-page-coding frame)
(set-terminal-coding-system output-coding frame)
(set-terminal-coding-system output-coding frame inhibit-refresh)
(setq default-file-name-coding-system ansi-code-page-coding))))
(when (eq system-type 'darwin)
@ -2876,7 +2879,7 @@ See also `locale-charset-language-names', `locale-language-names',
;; the locale.
(when (and (null window-system)
(equal (getenv "TERM_PROGRAM" frame) "Apple_Terminal"))
(set-terminal-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8 nil inhibit-refresh)
(set-keyboard-coding-system 'utf-8)))
;; Default to A4 paper if we're not in a C, POSIX or US locale.

View file

@ -1362,7 +1362,8 @@ to CODING-SYSTEM."
This is normally set according to the selected language environment.
See also the command `set-terminal-coding-system'.")
(defun set-terminal-coding-system (coding-system &optional terminal)
(defun set-terminal-coding-system (coding-system &optional terminal
inhibit-refresh)
"Set coding system of terminal output to CODING-SYSTEM.
All text output to TERMINAL will be encoded
with the specified coding system.
@ -1373,7 +1374,10 @@ or by the previous use of this command.
TERMINAL may be a terminal object, a frame, or nil for the
selected frame's terminal. The setting has no effect on
graphical terminals."
graphical terminals.
By default, this function will redraw the current frame. If
INHIBIT-REFRESH is non-nil, this isn't done."
(interactive
(list (let ((default (if (and (not (terminal-coding-system))
default-terminal-coding-system)
@ -1387,7 +1391,8 @@ graphical terminals."
(if coding-system
(setq default-terminal-coding-system coding-system))
(set-terminal-coding-system-internal coding-system terminal)
(redraw-frame))
(unless inhibit-refresh
(redraw-frame)))
(defvar default-keyboard-coding-system nil
"Default value of the keyboard coding system.