]> git.eshelyaron.com Git - emacs.git/commitdiff
Read characters from functions as multibyte
authorMattias Engdegård <mattiase@acm.org>
Sat, 5 Jul 2025 11:09:43 +0000 (13:09 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 07:48:25 +0000 (09:48 +0200)
Previously, latin-1 was incorrectly assumed (bug#70988).

* src/lread.c (readchar): Set multibyte flag.
* test/src/lread-tests.el (lread-function-source): New test.

(cherry picked from commit 553a6c407f28c4faa832c8cda462267ef75bff38)

src/lread.c
test/src/lread-tests.el

index 40eb6ad7875d7b08ee02e0f4296e079a44429ce6..6cd6735a215574322d06de910195308d14db7129 100644 (file)
@@ -396,6 +396,9 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
       goto read_multibyte;
     }
 
+  if (multibyte)
+    *multibyte = 1;
+
   tem = call0 (readcharfun);
 
   if (!FIXNUMP (tem))
index 40640e79eed6b0a29595e6f8176771ce800e8890..d832cc9aa4ebcd6d2149f884b0fe65e305bb44c2 100644 (file)
@@ -387,4 +387,9 @@ literals (Bug#20852)."
     (goto-char (point-min))
     (should-error (read (current-buffer)) :type 'end-of-file)))
 
+(ert-deftest lread-function-source ()
+  (let* ((s '(#x41 #x222a #xff -1))
+         (val (read (lambda () (pop s)))))
+    (should (equal (symbol-name val) "A∪ÿ"))))
+
 ;;; lread-tests.el ends here