[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: electric-pair-mode as a minor mode?
From: |
João Távora |
Subject: |
Re: electric-pair-mode as a minor mode? |
Date: |
Fri, 27 Mar 2015 14:09:28 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) |
Stefan Monnier <address@hidden> writes:
> It's probably because of something in the context, but you can't assume
> that parens are properly balanced in text mode.
I don't, not directly. I just use whatever (syntax-table) says, as does
`show-paren-mode' FWIW. And it says that text-mode buffers are all the
same context and should have balanced parenthesis. Perhaps it shouldn't.
> Here's one concrete example I bumped into earlier today:
>
> this is a sad example :-(
> I just wanted to type foo ())
For every :-( there should be a :-), see?
Seriously, while I won't stand in the way of having some
`electric-pair-mode'-related default hookage in text-mode-hook, why
isn't this fixed in text-mode's syntax-table? Aren't those wrong
assumptions the real culprit?
Do you want to recognize that the "sad example :-(" is in "a different
context" than the function call foo(), and so should not be paired? If
so, there's emacs machinery that separate those contexts (comment and
non-comment) and `electric-pair-mode' can take that into consideration
via `electric-pair-text-syntax-table'.
But you obviously know this, so what do you have in mind?
João
- electric-pair-mode as a minor mode?, Yuri D'Elia, 2015/03/26
- Re: electric-pair-mode as a minor mode?, Stefan Monnier, 2015/03/26
- Re: electric-pair-mode as a minor mode?, Yuri D'Elia, 2015/03/27
- Re: electric-pair-mode as a minor mode?, João Távora, 2015/03/27
- Re: electric-pair-mode as a minor mode?, Stefan Monnier, 2015/03/27
- Re: electric-pair-mode as a minor mode?,
João Távora <=
- Re: electric-pair-mode as a minor mode?, Stefan Monnier, 2015/03/27
- Re: electric-pair-mode as a minor mode?, João Távora, 2015/03/28
- Re: electric-pair-mode as a minor mode?, Stefan Monnier, 2015/03/28
- Re: electric-pair-mode as a minor mode?, João Távora, 2015/03/28
- Re: electric-pair-mode as a minor mode?, João Távora, 2015/03/28
- Re: electric-pair-mode as a minor mode?, Stefan Monnier, 2015/03/29
- Re: electric-pair-mode as a minor mode?, João Távora, 2015/03/29
- Re: electric-pair-mode as a minor mode?, Stefan Monnier, 2015/03/29
- Re: electric-pair-mode as a minor mode?, João Távora, 2015/03/30
- Re: electric-pair-mode as a minor mode?, Stefan Monnier, 2015/03/30