[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48375: coding-system-for-read in net-utils-run-simple is not properl
From: |
Eli Zaretskii |
Subject: |
bug#48375: coding-system-for-read in net-utils-run-simple is not properly set |
Date: |
Sat, 15 May 2021 11:26:32 +0300 |
> From: iquiw <iku.iwasa@gmail.com>
> Date: Wed, 12 May 2021 18:39:25 +0900
>
> In the following code, `let' binding of `coding-system-for-read'
> covers only `erase-buffer' call.
>
> https://emba.gnu.org/emacs/emacs/-/blob/47070ed39eda524d334e5f82dc7f4a50b8d3252c/lisp/net/net-utils.el#L366-375
>
> So it does not affect to executed process and output characters are garbled.
> e.g. "M-x ifconfig" on Windows.
Thanks. Does the patch below fix the problem?
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 24f2aba..90cca7d 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -363,24 +363,24 @@ net-utils-run-simple
(when proc
(set-process-filter proc nil)
(delete-process proc)))
- (let ((inhibit-read-only t)
- (coding-system-for-read
- ;; MS-Windows versions of network utilities output text
- ;; encoded in the console (a.k.a. "OEM") codepage, which is
- ;; different from the default system (a.k.a. "ANSI")
- ;; codepage.
- (if (eq system-type 'windows-nt)
- (intern (format "cp%d" (w32-get-console-output-codepage)))
- coding-system-for-read)))
+ (let ((inhibit-read-only t))
(erase-buffer))
(net-utils-mode)
(setq-local net-utils--revert-cmd
`(net-utils-run-simple ,(current-buffer)
,program-name ,args nodisplay))
- (set-process-filter
- (apply #'start-process program-name
- (current-buffer) program-name args)
- #'net-utils-remove-ctrl-m-filter)
+ (let ((coding-system-for-read
+ ;; MS-Windows versions of network utilities output text
+ ;; encoded in the console (a.k.a. "OEM") codepage, which is
+ ;; different from the default system (a.k.a. "ANSI")
+ ;; codepage.
+ (if (eq system-type 'windows-nt)
+ (intern (format "cp%d" (w32-get-console-output-codepage)))
+ coding-system-for-read)))
+ (set-process-filter
+ (apply #'start-process program-name
+ (current-buffer) program-name args)
+ #'net-utils-remove-ctrl-m-filter))
(unless nodisplay (display-buffer (current-buffer)))))
(defun net-utils--revert-function (&optional _ignore-auto _noconfirm)