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

Re: emacs24 и UTF-8



On 2013-12-07, Artem Chuprina wrote:

> Хмутро.
>
> Этот тут мне кто-то рассказывал, что emacs24 весь из себя UTF-8 внутри?
> Авотфих.  Попытался я тут творчески развить just-one-space, и...
>
> (skip-chars-backward " \t -—–")
>
> (пробел, табуляция, неразрывный пробел (160), минус, em-dash (8212),
> en-dash (8211))
>
> не проходит назад через минус (в смысле, если курсор сразу за минусом,
> он не сдвигается).  Если убрать из строки, к примеру, неразрывный
> пробел, то перескакивает в начало буфера.
>
Читаем доку:

  skip-chars-forward is a built-in function in `C source code'.

  (skip-chars-forward STRING &optional LIM)

  Move point forward, stopping before a char not in STRING, or at pos LIM.
  STRING is like the inside of a `[...]' in a regular expression
  except that `]' is never special and `\' quotes `^', `-' or `\'
   (but not at the end of a range; quoting is never needed there).
  With arg "^a-zA-Z", skips nonletters stopping before first letter.

Я поставил минус в конце строки - заработало ))

> Обходится, понятно, тривиально, особенно если заменить строку на список
> символов.  Но, в общем, слухи про "весь внутри UTF-8" сильно
> преувеличены...

Та все ОК. Внутреннее представление символов с строке - чистый Unicode:

  2.3.3 Character Type
  --------------------

  A "character" in Emacs Lisp is nothing more than an integer.  In other
  words, characters are represented by their character codes.

     Characters in strings and buffers are currently limited to the range
  of 0 to 4194303--twenty two bits

  33.1 Text Representations
  =========================

     To support this multitude of characters and scripts, Emacs closely
  follows the "Unicode Standard".  The Unicode Standard assigns a unique
  number, called a "codepoint", to each and every character.  The range
  of codepoints defined by Unicode, or the Unicode "codespace", is
  `0..#x10FFFF' (in hexadecimal notation), inclusive.

Ну там в действительности 2 формы представления строк - фиксированой байтовой
длины и плавающей (для компактного представления). Я не рыскам по (info
"(elisp)").

-- 
Best regards!


Reply to: