From: joaotavora@gmail.com (João Távora)
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: Re: [patch] make electric-pair-mode smarter/more useful
Date: Mon, 16 Dec 2013 00:35:59 +0000 [thread overview]
Message-ID: <87ppoxaaz4.fsf@gmail.com> (raw)
In-Reply-To: <jwvbo0iykjx.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 14 Dec 2013 20:39:57 -0500")
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
>> Yes, but if it's set via electric-layout-rules, to what value will this
>> variable be set in e.g. js-mode?
>
> The value which seems most useful for javascript.
Right.
>> If it'll include what's there currently, '((?\; . after) (?\{ . after) (?\}
>> . before)), then to get the desired behavior I described previously (NOT to
>> insert a newline after I just typed `{', or any other character), I'd have
>> to modify it again in js-mode-hook.
I think that the current js-mode rules, when appended to the default
rule I proposed in the latest patch, will mostly supersede, but not
completely, the newline-between-pairs rule.
>
> If there can be various competing choices, then indeed we have a problem.
> The intention of electric-layout-mode is that it should more or less
> (tho in a naive way) insert the newlines for you if you just
> naively/sequentially type in the code.
Funny, since I didn't know of that "intention", I appreciated the
`electric-layout-mode' immediately for its potential, but found those
rules really akward.
I personally would prefer that the current rules would *not* be the
default in js-mode, as they are now, or any other mode). They could be
enabled with some function like
`electric-layout-toggle-electric-braces`.
Anyway, the default value should really be the newline-between-pairs
rule, which currently only kicks in when electric-pair-mode is
additionally enabled (btw, should it not?).
The only mode I know where it doesn't make sense is lisp-based-modes
(though probably one can find others). Still, even in lisp one hardly
ever newlines after a opening parens right? And even then, when coupled
with a `chomp' value for `electric-pair-skip-whitespace', it's quite
harmless. And finally, lisp-mode.el, or any other mode where we find it
to be harmful, can simply choose to clear all the rules locally.
FWIW, and from my experience in autopair.el, this rule is probably also
natural for people coming from other editors where the "electric"
behaviour is built-in, namely textmate (and possibly some of its
descendants). So users desperate to get that behaviour can just enable
all three electric modes and be happy 99% of the time.
> For that reason electric-layout-mode is off by default, and I haven't
> heard anyone argue to enable it by default.
But, if we wanted, we could make it on by default provided the default
rules are not annoying in the vast majority of modes (while the minority
locally sets them).
> From this POV, maybe electric-pair-newline-between-pairs-rule should be
> made into a separate minor mode, indeed.
This is also possible, but overkill IMO. I like the current triad of
electric modes.
João
next prev parent reply other threads:[~2013-12-16 0:35 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-06 23:31 [patch] make electric-pair-mode smarter/more useful João Távora
2013-12-07 2:09 ` Leo Liu
2013-12-07 2:36 ` Dmitry Gutov
2013-12-07 21:01 ` João Távora
2013-12-07 23:16 ` Stefan Monnier
2013-12-12 3:05 ` João Távora
2013-12-12 4:29 ` Dmitry Gutov
2013-12-12 11:26 ` João Távora
2013-12-12 16:30 ` Stefan Monnier
2013-12-12 17:06 ` João Távora
2013-12-12 20:12 ` Stefan Monnier
2013-12-13 2:55 ` Dmitry Gutov
2013-12-14 15:18 ` Stefan Monnier
2013-12-14 16:56 ` Dmitry Gutov
2013-12-15 1:39 ` Stefan Monnier
2013-12-16 0:35 ` João Távora [this message]
2013-12-16 3:34 ` Stefan Monnier
2013-12-16 19:26 ` João Távora
2013-12-17 1:54 ` Stefan Monnier
2013-12-18 2:43 ` João Távora
2013-12-18 15:32 ` João Távora
2013-12-23 14:41 ` João Távora
2013-12-24 14:29 ` Bozhidar Batsov
2013-12-07 23:07 ` Stefan Monnier
2013-12-12 3:01 ` João Távora
2013-12-12 18:08 ` Stefan Monnier
2013-12-13 1:02 ` João Távora
2013-12-13 2:32 ` Stefan Monnier
2013-12-15 22:10 ` João Távora
2013-12-16 3:22 ` Stefan Monnier
2013-12-16 14:21 ` João Távora
2013-12-16 15:30 ` Stefan Monnier
2013-12-16 18:40 ` Stefan Monnier
2013-12-16 19:06 ` João Távora
2013-12-17 1:42 ` Stefan Monnier
[not found] ` <CALDnm52AoShN891-L9=Cbng98UtYPEntzO+n_XDMmEL+UV0r-A@mail.gmail.com>
2013-12-16 19:02 ` Fwd: " João Távora
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ppoxaaz4.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.