[Top][All Lists]

[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: Sat, 28 Mar 2015 21:47:20 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin)

Stefan Monnier <address@hidden> writes:

>> I like my syntax-table to understand to know as much as possible, so
>> that other commands can dwim. Perhaps I'll try a message-mode hack to
>> make blockquotes and smileys comment syntax. That should bring the 90%
>> to 99%...
> Those `)' thingies shouldn't be counted.  There can be many other
> reasons.  Here's another: in message-mode you might have a buffer that
>    > foo far bla (blibli
>    Here's my answer to that.

But this is precisely the use case for the "message mode hack" earlier:
If the following line (I called it a "blockquote" but perhaps it has
another name)

   > foo bar bla (blibli

is seen, in message-mode, has having comment syntax, then you shouldn't
have that problem. If, additionally, smileys and other sporadic
artifacts can also be identified as comments or strings, the situations
you mention should be further reduced.

I haven't tested, because I don't have time to learn about implementing
comment syntaxes right now (I also probably won't if you tell me it's
futile or problematic for some other reason). But anyway in my naive
assessment it should work as well as it already does for programming
modes, where `(' and `)' thingies can exist unpaired in comments and
string literals.

> Again, the parens are not balanced (in this case because the matching
> paren was simply in a part of the message which was omitted).
>> Anyway `electric-pair-local-mode' is now available so people can choose.
> I actually don't want to disable electric-pair-mode in text-modes.
> But I do find it occasionally too optimistic in its assessment of what
> it knows.

Yes, I understand, but what do you suggest? I just hope it's not
changing the default value of `electric-pair-preserve-balance', which I
personally like very much... Why don't you

   (add-hook 'text-mode-hook
     (lambda () (setq-local electric-pair-preserve-balance nil)))

in your configuration?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]