help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Insert ; after closing parenthesis when on it


From: weber
Subject: Re: Insert ; after closing parenthesis when on it
Date: 14 Feb 2007 12:36:26 -0800
User-agent: G2/1.0

On 14 fev, 17:09, Jiri Pejchal <jiri.pejc...@gmail.com> wrote:
> "weber" <hug...@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.
>
> --
> Jiri Pejchal

I couldn't test that here, but maybe just doing something like this
works ?

(defun jump-closepar ()
 "Close parenthesis Jiri's way"
 (interactive)
 (if (looking-at ")")
               (forward-char))
 (c-electric-semi&comma))

Just a guess...
cheers,
weber



reply via email to

[Prev in Thread] Current Thread [Next in Thread]