help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to distinguish character from noncharacter input events?


From: Kevin Rodgers
Subject: Re: How to distinguish character from noncharacter input events?
Date: Wed, 11 Aug 2004 17:53:17 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Joe Fineman wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>What's your definition of a "character event"?
>
> As a practical matter, it means an event that will not give the error
> message "non-character input event" when read-char encounters it.

You could implement the same check as read-char:

(defun character-event-p (event)
  "Return non-nil if EVENT is a character event."
  ;; see Fread_char:
  (if (symbolp event)
      (let* ((mask (get event 'event-symbol-element-mask))
             (char (if mask
                       (get (car mask) 'ascii-character))))
        (if char
            (setq event (logior char (car (cdr mask)))))))
  (integerp event))

--
Kevin Rodgers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]