]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't mutate string literal
authorMattias Engdegård <mattiase@acm.org>
Thu, 19 Aug 2021 09:35:41 +0000 (11:35 +0200)
committerMattias Engdegård <mattiase@acm.org>
Fri, 20 Aug 2021 10:34:34 +0000 (12:34 +0200)
* lisp/obsolete/terminal.el (terminal-escape-map): Rewrite loop in a
simpler and more robust way.

lisp/obsolete/terminal.el

index 0167a00066b5abeab1a4a999127e54582f29b8cb..fa89b586a0a0b74b6ce7725634e081308fcc6140 100644 (file)
@@ -112,10 +112,9 @@ performance."
     nil
   (let ((map (make-sparse-keymap)))
     (define-key map [t] #'undefined)
-    (let ((s "0"))
-      (while (<= (aref s 0) ?9)
-       (define-key map s #'digit-argument)
-       (aset s 0 (1+ (aref s 0)))))
+    (dotimes (i 10)
+      (let ((s (make-string 1 (+ ?0 i))))
+       (define-key map s #'digit-argument)))
     (define-key map "b" #'switch-to-buffer)
     (define-key map "o" #'other-window)
     (define-key map "e" #'te-set-escape-char)