unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "weber" <hugows@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Insert ; after closing parenthesis when on it
Date: 14 Feb 2007 11:08:49 -0800	[thread overview]
Message-ID: <1171480128.947374.190550@v33g2000cwv.googlegroups.com> (raw)
In-Reply-To: <mailman.4516.1171478780.2155.help-gnu-emacs@gnu.org>

On 14 fev, 15:44, Jiri Pejchal <jiri.pejc...@gmail.com> wrote:
> Hi,
>
> Netbeans has a following nice feature: when the cursor is on the last
> parenthesis of a function call and you press ';', the semicolon is
> automatically inserted after the parenthesis. This is very useful
> because the opening parenthesis usually inserts also the closing
> parenthesis. In emacs after adding arguments you are left with the
> cursor on the closing one. Then you have to press right and then ';'.
>
> What I would like to achieve:
>
> object.methodCall(a, b|)
>                       ^
>                       |
>                       |
>                       cursor here
>                       (actually on the parenthesis)
>
> press ';' and get this:
>
> object.methodCall(a, b);|
>                         ^
>                         |
>                         |
>                         cursor here
>                         (or even on the next line)
>
> Is this possible in emacs and jdee (or c++ mode)?
>
> Thanks.
>
> --
> Jiri Pejchal


There's probably a faster way, but the way I know is remapping the ';'
key like this:

(global-set-key ";" 'jump-closepar)

where the function jump-closepar would be something like this
(tested) :

(defun jump-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 ";" 'jump-closepar)

  parent reply	other threads:[~2007-02-14 19:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4516.1171478780.2155.help-gnu-emacs@gnu.org>
2007-02-14 19:03 ` Insert ; after closing parenthesis when on it weber
2007-02-14 20:09   ` Jiri Pejchal
2007-02-14 20:41     ` Matthew Flaschen
2007-02-15  2:36     ` Herbert Euler
2007-02-15  2:40       ` Herbert Euler
     [not found]   ` <mailman.4523.1171483812.2155.help-gnu-emacs@gnu.org>
2007-02-14 20:36     ` weber
2007-02-14 21:36       ` Jiri Pejchal
     [not found]       ` <mailman.4529.1171488981.2155.help-gnu-emacs@gnu.org>
2007-02-16  7:34         ` Markus Triska
2007-02-16 18:32           ` Jiri Pejchal
2007-02-14 19:08 ` weber [this message]
2007-02-14 18:44 Jiri Pejchal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1171480128.947374.190550@v33g2000cwv.googlegroups.com \
    --to=hugows@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).