comparison man/lispref/commands.texi @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 05472e90ae02
children 538048ae2ab8
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
721 @end group 721 @end group
722 @end example 722 @end example
723 @end defvar 723 @end defvar
724 724
725 @defvar last-command-char 725 @defvar last-command-char
726
727 If the value of @code{last-command-event} is a keyboard event, then this 726 If the value of @code{last-command-event} is a keyboard event, then this
728 is the nearest character equivalent to it (or @code{nil} if there is no 727 is the nearest @sc{ASCII} equivalent to it. This is the value that
729 character equivalent). @code{last-command-char} is the character that 728 @code{self-insert-command} will put in the buffer. Remember that there
730 @code{self-insert-command} will insert in the buffer. Remember that 729 is @emph{not} a 1:1 mapping between keyboard events and @sc{ASCII}
731 there is @emph{not} a one-to-one mapping between keyboard events and 730 characters: the set of keyboard events is much larger, so writing code
732 XEmacs characters: many keyboard events have no corresponding character, 731 that examines this variable to determine what key has been typed is bad
733 and when the Mule feature is available, most characters can not be input 732 practice, unless you are certain that it will be one of a small set of
734 on standard keyboards, except possibly with help from an input method. 733 characters.
735 So writing code that examines this variable to determine what key has 734
736 been typed is bad practice, unless you are certain that it will be one 735 This function exists for compatibility with Emacs version 18.
737 of a small set of characters.
738
739 This variable exists for compatibility with Emacs version 18.
740 736
741 @example 737 @example
742 @group 738 @group
743 last-command-char 739 last-command-char
744 ;; @r{Now use @kbd{C-u C-x C-e} to evaluate that.} 740 ;; @r{Now use @kbd{C-u C-x C-e} to evaluate that.}
745 @result{} ?\^E 741 @result{} 5
746 @end group 742 @end group
747 @end example 743 @end example
748 744
745 @noindent
746 The value is 5 because that is the @sc{ASCII} code for @kbd{C-e}.
749 @end defvar 747 @end defvar
750 748
751 @defvar current-mouse-event 749 @defvar current-mouse-event
752 This variable holds the mouse-button event which invoked this command, 750 This variable holds the mouse-button event which invoked this command,
753 or @code{nil}. This is what @code{(interactive "e")} returns. 751 or @code{nil}. This is what @code{(interactive "e")} returns.
820 @itemx button-release event 818 @itemx button-release event
821 A button was pressed or released. Along with the button that was pressed 819 A button was pressed or released. Along with the button that was pressed
822 or released, button events specify the modifier keys that were held down 820 or released, button events specify the modifier keys that were held down
823 at the time and the position of the pointer at the time. 821 at the time and the position of the pointer at the time.
824 822
825 @item motion event 823 @item pointer-motion event
826 The pointer was moved. Along with the position of the pointer, these events 824 The pointer was moved. Along with the position of the pointer, these events
827 also specify the modifier keys that were held down at the time. 825 also specify the modifier keys that were held down at the time.
828 826
829 @item misc-user event 827 @item misc-user event
830 A menu item was selected, or the scrollbar was used. 828 A menu item was selected, or the scrollbar was used.
954 The object to pass to the function. The function and object are set 952 The object to pass to the function. The function and object are set
955 when the event is created. 953 when the event is created.
956 @end table 954 @end table
957 @end table 955 @end table
958 956
959 @defun event-type event
960 Return the type of @var{event}.
961
962 This will be a symbol; one of
963
964 @table @code
965 @item key-press
966 A key was pressed.
967 @item button-press
968 A mouse button was pressed.
969 @item button-release
970 A mouse button was released.
971 @item motion
972 The mouse moved.
973 @item misc-user
974 Some other user action happened; typically, this is
975 a menu selection or scrollbar action.
976 @item process
977 Input is available from a subprocess.
978 @item timeout
979 A timeout has expired.
980 @item eval
981 This causes a specified action to occur when dispatched.
982 @item magic
983 Some window-system-specific event has occurred.
984 @end table
985 @end defun
986
987 @node Event Predicates 957 @node Event Predicates
988 @subsection Event Predicates 958 @subsection Event Predicates
989 959
990 The following predicates return whether an object is an event of a 960 The following predicates return whether an object is an event of a particular
991 particular type. 961 type.
962
963 @defun button-event-p object object
964 This is true if @var{object} is a button-press or button-release event.
965 @end defun
966
967 @defun button-press-event-p object
968 This is true if @var{object} is a mouse-button-press event.
969 @end defun
970
971 @defun button-release-event-p object
972 This is true if @var{object} is a mouse-button-release event.
973 @end defun
974
975 @defun eval-event-p object
976 This is true if @var{object} is an eval or misc-user event.
977 @end defun
992 978
993 @defun key-press-event-p object 979 @defun key-press-event-p object
994 This is true if @var{object} is a key-press event. 980 This is true if @var{object} is a key-press event.
995 @end defun 981 @end defun
996 982
997 @defun button-event-p object object
998 This is true if @var{object} is a mouse button-press or button-release
999 event.
1000 @end defun
1001
1002 @defun button-press-event-p object
1003 This is true if @var{object} is a mouse button-press event.
1004 @end defun
1005
1006 @defun button-release-event-p object
1007 This is true if @var{object} is a mouse button-release event.
1008 @end defun
1009
1010 @defun motion-event-p object
1011 This is true if @var{object} is a mouse motion event.
1012 @end defun
1013
1014 @defun mouse-event-p object
1015 This is true if @var{object} is a mouse button-press, button-release
1016 or motion event.
1017 @end defun
1018
1019 @defun eval-event-p object
1020 This is true if @var{object} is an eval event.
1021 @end defun
1022
1023 @defun misc-user-event-p object 983 @defun misc-user-event-p object
1024 This is true if @var{object} is a misc-user event. 984 This is true if @var{object} is a misc-user event.
1025 @end defun 985 @end defun
1026 986
987 @defun motion-event-p object
988 This is true if @var{object} is a mouse-motion event.
989 @end defun
990
1027 @defun process-event-p object 991 @defun process-event-p object
1028 This is true if @var{object} is a process event. 992 This is true if @var{object} is a process event.
1029 @end defun 993 @end defun
1030 994
1031 @defun timeout-event-p object 995 @defun timeout-event-p object
1037 @end defun 1001 @end defun
1038 1002
1039 @node Accessing Mouse Event Positions 1003 @node Accessing Mouse Event Positions
1040 @subsection Accessing the Position of a Mouse Event 1004 @subsection Accessing the Position of a Mouse Event
1041 1005
1042 Unlike other events, mouse events (i.e. motion, button-press, and 1006 Unlike other events, mouse events (i.e. mouse-motion, button-press, and
1043 button-release events) occur in a particular location on the screen. 1007 button-release events) occur in a particular location on the screen.
1044 Many primitives are provided for determining exactly where the event 1008 Many primitives are provided for determining exactly where the event
1045 occurred and what is under that location. 1009 occurred and what is under that location.
1046 1010
1047 @menu 1011 @menu
1066 @end defun 1030 @end defun
1067 1031
1068 @defun event-x-pixel event 1032 @defun event-x-pixel event
1069 This function returns the X position in pixels of the given mouse event. 1033 This function returns the X position in pixels of the given mouse event.
1070 The value returned is relative to the frame the event occurred in. 1034 The value returned is relative to the frame the event occurred in.
1071 This will signal an error if the event is not a mouse event. 1035 This will signal an error if the event is not a mouse-motion, button-press,
1036 or button-release event.
1072 @end defun 1037 @end defun
1073 1038
1074 @defun event-y-pixel event 1039 @defun event-y-pixel event
1075 This function returns the Y position in pixels of the given mouse event. 1040 This function returns the Y position in pixels of the given mouse event.
1076 The value returned is relative to the frame the event occurred in. 1041 The value returned is relative to the frame the event occurred in.
1077 This will signal an error if the event is not a mouse event. 1042 This will signal an error if the event is not a mouse-motion, button-press,
1043 or button-release event.
1078 @end defun 1044 @end defun
1079 1045
1080 @node Window-Level Event Position Info 1046 @node Window-Level Event Position Info
1081 @subsubsection Window-Level Event Position Info 1047 @subsubsection Window-Level Event Position Info
1082 1048
1085 1051
1086 @defun event-window event 1052 @defun event-window event
1087 Given a mouse motion, button press, or button release event, compute and 1053 Given a mouse motion, button press, or button release event, compute and
1088 return the window on which that event occurred. This may be @code{nil} 1054 return the window on which that event occurred. This may be @code{nil}
1089 if the event occurred in the border or over a toolbar. The modeline is 1055 if the event occurred in the border or over a toolbar. The modeline is
1090 considered to be within the window it describes. 1056 considered to be in the window it represents.
1091 @end defun 1057 @end defun
1092 1058
1093 @defun event-buffer event 1059 @defun event-buffer event
1094 Given a mouse motion, button press, or button release event, compute and 1060 Given a mouse motion, button press, or button release event, compute and
1095 return the buffer of the window on which that event occurred. This may 1061 return the buffer of the window on which that event occurred. This may
1096 be @code{nil} if the event occurred in the border or over a toolbar. 1062 be @code{nil} if the event occurred in the border or over a toolbar.
1097 The modeline is considered to be within the window it describes. This is 1063 The modeline is considered to be in the window it represents. This is
1098 equivalent to calling @code{event-window} and then calling 1064 equivalent to calling @code{event-window} and then calling
1099 @code{window-buffer} on the result if it is a window. 1065 @code{event-buffer} on the result if it is a window.
1100 @end defun 1066 @end defun
1101 1067
1102 @defun event-window-x-pixel event 1068 @defun event-window-x-pixel event
1103 This function returns the X position in pixels of the given mouse event. 1069 This function returns the X position in pixels of the given mouse event.
1104 The value returned is relative to the window the event occurred in. 1070 The value returned is relative to the window the event occurred in.
1238 This function returns the Keysym of the given key-press event. 1204 This function returns the Keysym of the given key-press event.
1239 This will be the @sc{ASCII} code of a printing character, or a symbol. 1205 This will be the @sc{ASCII} code of a printing character, or a symbol.
1240 @end defun 1206 @end defun
1241 1207
1242 @defun event-button event 1208 @defun event-button event
1243 This function returns the button-number of the given button-press or 1209 This function returns the button-number of the given mouse-button-press
1244 button-release event. 1210 event.
1245 @end defun 1211 @end defun
1246 1212
1247 @defun event-modifiers event 1213 @defun event-modifiers event
1248 This function returns a list of symbols, the names of the modifier keys 1214 This function returns a list of symbols, the names of the modifier keys
1249 which were down when the given mouse or keyboard event was produced. 1215 which were down when the given mouse or keyboard event was produced.