all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: emacs-devel@gnu.org
Subject: Fwd: [patch] make electric-pair-mode smarter/more useful
Date: Mon, 16 Dec 2013 19:02:57 +0000	[thread overview]
Message-ID: <CALDnm51=BDxNB4VzLg4-oLiVu7igb8qWapDaDirZTHiP046fEQ@mail.gmail.com> (raw)
In-Reply-To: <CALDnm52AoShN891-L9=Cbng98UtYPEntzO+n_XDMmEL+UV0r-A@mail.gmail.com>

On Mon, Dec 16, 2013 at 3:30 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>>        With ""foo""bar", try input " at point 1. Should become """"foo""bar" and point at 2
> Why should it become """"foo""bar"?

Mind you, don't confuse the docstring's quotes with the quotes in the
fixture text. The fixture is

  "foo" "bar

Which I (and font-lock) interpret as one perfectly terminated string
followed by an unterminated string.

So typing a quote at the very beginning should make it autopair IMO,
so that you get.

  """foo" "bar

Which is a perfectly terminated empty string, followed by the original fixture's
terminated and unterminated strings.

>> - "always" or "never" (depending on whether it's pair or skip)
>> - "balance, maybe"    (the default we're discussing)
>> - "balance, always"
>> - "don't balance, be conservative"
> Not sure what the "balance, always" refers to or why we need it, but
> other than that, yes.  The "balance" entry will be a "balance maybe".

Yes, it's silly probably.

"balance, always" would be "balance without depending on
electric-pair-preserve-balance.
"balance, maybe" would be "balance, but depending on
electric-pair-preserve-balance.".

You want me to strike "balance, always" and keep only "balance, maybe",
renamed as as "balance", right?

> That's different: this `or' test is to distinguish between two different
> notions of "interactively" (i.e. whether the user interactively
> triggered this specific function, vs whether the function was called
> using call-interactively).

Oh OK, I read the docstring in diagonal and didn't test much. But that
docstring might be a little confusing...

> Maybe, maybe not (it probably depends on the specific case), but since
> it's very rarely called from Lisp, I think we'd better not worry about
> it until someone reports an actual problem with it.

Then (newline 1 t) it is!

>>>> +(put 'electric-pair-post-self-insert-function   'priority  20)
>>>> +(put 'electric-layout-post-self-insert-function 'priority  40)
>>>> +(put 'electric-indent-post-self-insert-function 'priority  60)
>>>> +(put 'blink-paren-post-self-insert-function     'priority 100)
>>> These belong next to the corresponding functions.
>> Do they? The relative order is between them,
> The whole point of using priorities is to make them not depend on each
> other but on some external total order.

But in the end they do depend directly on each other. OK, you can
make it generic and say this one gets 20 because it inserts and deletes
characters, this other one gets 40 because it inserts extra newlines,
that 60 because something, and this one gets 100 because it does the
sit-for. But developing this theory for now seemed like overkill to me,
and without it would appear to the reader that ETOOMANYWORDS.

OK I'll do it.

>> In js-mode layout rules, pairing must come before layout, there's a test
>> for that.
> Do you know the underlying reason why the test fails if you do it the
> other way around?

I don't remember anymore, but its very easy to reproduce if you scratch
the sort function and write an additional test with the order of minor modes
reversed. Then I can check. I don't have emacs handy now.

Hoping this message isn't too garbled by the gmail interface,
João



      parent reply	other threads:[~2013-12-16 19:02 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
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                     ` João Távora [this message]

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='CALDnm51=BDxNB4VzLg4-oLiVu7igb8qWapDaDirZTHiP046fEQ@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.