aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2018-09-20 09:41:55 +0300
committerEli Zaretskii2018-09-20 09:41:55 +0300
commitd28d54c76754759e5f0fc8254541fbb4ef6a21d8 (patch)
tree82b1085d14e622b02456145fe0a2230eb9f0ac05
parentb3baf997c8e9bbff351e0bf24b8fdae8831ec1df (diff)
downloademacs-d28d54c76754759e5f0fc8254541fbb4ef6a21d8.tar.gz
emacs-d28d54c76754759e5f0fc8254541fbb4ef6a21d8.zip
More accurate docs for 'text-char-description'
* src/keymap.c (Ftext_char_description): * doc/lispref/help.texi (Describing Characters): More accurate description of 'text-char-description'. Remove incorrect examples from the ELisp manual. (Bug#32743)
-rw-r--r--doc/lispref/help.texi30
-rw-r--r--src/keymap.c3
2 files changed, 12 insertions, 21 deletions
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index a23bc413d25..2688a2bff6e 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -556,13 +556,15 @@ brackets.
556 556
557@defun text-char-description character 557@defun text-char-description character
558This function returns a string describing @var{character} in the 558This function returns a string describing @var{character} in the
559standard Emacs notation for characters that can appear in text---like 559standard Emacs notation for characters that can appear in
560@code{single-key-description}, except that the argument must be a 560text---similar to @code{single-key-description}, except that the
561valid character code that passes a @code{characterp} test 561argument must be a valid character code that passes a
562(@pxref{Character Codes}), control characters are represented with a 562@code{characterp} test (@pxref{Character Codes}). The function
563leading caret (which is how control characters in Emacs buffers are 563produces descriptions of control characters with a leading caret
564usually displayed), and the 2**7 bit is treated as the Meta bit, 564(which is how Emacs usually displays control characters in buffers).
565whereas @code{single-key-description} uses the 2**27 bit for Meta. 565Characters with modifier bits will cause this function to signal an
566error (@acronym{ASCII} characters with the Control modifier are an
567exception, they are represented as control characters).
566 568
567@smallexample 569@smallexample
568@group 570@group
@@ -571,19 +573,7 @@ whereas @code{single-key-description} uses the 2**27 bit for Meta.
571@end group 573@end group
572@group 574@group
573(text-char-description ?\M-m) 575(text-char-description ?\M-m)
574 @result{} "\xed" 576 @error{} Wrong type argument: characterp, 134217837
575@end group
576@group
577(text-char-description ?\C-\M-m)
578 @result{} "\x8d"
579@end group
580@group
581(text-char-description (+ 128 ?m))
582 @result{} "M-m"
583@end group
584@group
585(text-char-description (+ 128 ?\C-m))
586 @result{} "M-^M"
587@end group 577@end group
588@end smallexample 578@end smallexample
589@end defun 579@end defun
diff --git a/src/keymap.c b/src/keymap.c
index ec483c7a632..fe0781a7f2a 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2286,7 +2286,8 @@ push_text_char_description (register unsigned int c, register char *p)
2286DEFUN ("text-char-description", Ftext_char_description, Stext_char_description, 1, 1, 0, 2286DEFUN ("text-char-description", Ftext_char_description, Stext_char_description, 1, 1, 0,
2287 doc: /* Return the description of CHARACTER in standard Emacs notation. 2287 doc: /* Return the description of CHARACTER in standard Emacs notation.
2288CHARACTER must be a valid character code that passes the `characterp' test. 2288CHARACTER must be a valid character code that passes the `characterp' test.
2289Control characters turn into "^char", the 2**7 bit is treated as Meta, etc. 2289Control characters turn into "^char", and characters with Meta and other
2290modifiers signal an error, as they are not valid characterr codes.
2290This differs from `single-key-description' which accepts character events, 2291This differs from `single-key-description' which accepts character events,
2291and thus doesn't enforce the `characterp' condition, turns control 2292and thus doesn't enforce the `characterp' condition, turns control
2292characters into "C-char", and uses the 2**27 bit for Meta. 2293characters into "C-char", and uses the 2**27 bit for Meta.