From: joaotavora@gmail.com (João Távora)
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: [patch] make electric-pair-mode smarter/more useful
Date: Sat, 07 Dec 2013 21:01:30 +0000 [thread overview]
Message-ID: <87fvq49xzp.fsf@gmail.com> (raw)
In-Reply-To: <87d2l9wfne.fsf@yandex.ru> (Dmitry Gutov's message of "Sat, 07 Dec 2013 04:36:53 +0200")
Dmitry Gutov <dgutov@yandex.ru> writes:
> Autobackspacing two adjacent parens sounds good.
How should one approach this in electric.el? Should a hook be added to
`backward-delete-char-untabify`? Should this be included in the
`electric-layout-mode' somehow?
> I'm also partial to the `autopair-newline' feature. It would probably
> serve best as an extension of `electric-layout-mode'.
Yes, I agree that `electric-layout-mode' seems the place for this, but
how to write these rules in the existing `electric-layout-rules' var? It
seems a little too rigid, I couldn't make much sense of it.
(add-to-list 'electric-layout-rules
`(,(aref "\n" 0) . electric-layout-in-between-parenthesis))
(defun electric-layout-in-between-parenthesis ()
(save-excursion
(skip-chars-backward " \t\n")
(backward-char)
(when (looking-at "([ \t\n]*)")
'after)))
But it didn't really work... inserting "\n" between "()" leaves point
after the two newlines, not inside as intended. It would need to return
'after-then-back or something. Also, an undo after this doesn't restore
the "()" state... In general, looking at the code and reading the
comments, this might need to be enhanced considerably.
Also, regarding the autowrapping feature already found in electric.el's
electric-pair-mode
- I found (and reported) a bug when using cua-mode with it
- both openers and closers should cause a wrap (currently only
openers do). A closer should move point to after the wrapping.
- additionally one should be able to customize if points ends up
inside or outside the wrapped region.
next prev parent reply other threads:[~2013-12-07 21:01 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 [this message]
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 ` Fwd: " João Távora
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=87fvq49xzp.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=dgutov@yandex.ru \
--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.