340 |
specification. If the key sequence that invoked the command has |
specification. If the key sequence that invoked the command has |
341 |
@var{n} events that are lists, the @var{n}th @samp{e} provides the |
@var{n} events that are lists, the @var{n}th @samp{e} provides the |
342 |
@var{n}th such event. Events that are not lists, such as function keys |
@var{n}th such event. Events that are not lists, such as function keys |
343 |
and @sc{ascii} characters, do not count where @samp{e} is concerned. |
and @acronym{ASCII} characters, do not count where @samp{e} is concerned. |
344 |
|
|
345 |
@item f |
@item f |
346 |
A file name of an existing file (@pxref{File Names}). The default |
A file name of an existing file (@pxref{File Names}). The default |
797 |
@end example |
@end example |
798 |
|
|
799 |
@noindent |
@noindent |
800 |
The value is 5 because that is the @sc{ascii} code for @kbd{C-e}. |
The value is 5 because that is the @acronym{ASCII} code for @kbd{C-e}. |
801 |
|
|
802 |
The alias @code{last-command-char} exists for compatibility with |
The alias @code{last-command-char} exists for compatibility with |
803 |
Emacs version 18. |
Emacs version 18. |
916 |
@ifnottex |
@ifnottex |
917 |
2**26 |
2**26 |
918 |
@end ifnottex |
@end ifnottex |
919 |
bit in the character code indicates a non-@sc{ascii} |
bit in the character code indicates a non-@acronym{ASCII} |
920 |
control character. |
control character. |
921 |
|
|
922 |
@sc{ascii} control characters such as @kbd{C-a} have special basic |
@sc{ascii} control characters such as @kbd{C-a} have special basic |
923 |
codes of their own, so Emacs needs no special bit to indicate them. |
codes of their own, so Emacs needs no special bit to indicate them. |
924 |
Thus, the code for @kbd{C-a} is just 1. |
Thus, the code for @kbd{C-a} is just 1. |
925 |
|
|
926 |
But if you type a control combination not in @sc{ascii}, such as |
But if you type a control combination not in @acronym{ASCII}, such as |
927 |
@kbd{%} with the control key, the numeric value you get is the code |
@kbd{%} with the control key, the numeric value you get is the code |
928 |
for @kbd{%} plus |
for @kbd{%} plus |
929 |
@tex |
@tex |
932 |
@ifnottex |
@ifnottex |
933 |
2**26 |
2**26 |
934 |
@end ifnottex |
@end ifnottex |
935 |
(assuming the terminal supports non-@sc{ascii} |
(assuming the terminal supports non-@acronym{ASCII} |
936 |
control characters). |
control characters). |
937 |
|
|
938 |
@item shift |
@item shift |
943 |
@ifnottex |
@ifnottex |
944 |
2**25 |
2**25 |
945 |
@end ifnottex |
@end ifnottex |
946 |
bit in the character code indicates an @sc{ascii} control |
bit in the character code indicates an @acronym{ASCII} control |
947 |
character typed with the shift key held down. |
character typed with the shift key held down. |
948 |
|
|
949 |
For letters, the basic code itself indicates upper versus lower case; |
For letters, the basic code itself indicates upper versus lower case; |
950 |
for digits and punctuation, the shift key selects an entirely different |
for digits and punctuation, the shift key selects an entirely different |
951 |
character with a different basic code. In order to keep within the |
character with a different basic code. In order to keep within the |
952 |
@sc{ascii} character set whenever possible, Emacs avoids using the |
@acronym{ASCII} character set whenever possible, Emacs avoids using the |
953 |
@tex |
@tex |
954 |
@math{2^{25}} |
@math{2^{25}} |
955 |
@end tex |
@end tex |
958 |
@end ifnottex |
@end ifnottex |
959 |
bit for those characters. |
bit for those characters. |
960 |
|
|
961 |
However, @sc{ascii} provides no way to distinguish @kbd{C-A} from |
However, @acronym{ASCII} provides no way to distinguish @kbd{C-A} from |
962 |
@kbd{C-a}, so Emacs uses the |
@kbd{C-a}, so Emacs uses the |
963 |
@tex |
@tex |
964 |
@math{2^{25}} |
@math{2^{25}} |
1032 |
|
|
1033 |
@table @asis |
@table @asis |
1034 |
@item @code{backspace}, @code{tab}, @code{newline}, @code{return}, @code{delete} |
@item @code{backspace}, @code{tab}, @code{newline}, @code{return}, @code{delete} |
1035 |
These keys correspond to common @sc{ascii} control characters that have |
These keys correspond to common @acronym{ASCII} control characters that have |
1036 |
special keys on most keyboards. |
special keys on most keyboards. |
1037 |
|
|
1038 |
In @sc{ascii}, @kbd{C-i} and @key{TAB} are the same character. If the |
In @acronym{ASCII}, @kbd{C-i} and @key{TAB} are the same character. If the |
1039 |
terminal can distinguish between them, Emacs conveys the distinction to |
terminal can distinguish between them, Emacs conveys the distinction to |
1040 |
Lisp programs by representing the former as the integer 9, and the |
Lisp programs by representing the former as the integer 9, and the |
1041 |
latter as the symbol @code{tab}. |
latter as the symbol @code{tab}. |
1047 |
symbols in this group. The function @code{read-char} likewise converts |
symbols in this group. The function @code{read-char} likewise converts |
1048 |
these events into characters. |
these events into characters. |
1049 |
|
|
1050 |
In @sc{ascii}, @key{BS} is really @kbd{C-h}. But @code{backspace} |
In @acronym{ASCII}, @key{BS} is really @kbd{C-h}. But @code{backspace} |
1051 |
converts into the character code 127 (@key{DEL}), not into code 8 |
converts into the character code 127 (@key{DEL}), not into code 8 |
1052 |
(@key{BS}). This is what most users prefer. |
(@key{BS}). This is what most users prefer. |
1053 |
|
|
1096 |
|
|
1097 |
Emacs supports four kinds of mouse events: click events, drag events, |
Emacs supports four kinds of mouse events: click events, drag events, |
1098 |
button-down events, and motion events. All mouse events are represented |
button-down events, and motion events. All mouse events are represented |
1099 |
as lists. The @sc{car} of the list is the event type; this says which |
as lists. The @acronym{CAR} of the list is the event type; this says which |
1100 |
mouse button was involved, and which modifier keys were used with it. |
mouse button was involved, and which modifier keys were used with it. |
1101 |
The event type can also distinguish double or triple button presses |
The event type can also distinguish double or triple button presses |
1102 |
(@pxref{Repeat Events}). The rest of the list elements give position |
(@pxref{Repeat Events}). The rest of the list elements give position |
1521 |
key binding purposes. For a keyboard event, the event type equals the |
key binding purposes. For a keyboard event, the event type equals the |
1522 |
event value; thus, the event type for a character is the character, and |
event value; thus, the event type for a character is the character, and |
1523 |
the event type for a function key symbol is the symbol itself. For |
the event type for a function key symbol is the symbol itself. For |
1524 |
events that are lists, the event type is the symbol in the @sc{car} of |
events that are lists, the event type is the symbol in the @acronym{CAR} of |
1525 |
the list. Thus, the event type is always a symbol or a character. |
the list. Thus, the event type is always a symbol or a character. |
1526 |
|
|
1527 |
Two events of the same type are equivalent where key bindings are |
Two events of the same type are equivalent where key bindings are |
1810 |
can include these codes. |
can include these codes. |
1811 |
|
|
1812 |
@item |
@item |
1813 |
Non-@sc{ascii} characters above 256 can be included in a multibyte string. |
Non-@acronym{ASCII} characters above 256 can be included in a multibyte string. |
1814 |
|
|
1815 |
@item |
@item |
1816 |
Other keyboard character events cannot fit in a string. This includes |
Other keyboard character events cannot fit in a string. This includes |
1979 |
|
|
1980 |
If @var{inherit-input-method} is non-@code{nil}, then the current input |
If @var{inherit-input-method} is non-@code{nil}, then the current input |
1981 |
method (if any) is employed to make it possible to enter a |
method (if any) is employed to make it possible to enter a |
1982 |
non-@sc{ascii} character. Otherwise, input method handling is disabled |
non-@acronym{ASCII} character. Otherwise, input method handling is disabled |
1983 |
for reading this event. |
for reading this event. |
1984 |
|
|
1985 |
If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event} |
If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event} |
2009 |
function key event), @code{read-char} signals an error. The arguments |
function key event), @code{read-char} signals an error. The arguments |
2010 |
work as in @code{read-event}. |
work as in @code{read-event}. |
2011 |
|
|
2012 |
In the first example, the user types the character @kbd{1} (@sc{ascii} |
In the first example, the user types the character @kbd{1} (@acronym{ASCII} |
2013 |
code 49). The second example shows a keyboard macro definition that |
code 49). The second example shows a keyboard macro definition that |
2014 |
calls @code{read-char} from the minibuffer using @code{eval-expression}. |
calls @code{read-char} from the minibuffer using @code{eval-expression}. |
2015 |
@code{read-char} reads the keyboard macro's very next character, which |
@code{read-char} reads the keyboard macro's very next character, which |
2189 |
as part of a command or explicitly by a Lisp program. |
as part of a command or explicitly by a Lisp program. |
2190 |
|
|
2191 |
In the example below, the Lisp program reads the character @kbd{1}, |
In the example below, the Lisp program reads the character @kbd{1}, |
2192 |
@sc{ascii} code 49. It becomes the value of @code{last-input-event}, |
@acronym{ASCII} code 49. It becomes the value of @code{last-input-event}, |
2193 |
while @kbd{C-e} (we assume @kbd{C-x C-e} command is used to evaluate |
while @kbd{C-e} (we assume @kbd{C-x C-e} command is used to evaluate |
2194 |
this expression) remains the value of @code{last-command-event}. |
this expression) remains the value of @code{last-command-event}. |
2195 |
|
|
2513 |
value, @var{arg}. The argument may be a symbol, a number, or a list. |
value, @var{arg}. The argument may be a symbol, a number, or a list. |
2514 |
If it is @code{nil}, the value 1 is returned; if it is @code{-}, the |
If it is @code{nil}, the value 1 is returned; if it is @code{-}, the |
2515 |
value @minus{}1 is returned; if it is a number, that number is returned; |
value @minus{}1 is returned; if it is a number, that number is returned; |
2516 |
if it is a list, the @sc{car} of that list (which should be a number) is |
if it is a list, the @acronym{CAR} of that list (which should be a number) is |
2517 |
returned. |
returned. |
2518 |
@end defun |
@end defun |
2519 |
|
|