unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Matthew Flaschen <matthew.flaschen@gatech.edu>
To: emacs <help-gnu-emacs@gnu.org>
Subject: Re: Insert ; after closing parenthesis when on it
Date: Wed, 14 Feb 2007 15:41:45 -0500	[thread overview]
Message-ID: <45D37409.5070709@gatech.edu> (raw)
In-Reply-To: <87lkj0lcvc.fsf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 975 bytes --]

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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

  reply	other threads:[~2007-02-14 20:41 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 [this message]
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
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=45D37409.5070709@gatech.edu \
    --to=matthew.flaschen@gatech.edu \
    --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).