unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: Daniel Colascione <danc@merrillprint.com>
Cc: emacs-devel@gnu.org
Subject: Re: Electric indentation (Was: Re: js.el changes)
Date: Fri, 21 Aug 2009 18:42:16 +0200	[thread overview]
Message-ID: <e01d8a50908210942s655e208ds947fbb58038ffe57@mail.gmail.com> (raw)
In-Reply-To: <200908211235.44988.danc@merrillprint.com>

On Fri, Aug 21, 2009 at 6:35 PM, Daniel Colascione<danc@merrillprint.com> wrote:
> 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.


Yes, you are right, we were talking past each other. I see now how you
mean. (But maybe a globalized minor mode would be better?)

I do not know which way is the best. Using a function instead would
make it possible to define common default behaviour, but I do not know
if it is useful.




      reply	other threads:[~2009-08-21 16:42 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
2009-08-21 16:42       ` Lennart Borgman [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

  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=e01d8a50908210942s655e208ds947fbb58038ffe57@mail.gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=danc@merrillprint.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 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).