emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving kbd to subr.el


From: Lars Ingebrigtsen
Subject: Re: Moving kbd to subr.el
Date: Fri, 15 Oct 2021 14:39:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> But I think we should just replace it with the <= 127 test and not
> change the behaviour any more at this point.  We could change it back to
> the behaviour it probably used to have; i.e., (kbd "M-s") => "\M-s",
> though.

Which would be something like the following.  Not that I think we should.

diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index a4eb574a4c..029393d86e 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -728,12 +728,16 @@ edmacro-parse-keys
       (setq res (cl-subseq res 2 -2)))
     (if (and (not need-vector)
             (cl-loop for ch across res
-                      always (and (characterp ch)
-                                  (let ((ch2 (logand ch (lognot ?\M-\^@))))
-                                    (and (>= ch2 0) (<= ch2 127))))))
-       (concat (cl-loop for ch across res
-                         collect (if (= (logand ch ?\M-\^@) 0)
-                                     ch (+ ch 128))))
+                      always (let ((ch2 (logand ch (lognot ?\M-\^@))))
+                               (and (>= ch2 0) (<= ch2 127)))))
+       (mapconcat (lambda (ch)
+                     (if (= (logand ch ?\M-\^@) 0)
+                         (string ch)
+                       (string-make-unibyte
+                        (string
+                         (+ (logand ch (lognot ?\M-\^@)) 128)))))
+                   res
+                   "")
       res)))
 
 (provide 'edmacro)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

[Prev in Thread] Current Thread [Next in Thread]