]> git.eshelyaron.com Git - emacs.git/commitdiff
Have native compiler always preserve multibyte strings (bug#45342)
authorAndrea Corallo <akrl@sdf.org>
Sun, 20 Dec 2020 19:53:22 +0000 (20:53 +0100)
committerAndrea Corallo <akrl@sdf.org>
Sun, 20 Dec 2020 20:21:39 +0000 (21:21 +0100)
* 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
test/src/comp-test-funcs.el
test/src/comp-tests.el

index 2cff362cb9e91b51a4f8616084a58b863b356568..c6f192d1e83e4845114a50a7039996851bd1c63f 100644 (file)
@@ -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
index 5fa427be190273cf8e9e839315ac400a45afda80..5fc032b127d6d09b302ad90c28a9916f971dc0ca 100644 (file)
       (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 " ➓") (_ "")))
+
 \f
 ;;;;;;;;;;;;;;;;;;;;
 ;; Tromey's tests ;;
index e73fc652d62b0f2965d591c7e97a8e77e847b979..68201deffe943034614655e1573f2a2627542786 100644 (file)
@@ -396,6 +396,11 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
   "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-11/msg02357.html>"
   (comp-test-44968-f "/tmp/test/foo" "/tmp"))
 
+(comp-deftest bug-45342 ()
+  "Preserve multibyte immediate strings.
+<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01771.html>"
+  (should (string= " ➊" (comp-test-45342-f 1))))
+
 (defvar comp-test-primitive-advice)
 (comp-deftest primitive-advice ()
   "Test effectiveness of primitive advicing."