[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Character repeation detection
From: |
Eric Abrahamsen |
Subject: |
Re: Character repeation detection |
Date: |
Mon, 10 Mar 2014 09:59:32 +0800 |
User-agent: |
Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3 (gnu/linux) |
Tom <adatgyujto@gmail.com> writes:
> Tom <adatgyujto <at> gmail.com> writes:
>
>>
>> Jambunathan K <kjambunathan <at> gmail.com> writes:
>>
>> > > Is there an existing solution for this?
>> >
>> > M-s h r \(.\)\1 RET
>> >
>> > (highlight-regexp "\\(.\\)\\1" (quote highlight))
>> >
>>
>> I'm not talking about highlighting. I'd like an actual function
>> call when this happens.
>>
>
> And I don't mean 3 or more of the same character in the buffer
> somewhere. I'm interested in detecting when the user types
> 3 or more of the same character in a row.
I was going to suggest that you make a vector where you store the values
of `last-input-event' in the `post-self-insert-hook' and then check the
value of that vector, but then it occurred to me that emacs already does
this with lossage. And from there to:
recent-keys is a built-in function in `C source code'.
(recent-keys)
Return vector of last 300 events, not counting those from keyboard macros.
Pretty much just what you want. It should be fairly easy to (again using
the `post-self-insert-hook') write a function that takes
`last-input-event' and compares it to the newest values returned by
`recent-keys', and then go from there.
HTH,
Eric
- Re: Character repeation detection, (continued)
- Re: Character repeation detection, Jambunathan K, 2014/03/09
- Re: Character repeation detection, Tom, 2014/03/09
- Re: Character repeation detection, Marcin Borkowski, 2014/03/09
- Re: Character repeation detection, Andreas Röhler, 2014/03/09
- Re: Character repeation detection, Tom, 2014/03/09
- Re: Character repeation detection, Tom, 2014/03/09
- Re: Character repeation detection, Stefan Monnier, 2014/03/09
- Message not available
- Re: Character repeation detection, Dan Espen, 2014/03/09
- Re: Character repeation detection, Tom, 2014/03/09
- Message not available
- Re: Character repeation detection, Joost Kremers, 2014/03/09
- Re: Character repeation detection,
Eric Abrahamsen <=
Re: Character repeation detection, Yuri Khan, 2014/03/09
Message not available