* Electric braces
@ 2012-09-19 17:11 Guido Van Hoecke
2012-09-19 17:17 ` Константин Куликов
2012-09-19 17:33 ` Pascal J. Bourguignon
0 siblings, 2 replies; 8+ messages in thread
From: Guido Van Hoecke @ 2012-09-19 17:11 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
When using 'electric braces' in Visual Studio, MonoDevelop and other
tools, I like the behaviour where the closing brace is auto-detected.
(In the example, I show the insertion point as a bar)
If I type
if (|
the screen shows
if (|)
I then key in my test expression, say isFalse (or whatever):
if (isFalse|)
At this point, Visual studio and MonoDevelop realise that the next ')'
key I hit, really represents the ')' which is already there. It does not
add an additional ')' :
if (isFalse)|
But in Emacs, currently using cperl, but also when using c#-mode, or
IIRC ruby-mode, emacs does add an additional ')' which leads to
following erroneous code:
if (isFalse)|)
I am pretty cinfident that Emacs can mimic the VS/MD behaviour. I just
did not find yet how to request it from good old Emacs.
Thanks in advance for any suggestions,
Guido
--
Expect a letter from a friend who will ask a favor of you.
http://vanhoecke.org ... and go2 places!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Electric braces
2012-09-19 17:11 Electric braces Guido Van Hoecke
@ 2012-09-19 17:17 ` Константин Куликов
2012-09-19 17:33 ` Pascal J. Bourguignon
1 sibling, 0 replies; 8+ messages in thread
From: Константин Куликов @ 2012-09-19 17:17 UTC (permalink / raw)
To: Guido Van Hoecke; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 220 bytes --]
google autopair.el
2012/9/19 Guido Van Hoecke <guivho@gmail.com>
> Hi,
>
> When using 'electric braces' in Visual Studio, MonoDevelop and other
> tools, I like the behaviour where the closing brace is auto-detected.
>
[-- Attachment #2: Type: text/html, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Electric braces
2012-09-19 17:11 Electric braces Guido Van Hoecke
2012-09-19 17:17 ` Константин Куликов
@ 2012-09-19 17:33 ` Pascal J. Bourguignon
1 sibling, 0 replies; 8+ messages in thread
From: Pascal J. Bourguignon @ 2012-09-19 17:33 UTC (permalink / raw)
To: help-gnu-emacs
Guido Van Hoecke <guivho@gmail.com> writes:
> Hi,
>
> When using 'electric braces' in Visual Studio, MonoDevelop and other
> tools, I like the behaviour where the closing brace is auto-detected.
>
> (In the example, I show the insertion point as a bar)
> If I type
>
> if (|
>
> the screen shows
>
> if (|)
>
> I then key in my test expression, say isFalse (or whatever):
>
> if (isFalse|)
>
> At this point, Visual studio and MonoDevelop realise that the next ')'
> key I hit, really represents the ')' which is already there. It does not
> add an additional ')' :
>
> if (isFalse)|
>
> But in Emacs, currently using cperl, but also when using c#-mode, or
> IIRC ruby-mode, emacs does add an additional ')' which leads to
> following erroneous code:
>
> if (isFalse)|)
>
> I am pretty cinfident that Emacs can mimic the VS/MD behaviour. I just
> did not find yet how to request it from good old Emacs.
>
> Thanks in advance for any suggestions,
paredit-mode does that, but perhaps some more since it's for lisp
editing. You'll want to extract parts of it.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Electric braces
@ 2012-09-19 18:22 Dmitry Gutov
0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Gutov @ 2012-09-19 18:22 UTC (permalink / raw)
To: zxnotdead; +Cc: help-gnu-emacs
Константин Куликов <zxnotdead@gmail.com> writes:
> google autopair.el
Why google? Here's the home page: http://code.google.com/p/autopair/
And yes, it's the most popular package for this purpose.
I especially like the newline behavior (the fourth bullet point).
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Electric braces
[not found] <mailman.9321.1348074746.855.help-gnu-emacs@gnu.org>
@ 2012-09-20 3:47 ` Stefan Monnier
2012-09-20 14:58 ` Guido Van Hoecke
[not found] ` <mailman.9367.1348153122.855.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2012-09-20 3:47 UTC (permalink / raw)
To: help-gnu-emacs
> I am pretty cinfident that Emacs can mimic the VS/MD behaviour. I just
> did not find yet how to request it from good old Emacs.
The built-in electric-pair-mode does that.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Electric braces
2012-09-20 3:47 ` Stefan Monnier
@ 2012-09-20 14:58 ` Guido Van Hoecke
[not found] ` <mailman.9367.1348153122.855.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Guido Van Hoecke @ 2012-09-20 14:58 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Hi Stefan, Pascal and Constantin
On 20 September 2012 05:47, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> I am pretty cinfident that Emacs can mimic the VS/MD behaviour. I just
>> did not find yet how to request it from good old Emacs.
>
> The built-in electric-pair-mode does that.
>
>
> Stefan
Thanks for your kind replies.
I tried the built-inelectric-pair-mode and it does what I want.
With kind regards,
Guido
--
Death is nature's way of saying `Howdy'.
http://vanhoecke.org ... and go2 places!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Electric braces
[not found] ` <mailman.9367.1348153122.855.help-gnu-emacs@gnu.org>
@ 2012-09-20 17:38 ` Stefan Monnier
2012-09-21 16:56 ` João Távora
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2012-09-20 17:38 UTC (permalink / raw)
To: help-gnu-emacs
> I tried the built-in electric-pair-mode and it does what I want.
I'm glad you like it,
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Electric braces
2012-09-20 17:38 ` Stefan Monnier
@ 2012-09-21 16:56 ` João Távora
0 siblings, 0 replies; 8+ messages in thread
From: João Távora @ 2012-09-21 16:56 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
(originally forgot to cc: help-gnu-emacs@gnu.org)
I'd just like to add that autopair:
* is now hosted at github.com/capitaomorte/autopair
* out of the box, does a bit more than electric-pair-mode, like
deleting 0-width paren pairs when backspacing and helping to keep the
buffer balanced (for example typing 3 opening "{" consecutively makes
"{{{}}}" instead of electric pair's "{{{}".
* can be customized to behave differently in comments and strings,
pair characters, and more
I'm quite positively surprised how electric-pair-mode has evolved
though, but still find it awkward in how it sometimes pairs and
sometimes doesn't.
--
João Távora
On Thu, Sep 20, 2012 at 6:38 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> I tried the built-in electric-pair-mode and it does what I want.
>
> I'm glad you like it,
>
>
> Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-09-21 16:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19 17:11 Electric braces Guido Van Hoecke
2012-09-19 17:17 ` Константин Куликов
2012-09-19 17:33 ` Pascal J. Bourguignon
-- strict thread matches above, loose matches on Subject: below --
2012-09-19 18:22 Dmitry Gutov
[not found] <mailman.9321.1348074746.855.help-gnu-emacs@gnu.org>
2012-09-20 3:47 ` Stefan Monnier
2012-09-20 14:58 ` Guido Van Hoecke
[not found] ` <mailman.9367.1348153122.855.help-gnu-emacs@gnu.org>
2012-09-20 17:38 ` Stefan Monnier
2012-09-21 16:56 ` João Távora
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).