From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: Electric indentation (Was: Re: js.el changes) Date: Fri, 21 Aug 2009 18:22:58 +0200 Message-ID: References: <87y6plkhj6.fsf@stupidchicken.com> <200908211218.28208.danc@merrillprint.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1250871819 30688 80.91.229.12 (21 Aug 2009 16:23:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Aug 2009 16:23:39 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 21 18:23:32 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MeWtl-0003VX-Ng for ged-emacs-devel@m.gmane.org; Fri, 21 Aug 2009 18:23:30 +0200 Original-Received: from localhost ([127.0.0.1]:57421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeWtl-0006o0-0b for ged-emacs-devel@m.gmane.org; Fri, 21 Aug 2009 12:23:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeWtg-0006nY-3g for emacs-devel@gnu.org; Fri, 21 Aug 2009 12:23:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeWtb-0006mT-Ex for emacs-devel@gnu.org; Fri, 21 Aug 2009 12:23:23 -0400 Original-Received: from [199.232.76.173] (port=60795 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeWtb-0006mQ-Cg for emacs-devel@gnu.org; Fri, 21 Aug 2009 12:23:19 -0400 Original-Received: from mail-yx0-f172.google.com ([209.85.210.172]:48902) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MeWtb-0002I8-70 for emacs-devel@gnu.org; Fri, 21 Aug 2009 12:23:19 -0400 Original-Received: by yxe2 with SMTP id 2so282896yxe.14 for ; Fri, 21 Aug 2009 09:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=AnAPc1HbC1ulbFMPpL6hoSXt9BkDYzdkKrn07XNQFNU=; b=GRyovKXDwOQBcT86jVoskDiWNbuxPreeA5zFg5oJBlZbIAnxYm8J6ukI0bk0FcrxRT zKdBqfjXkNFxi7lp5SOO0N4IMskg+ElOtHIGXT/5OskjPBnLXeWNO9mCcS2l0BVxV8/M 2n0dFxOMGIco/FGdii9O5F/GJxMDFwXfk1B+0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=nPS1o8HP01ClB7iGkRCahl9BbHsLRKcgvISsi5fRLNvQWCbeMyZRRRZxMxwT+mzDUS BIedgmUqMdVx5a96F4gtcurFflLgTqEtcNjAqAGKJcA11coTX4wJu7CeL9NUzxK9AaFT eLtENXWrLsh7V0QzebKSBswsajj7yNObA7OdU= Original-Received: by 10.100.18.15 with SMTP id 15mr1302794anr.48.1250871798172; Fri, 21 Aug 2009 09:23:18 -0700 (PDT) In-Reply-To: <200908211218.28208.danc@merrillprint.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114479 Archived-At: On Fri, Aug 21, 2009 at 6:18 PM, Daniel Colascione w= rote: > On Friday 14 August 2009, you wrote: >> 4. I removed the "electric indentation" feature implemented by >> js-auto-indent-flag and js-insert-and-indent. =C2=A0I appreciate the int= ent, >> but it's not consistent with the way the other programming modes work, >> and this behavior should be implemented separately---as a minor mode >> that can be used generally. =C2=A0Feel free to suggest this on emacs-dev= el. > > I agree that a generic toggle switch for electric indentation would be ni= ce. However, there's quite a bit of precedent for modes implementing their = own electric indentation, often using complex logic (see c-electric-brace). > > To me, the simplest option would be to create a new trivial minor mode, e= lectric-indentation-mode, and modify all current mode-specific indentation = code to check that mode's flag instead of relying on something mode-specifi= c like js-auto-indent-flag or c-electric-flag. The actual mode-specific ind= entation can survive otherwise unchanged. Maybe it could be done similar to indent-line-function etc?