aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBasil L. Contovounesios2019-04-21 23:02:01 +0100
committerBasil L. Contovounesios2019-05-07 18:00:20 +0100
commitc972da907d494b6d5efd423aa3b5d0b23f7b7801 (patch)
treefd5dd346e8e31e029bf3c8686f28c60e6dadf4c4
parente10d08df7edbb2e9e90169d19c3361099802fad6 (diff)
downloademacs-c972da907d494b6d5efd423aa3b5d0b23f7b7801.tar.gz
emacs-c972da907d494b6d5efd423aa3b5d0b23f7b7801.zip
Clarify what constitutes an event (bug#35238)
* doc/lispref/commands.texi (Input Events): Specify that events are non-nil and remove vestiges of bug#10190. * doc/lispref/os.texi (Recording Input): Document optional argument of recent-keys. * lisp/subr.el (eventp): Check that the car of conses is non-nil. * etc/NEWS: Announce it as an incompatible change. * src/keyboard.c (Frecent_keys): Clarify that returned "events" are not real events.
-rw-r--r--doc/lispref/commands.texi9
-rw-r--r--doc/lispref/os.texi7
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/subr.el14
-rw-r--r--src/keyboard.c2
5 files changed, 23 insertions, 14 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index cd44c1c87ef..5ea0be2667b 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1047,12 +1047,9 @@ and meaning of input events in detail.
1047This function returns non-@code{nil} if @var{object} is an input event 1047This function returns non-@code{nil} if @var{object} is an input event
1048or event type. 1048or event type.
1049 1049
1050Note that any symbol might be used as an event or an event type. 1050Note that any non-@code{nil} symbol might be used as an event or an
1051@code{eventp} cannot distinguish whether a symbol is intended by Lisp 1051event type; @code{eventp} cannot distinguish whether a symbol is
1052code to be used as an event. Instead, it distinguishes whether the 1052intended by Lisp code to be used as an event.
1053symbol has actually been used in an event that has been read as input in
1054the current Emacs session. If a symbol has not yet been so used,
1055@code{eventp} returns @code{nil}.
1056@end defun 1053@end defun
1057 1054
1058@menu 1055@menu
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 59cd5a8fe8a..fef954eb7a3 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2197,7 +2197,7 @@ is the character Emacs currently uses for quitting, usually @kbd{C-g}.
2197@subsection Recording Input 2197@subsection Recording Input
2198@cindex recording input 2198@cindex recording input
2199 2199
2200@defun recent-keys 2200@defun recent-keys &optional include-cmds
2201This function returns a vector containing the last 300 input events from 2201This function returns a vector containing the last 300 input events from
2202the keyboard or mouse. All input events are included, whether or not 2202the keyboard or mouse. All input events are included, whether or not
2203they were used as parts of key sequences. Thus, you always get the last 2203they were used as parts of key sequences. Thus, you always get the last
@@ -2205,6 +2205,11 @@ they were used as parts of key sequences. Thus, you always get the last
2205(These are excluded because they are less interesting for debugging; it 2205(These are excluded because they are less interesting for debugging; it
2206should be enough to see the events that invoked the macros.) 2206should be enough to see the events that invoked the macros.)
2207 2207
2208If @var{include-cmds} is non-@code{nil}, complete key sequences in the
2209result vector are interleaved with pseudo-events of the form
2210@code{(nil . @var{COMMAND})}, where @var{COMMAND} is the binding of
2211the key sequence (@pxref{Command Overview}).
2212
2208A call to @code{clear-this-command-keys} (@pxref{Command Loop Info}) 2213A call to @code{clear-this-command-keys} (@pxref{Command Loop Info})
2209causes this function to return an empty vector immediately afterward. 2214causes this function to return an empty vector immediately afterward.
2210@end defun 2215@end defun
diff --git a/etc/NEWS b/etc/NEWS
index 5fe2e63526d..72f669a4a40 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1575,6 +1575,11 @@ performs '(setq-local indent-line-function #'indent-relative)'.
1575** 'make-process' no longer accepts a non-nil ':stop' key. This has 1575** 'make-process' no longer accepts a non-nil ':stop' key. This has
1576never worked reliably, and now causes an error. 1576never worked reliably, and now causes an error.
1577 1577
1578+++
1579** 'eventp' no longer returns non-nil for lists whose car is nil.
1580This is consistent with the fact that nil, though a symbol, is not a
1581valid event type.
1582
1578 1583
1579* Lisp Changes in Emacs 27.1 1584* Lisp Changes in Emacs 27.1
1580 1585
diff --git a/lisp/subr.el b/lisp/subr.el
index f68f9dd4191..be21dc67a0d 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1238,12 +1238,14 @@ The normal global definition of the character C-x indirects to this keymap.")
1238 c))) 1238 c)))
1239 key))) 1239 key)))
1240 1240
1241(defun eventp (obj) 1241(defun eventp (object)
1242 "True if the argument is an event object." 1242 "Return non-nil if OBJECT is an input event or event object."
1243 (when obj 1243 (or (integerp object)
1244 (or (integerp obj) 1244 (and (if (consp object)
1245 (and (symbolp obj) obj (not (keywordp obj))) 1245 (setq object (car object))
1246 (and (consp obj) (symbolp (car obj)))))) 1246 object)
1247 (symbolp object)
1248 (not (keywordp object)))))
1247 1249
1248(defun event-modifiers (event) 1250(defun event-modifiers (event)
1249 "Return a list of symbols representing the modifier keys in event EVENT. 1251 "Return a list of symbols representing the modifier keys in event EVENT.
diff --git a/src/keyboard.c b/src/keyboard.c
index ea13c7f5bcd..5f2b7afe6d1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -9968,7 +9968,7 @@ If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */)
9968DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 1, 0, 9968DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 1, 0,
9969 doc: /* Return vector of last few events, not counting those from keyboard macros. 9969 doc: /* Return vector of last few events, not counting those from keyboard macros.
9970If INCLUDE-CMDS is non-nil, include the commands that were run, 9970If INCLUDE-CMDS is non-nil, include the commands that were run,
9971represented as events of the form (nil . COMMAND). */) 9971represented as pseudo-events of the form (nil . COMMAND). */)
9972 (Lisp_Object include_cmds) 9972 (Lisp_Object include_cmds)
9973{ 9973{
9974 bool cmds = !NILP (include_cmds); 9974 bool cmds = !NILP (include_cmds);