[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Insert ; after closing parenthesis when on it
From: |
Matthew Flaschen |
Subject: |
Re: Insert ; after closing parenthesis when on it |
Date: |
Wed, 14 Feb 2007 15:41:45 -0500 |
User-agent: |
Thunderbird 1.5.0.9 (X11/20070103) |
Jiri Pejchal wrote:
> "weber" <hugows@gmail.com> writes:
>
>> There's probably a faster way, but the way I know is remapping the ';'
>> key like this:
>>
>> (global-set-key ";" 'insert-closepar)
>>
>> where the function insert-closepar would be something like this
>> (tested) :
>>
>> (defun insert-closepar ()
>> "Close parenthesis Jiri's way"
>> (interactive)
>> (if (looking-at ")")
>> (forward-char))
>> (insert ";"))
>>
>> Oh, and you probably don't want to make that binding global map,
>> because you are only going to use it on specific modes. Try doing:
>> (define-key somelanguage-mode-map ";" 'insert-closepar)
>
> Thanks a lot! But I would like to keep the electric behaviour of ';'
> too. It's bound to c-electric-semi&comma.
Try changing it to:
(defun insert-closepar ()
"Close parenthesis Jiri's way"
(interactive)
(if (looking-at ")")
(forward-char))
(c-electric-semi&comma))
Matthew Flaschen
signature.asc
Description: OpenPGP digital signature
Re: Insert ; after closing parenthesis when on it, weber, 2007/02/14