Search code examples
emacselisp

Emacs Lisp - bind `(` to `(<cur>)` and `()` to `()`


I've gotten a nice rebind, ( to (<cur>) working, but I would like to be able to still type () to do ()<cur>. Is this possible in Emacs Lisp?


Solution

  • Use the following to get a character,

    (interactive "c`)' will insert ), else will go inside and insert")
    

    Then just test if the parameter is equal to 41 (close parens).