From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tyler Newsgroups: gmane.emacs.help Subject: Re: Setting auto-indentation of braces Date: Wed, 18 Feb 2009 08:57:14 -0400 Message-ID: <87ocwzhphx.fsf@blackbart.sedgenet> References: <4991527f$0$14913$9b536df3@news.fv.fi> <499936d0$0$14920$9b536df3@news.fv.fi> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1234961930 19705 80.91.229.12 (18 Feb 2009 12:58:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Feb 2009 12:58:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 18 14:00:06 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LZm1r-0008AP-Fg for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Feb 2009 13:59:55 +0100 Original-Received: from localhost ([127.0.0.1]:53347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LZm0X-00074K-Ei for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Feb 2009 07:58:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LZlzw-0006n6-IJ for help-gnu-emacs@gnu.org; Wed, 18 Feb 2009 07:57:56 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LZlzt-0006j9-EK for help-gnu-emacs@gnu.org; Wed, 18 Feb 2009 07:57:55 -0500 Original-Received: from [199.232.76.173] (port=47983 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LZlzt-0006iy-0A for help-gnu-emacs@gnu.org; Wed, 18 Feb 2009 07:57:53 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:45463 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LZlzs-0005Bl-Gz for help-gnu-emacs@gnu.org; Wed, 18 Feb 2009 07:57:52 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LZlzi-0000hG-8R for help-gnu-emacs@gnu.org; Wed, 18 Feb 2009 12:57:43 +0000 Original-Received: from hlfxns0169w-142068221100.pppoe-dynamic.ns.aliant.net ([142.68.221.100]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 18 Feb 2009 12:57:42 +0000 Original-Received: from tyler.smith by hlfxns0169w-142068221100.pppoe-dynamic.ns.aliant.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 18 Feb 2009 12:57:42 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: hlfxns0169w-142068221100.pppoe-dynamic.ns.aliant.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:nbOCw8QCrt0ZZZmTPIisc5bbwB4= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62175 Archived-At: Juha Nieminen writes: > Juha Nieminen kirjoitti: >> In the macosx version this autoindentation is off, and I can't >> figure out where to turn it on. I'm so accustomed to it, that it's >> annoying that it doesn't work... > > > (defun insert-string(s) > (if (re-search-forward "" nil t) > (replace-match s))) > (defun insert-open-curly() (interactive) (insert-string "{")) > (global-set-key "\M-7" 'insert-open-curly) > > Yes, as said, this is a really horrible hack, but with my limited > knowledge of emacs it was the only thing I could come up with. > I couldn't find any other way of "remapping" eg. "\M-7" to the curly > brace. No wonder emacs is not auto-indenting the brace because > I'm completely bypassing the logic behind it. You have remapped M-7 to (insert-string "{"). If you open a file in c-mode, and then enter C-h k { (no spaces), you'll see that the '{' key is actually bound to c-electric-brace, not self-insert. So that's what you should be targeting with your remapping. Tyler -- I'm Tyler Smith and I approve of this email.