help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Char code to Emacs string.


From: Thierry Volpiatto
Subject: Re: Char code to Emacs string.
Date: Wed, 01 Jun 2011 10:30:24 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.3.50 (gnu/linux)

Oleksandr Gavenko <address@hidden> writes:

> This code not work because 'make-char' do not understand 'unicode' arg
> (which intended to print chars with it unicode code):
>
> (let (i (start ?\x1B6) (end ?\x1B7C))
>   (setq i start)
>   (while (<= i end)
>     (message "%s - %x" (make-char 'unicode i) i)
>     (setq i (+ 1 i))
>     ) )
>
> How I can get list of possible CHARSET for 'make-char'
> and how this code must be fixed to work properly?
You can use `string' instead of `make-char'


#+BEGIN_SRC emacs-lisp
(let ((start ?\x1B6)
      (end   ?\x1B7C))
  (while (<= start end)
    (message "%s - %x" (string start) start)
    (sit-for 0.2)
    (setq start (+ 1 start))))

#+END_SRC

To store in a list:(maybe more useful)

#+BEGIN_SRC emacs-lisp
(let ((start ?\x1B6)
      (end   ?\x1B7C)
      result)
  (while (<= start end)
    (push (cons (string start) start) result)
    (setq start (+ 1 start)))
  (nreverse result))
;; => (("ƶ" . 438) ("Ʒ" . 439) ("Ƹ" . 440) ("ƹ" . 441)...)
#+END_SRC

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

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