From: Daniel Colascione <danc@merrillprint.com>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Electric indentation (Was: Re: js.el changes)
Date: Fri, 21 Aug 2009 12:35:44 -0400 [thread overview]
Message-ID: <200908211235.44988.danc@merrillprint.com> (raw)
In-Reply-To: <e01d8a50908210930l5677cb86jb63c21632b1ac1a3@mail.gmail.com>
On Friday 21 August 2009, you wrote:
> On Fri, Aug 21, 2009 at 6:28 PM, Daniel Colascione<danc@merrillprint.com> wrote:
> > On Friday 21 August 2009, you wrote:
> >> Maybe it could be done similar to indent-line-function etc?
> >
> > Err, how do you mean? Different electric keys require different behavior in different modes. One variable can't be used to dispatch to all these various pieces of code. You could have electric-indentation-mode call a mode-specific function that decides what to do with a given electric key, but isn't that just reimplementating the keymap mechanism?
>
>
> It allows you to have a minor mode to toggle the behaviour.
I feel like we're talking past each other. Right now, a mode like js-mode or cc-mode binds keys that are supposed to be electric to a mode-specific function. Let's use cc-mode as an example: it binds { to c-electric-brace. c-electric-brace runs self-insert-command and checks whether the variable c-electric-flag is true. If it is, it performs some specific indentation operations.
My proposal is to create a new globalized minor mode called electric-indentation-mode. An electric insert function like c-electric-brace, instead of checking a mode-specific flag, would instead check the value of the variable electric-indentation-mode. That way, the user can use one interface to enable or disable electric indentation for all supported modes at once.
next prev parent reply other threads:[~2009-08-21 16:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87y6plkhj6.fsf@stupidchicken.com>
2009-08-21 16:18 ` Electric indentation (Was: Re: js.el changes) Daniel Colascione
2009-08-21 16:22 ` Lennart Borgman
[not found] ` <200908211228.17606.danc@merrillprint.com>
[not found] ` <e01d8a50908210930l5677cb86jb63c21632b1ac1a3@mail.gmail.com>
2009-08-21 16:35 ` Daniel Colascione [this message]
2009-08-21 16:42 ` Lennart Borgman
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=200908211235.44988.danc@merrillprint.com \
--to=danc@merrillprint.com \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
/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.