[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: local key swap? alternatives?
From: |
Francisco Borges |
Subject: |
Re: local key swap? alternatives? |
Date: |
Thu, 8 Sep 2005 16:57:15 +0200 |
User-agent: |
Mutt/1.5.9i |
ยป On Wed, Sep 07, 2005 at 11:47AM -0600, Kevin Rodgers wrote:
> If you have many such functions, you'd want to abstract the common parts
> with a function-defining macro:
>
> (defmacro define-my-insert (name char)
> "Define the `my-NAME' command, to insert CHAR."
> `(defun ,(intern (format "my-%s" name)) (&optional arg)
> ,(format "Insert \"%c\" at point.
> With a prefix ARG, insert that many characters."
> char)
> (interactive "p")
> (insert-char ,char (or arg 1))))
>
> (define-my-insert four ?4)
> (define-my-insert dollar ?$)
That's great! Thanks a lot!
Cheers,
Francisco.