emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs pretest -- electric-pair-mode change


From: João Távora
Subject: Re: Emacs pretest -- electric-pair-mode change
Date: Fri, 11 Apr 2014 17:08:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (windows-nt)

Kevin Rodgers <address@hidden> writes:
> On 4/3/14 11:33 AM, Stefan Monnier wrote:
>> If we agree that using (point-max) is a bad idea, then the only other
>> option is to try and find some other spot in the buffer (and after
>> point) which is somehow known to be "outside of a string", and in
>> general we don't know how to find such a thing (point-max is the only
>> one we know in general).  Hence electric-pair-string-bound-function
>> (or give up on this idea and do something different).
>
> Would replacing (+ (point) <constant>) with (window-end) give reliable
> behavior, from the user's perspective?  If the extra " is not visible,
> it would not impact the result.

I remember considering this idea, and then abandoning it. I can't
remember the reasoning any more :-), but I think it went along the lines
of "It's possibly nice when (window-end) lands me outside a string, but
what if it lands me inside one? Should I assume the buffer is
quote-unbalanced and not autopair the quote? Should I check if that
window-end-crossing string is terminated? In general it will always be
even if by some other unbalanced quote. So if I do that it's just as
slow and also harder to predict.".

All in all think I prefer the current behaviour, which, by default, only
asserts that (point-max) is outside a string for sure. Here's a related
argument I've made before: If the user has left an unbalanced string far
away down the buffer (i.e. unbalancing starts there), there might be
some disappointment to not seeing the current quote being inserted pair,
but then it's also a warning that something is wrong with the quote
balance somewhere down. The warning comes from not only seeing the quote
not be autopaired but also from the strange fontification that ensues.

João




reply via email to

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