[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: execute after char/string
From: |
Chetan |
Subject: |
Re: execute after char/string |
Date: |
Thu, 27 Nov 2008 18:14:56 -0800 |
User-agent: |
Emacs Gnus |
Steve Chow <msweaksauce@hotmail.com> writes:
> is there a way I can execute a function/macro after I've inserted a
> character or string? In this case I'd like execute a function after
> typing . or -> in c-mode. I tried using global-set-key but then of
> course it won't let me enter those characters into the buffer.
I don't have anything to do after inserting the character, but before.
It goes something like this:
(defun fix-array-index(&optional arg)
(interactive "p")
;; go fix up the index value, if needed
(self-insert-command arg))
And the following in the mode hook:
(local-set-key "]" 'fix-array-index)
with some checks to do it only once.
Chetan