I want an Emacs Lisp function to have two different behaviors depending on whether the control key is pressed or not.
Is there a way to query the state of the control key? Thanks.
Join Stack Overflow to learn, share knowledge, and build your career.
There's no facility to check the current state of a modifier key, but you can check whether the last key used to run the command was used with "control" or not:
(memq 'control (event-modifiers last-command-event))
Note that TAB and RET are actually the same as C-i and C-m, so they are considered as having a "control" modifier.
interactive or current-prefix-argument.
– Lindydancer
Oct 21 '14 at 7:00