diff options
| author | Paul Eggert | 2016-04-25 10:41:29 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-04-25 10:42:48 -0700 |
| commit | 86d083438dba60dc00e9e96414bf7e832720c05a (patch) | |
| tree | 9ca5fac163acf4b1a3bca0e1e8b5c87af26e5a89 /doc | |
| parent | f069d854508946bcc03e4c77ceb430748e3ab6d7 (diff) | |
| download | emacs-86d083438dba60dc00e9e96414bf7e832720c05a.tar.gz emacs-86d083438dba60dc00e9e96414bf7e832720c05a.zip | |
New function ‘char-from-name’
This also fixes the mishandling of "\N{CJK COMPATIBILITY
IDEOGRAPH-F900}", "\N{VARIATION SELECTOR-1}", etc.
Problem reported by Eli Zaretskii in:
http://lists.gnu.org/archive/html/emacs-devel/2016-04/msg00614.html
* doc/lispref/nonascii.texi (Character Codes), etc/NEWS: Document this.
* lisp/international/mule-cmds.el (char-from-name): New function.
(read-char-by-name): Use it. Document that "BED" is treated as
a name, not as a hexadecimal number. Reject out-of-range integers,
floating-point numbers, and strings with trailing junk.
* src/lread.c (character_name_to_code): Call char-from-name
instead of inspecting ucs-names directly, so that we handle
computed names like "VARIATION SELECTOR-1". Do not use an auto
string, since char-from-name might GC.
* test/src/lread-tests.el: Add tests for new behavior, and
fix some old tests that were wrong.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/nonascii.texi | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index 0e4aa86e48b..fd2ce3248fd 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi | |||
| @@ -420,6 +420,18 @@ codepoint can have. | |||
| 420 | @end example | 420 | @end example |
| 421 | @end defun | 421 | @end defun |
| 422 | 422 | ||
| 423 | @defun char-from-name string &optional ignore-case | ||
| 424 | This function returns the character whose Unicode name is @var{string}. | ||
| 425 | If @var{ignore-case} is non-@code{nil}, case is ignored in @var{string}. | ||
| 426 | This function returns @code{nil} if @var{string} does not name a character. | ||
| 427 | |||
| 428 | @example | ||
| 429 | ;; U+03A3 | ||
| 430 | (= (char-from-name "GREEK CAPITAL LETTER SIGMA") #x03A3) | ||
| 431 | @result{} t | ||
| 432 | @end example | ||
| 433 | @end defun | ||
| 434 | |||
| 423 | @defun get-byte &optional pos string | 435 | @defun get-byte &optional pos string |
| 424 | This function returns the byte at character position @var{pos} in the | 436 | This function returns the byte at character position @var{pos} in the |
| 425 | current buffer. If the current buffer is unibyte, this is literally | 437 | current buffer. If the current buffer is unibyte, this is literally |