summaryrefslogtreecommitdiff
path: root/devdocs/elisp/nonprinting-characters.html
blob: 9a296a68a48f938c5afbb5a45be0105e9c447f45 (plain)
1
2
3
4
5
6
 <h4 class="subsubsection">Nonprinting Characters in Strings</h4> <p>You can use the same backslash escape-sequences in a string constant as in character literals (but do not use the question mark that begins a character constant). For example, you can write a string containing the nonprinting characters tab and <kbd>C-a</kbd>, with commas and spaces between them, like this: <code>"\t, \C-a"</code>. See <a href="character-type">Character Type</a>, for a description of the read syntax for characters. </p> <p>However, not all of the characters you can write with backslash escape-sequences are valid in strings. The only control characters that a string can hold are the <acronym>ASCII</acronym> control characters. Strings do not distinguish case in <acronym>ASCII</acronym> control characters. </p> <p>Properly speaking, strings cannot hold meta characters; but when a string is to be used as a key sequence, there is a special convention that provides a way to represent meta versions of <acronym>ASCII</acronym> characters in a string. If you use the ‘<samp>\M-</samp>’ syntax to indicate a meta character in a string constant, this sets the 2**7 bit of the character in the string. If the string is used in <code>define-key</code> or <code>lookup-key</code>, this numeric code is translated into the equivalent meta character. See <a href="character-type">Character Type</a>. </p> <p>Strings cannot hold characters that have the hyper, super, or alt modifiers. </p><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Nonprinting-Characters.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Nonprinting-Characters.html</a>
  </p>
</div>