From 72c1a41573a96a39482a001bfeb3230c471a5681 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sun, 20 Dec 2020 20:53:22 +0100 Subject: [PATCH] Have native compiler always preserve multibyte strings (bug#45342) * lisp/emacs-lisp/comp.el (comp-final): Escape multibyte string when offloading compilation to child process. * test/src/comp-test-funcs.el (comp-test-45342-f): New function * test/src/comp-tests.el (bug-45342): New test --- lisp/emacs-lisp/comp.el | 1 + test/src/comp-test-funcs.el | 5 +++++ test/src/comp-tests.el | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 2cff362cb9e..c6f192d1e83 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2863,6 +2863,7 @@ Prepare every function for final compilation and drive the C back-end." (print-quoted t) (print-gensym t) (print-circle t) + (print-escape-multibyte t) (expr `(progn (require 'comp) (setf comp-verbose ,comp-verbose diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el index 5fa427be190..5fc032b127d 100644 --- a/test/src/comp-test-funcs.el +++ b/test/src/comp-test-funcs.el @@ -390,6 +390,11 @@ (setq dir (directory-file-name (file-name-directory dir)))) (nreverse dirlist))) +(defun comp-test-45342-f (n) + (pcase n + (1 " ➊") (2 " ➋") (3 " ➌") (4 " ➍") (5 " ➎") (6 " ➏") + (7 " ➐") (8 " ➑") (9 " ➒") (10 " ➓") (_ ""))) + ;;;;;;;;;;;;;;;;;;;; ;; Tromey's tests ;; diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index e73fc652d62..68201deffe9 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -396,6 +396,11 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html." "" (comp-test-44968-f "/tmp/test/foo" "/tmp")) +(comp-deftest bug-45342 () + "Preserve multibyte immediate strings. +" + (should (string= " ➊" (comp-test-45342-f 1)))) + (defvar comp-test-primitive-advice) (comp-deftest primitive-advice () "Test effectiveness of primitive advicing." -- 2.39.5