[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: left brackets insert both
From: |
rgb |
Subject: |
Re: left brackets insert both |
Date: |
25 Mar 2005 09:49:48 -0800 |
User-agent: |
G2/0.2 |
Shug Boabby wrote:
> excellent! i had found the exact setup once rgb had pointed me to the
> function call, but cheers david!
>
> however, it is sometimes annoying that a single type of a bracket
does
> this... any chance i could set it only to work on double taps? i get
> nothing when i try something like:
> (global-set-key [?\< ?\<] 'skeleton-pair-insert-maybe)
> i guess its trying to find the skeleton pair to << instead of <
You can probably adapt this to your needs.
(defmacro my-insert-if-double (new-txt)
"If last key same as this key, replace both with new-txt."
`(lambda (cnt)
(interactive "p")
(if (equal (preceding-char) last-command-char)
(progn
(backward-delete-char 1)
(insert ,new-txt))
(self-insert-command cnt))))
(add-hook 'html-mode-hook
(lambda ()
(local-set-key [(<)] (my-insert-if-double "<"))
(local-set-key [(>)] (my-insert-if-double ">"))
(local-set-key [(&)] (my-insert-if-double "&"))
(local-set-key [(\")] (my-insert-if-double """))))
- left brackets insert both, Shug Boabby, 2005/03/25
- Re: left brackets insert both, rgb, 2005/03/25
- Re: left brackets insert both, David Hansen, 2005/03/25
- Re: left brackets insert both, Shug Boabby, 2005/03/25
- Re: left brackets insert both,
rgb <=
- Re: left brackets insert both, Shug Boabby, 2005/03/25
- Re: left brackets insert both, rgb, 2005/03/25
- Re: left brackets insert both, rgb, 2005/03/25
- Re: left brackets insert both, Shug Boabby, 2005/03/25
- Re: left brackets insert both, rgb, 2005/03/25
- Re: left brackets insert both, David Hansen, 2005/03/26
Re: left brackets insert both, Peter Lee, 2005/03/25