[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: |
Pascal J. Bourguignon |
Subject: |
Re: [ELISP] How do you turn an array of chars into a string? |
Date: |
Wed, 08 Dec 2010 15:22:21 -0000 |
User-agent: |
Gnus/5.101 (Gnus v5.10.10) Emacs/23.2 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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.
Not in scheme or emacs lisp. (vectorp "abc") --> nil
> 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
--
__Pascal Bourguignon__ http://www.informatimago.com/