unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: joaotavora@gmail.com (João Távora)
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Kevin Rodgers <kevin.d.rodgers@gmail.com>, emacs-devel@gnu.org
Subject: Re: Emacs pretest -- electric-pair-mode change
Date: Sat, 12 Apr 2014 01:42:06 +0100	[thread overview]
Message-ID: <87y4zbqsyp.fsf@kitaj.lan> (raw)
In-Reply-To: <jwvzjjrodcf.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 11 Apr 2014 15:58:40 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Re-reading Kevin's message I think there are two separate things here:
>
>> * deciding if the buffer is quote-balanced for pairing purposes. That
>>   can indeed only be done according to your idea Stefan, i.e. finding a
>>   safe spot the we assert to be outside a string.
>
>> * after having obtained reliable info that the buffer is unbalanced, we
>>   can further decide if we want to surprise/disappoint the user. This
>>   might be argued I think: if we know that there is an unbalance but
>>   that it is outside the users view, decide to pair anyway.  If it is in
>>   the user's view, try to repair the unbalance by not pairing (this
>>   second bit is what is already done)
>
>> I don't know if I personally would like it, perhaps it can be a
>> customization option.
>
> For strings, if we know that position POS, which should be outside of
> a string, is inside a string, we know that there's an imbalance.  *But*
> we don't actually know where that imbalance comes from (it's just
> "somewhere before POS"), so we can't really tell if that imbalance is
> before or after window-end unless POS is itself before window-end.

I think you're right. But if there is unbalance and one of the following
is true:

* the first non-string position searching backwards from (window-end)
  downto (point) is sucessfully asserted to be outside a string, or

* there are no strings at all between (point) and window end (basically
  implies the previous point).

then I think it is doable, i.e. there is a case for autopairing despite
the unbalance. Not sure how useful, though. Needs prototyping, and I'm
not super-motivated to do it right now.

João



  reply	other threads:[~2014-04-12  0:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CADWZ7fJCws0SO1hEn38CpbRMq+Uw397uCFUnA=YJvOaLVEA8UQ@mail.gmail.com>
2014-03-31 13:27 ` Emacs pretest Stefan Monnier
2014-03-31 13:52   ` Bastien
2014-03-31 14:36   ` Tassilo Horn
2014-03-31 15:55   ` João Távora
2014-03-31 16:34     ` Stefan Monnier
2014-04-02 10:11       ` Emacs pretest -- electric-pair-mode change João Távora
2014-04-02 12:58         ` Stefan Monnier
2014-04-02 17:21           ` João Távora
2014-04-02 22:58             ` Stefan Monnier
2014-04-03 11:06               ` João Távora
2014-04-03 14:22                 ` Stefan Monnier
2014-04-03 16:56                   ` João Távora
2014-04-03 17:33                     ` Stefan Monnier
2014-04-03 20:11                       ` João Távora
2014-04-03 20:54                         ` Stefan Monnier
2014-04-04  8:08                           ` João Távora
2014-04-04 12:53                             ` Stefan Monnier
2014-04-04 23:31                               ` João Távora
2014-04-05 15:29                                 ` Stefan Monnier
2014-04-07  7:43                                   ` João Távora
2014-04-07 14:04                                     ` Stefan Monnier
2014-04-04  7:53                         ` Eli Zaretskii
2014-04-04  9:49                           ` João Távora
2014-04-11 14:42                       ` Kevin Rodgers
2014-04-11 15:53                         ` Stefan Monnier
2014-04-11 18:23                           ` João Távora
2014-04-11 19:58                             ` Stefan Monnier
2014-04-12  0:42                               ` João Távora [this message]
2014-04-11 16:08                         ` João Távora
2014-04-03 19:13                   ` Eli Zaretskii
2014-04-03 12:15             ` Dmitry Gutov
2014-04-03 13:43               ` João Távora
2014-04-03 15:24                 ` Stefan Monnier
2014-04-03 14:24               ` Stefan Monnier
2014-04-01 15:15   ` Emacs pretest Dmitry Antipov
2014-04-01 16:36     ` Dmitry Antipov
2014-04-02 12:37       ` Stefan Monnier
2014-04-01 20:50   ` Stephen Berman

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4zbqsyp.fsf@kitaj.lan \
    --to=joaotavora@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=kevin.d.rodgers@gmail.com \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).