[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ELISP] How do you turn an array of chars into a string?
From: |
Stefan Monnier |
Subject: |
Re: [ELISP] How do you turn an array of chars into a string? |
Date: |
Wed, 08 Dec 2010 15:22:20 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> The elisp manual has this example, using "kbd" to convert a (relatively)
> readable string into the "internal Emacs key representation":
> (global-set-key (kbd "C-x C-\\") 'next-line)
> (global-set-key [?\C-x ?\C-\\] 'next-line)
> What's the inverse of kbd?
key-description
> What if you want to convert an array-of-chars into a string?
A string *is* an array of chars. If you want to convert a vector
(i.e. one of those arrays that contains arbitrary Lisp values) to
a string, you can use `concat': (concat (vector ?a ?b ?c)) => "abc".
Stefan