From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juha Nieminen Newsgroups: gmane.emacs.help Subject: Re: Setting auto-indentation of braces Date: Mon, 16 Feb 2009 11:50:08 +0200 Organization: FINNET customers Message-ID: <499936d0$0$14920$9b536df3@news.fv.fi> References: <4991527f$0$14913$9b536df3@news.fv.fi> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1234806032 27594 80.91.229.12 (16 Feb 2009 17:40:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Feb 2009 17:40:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 16 18:41:48 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 1LZ7TS-0001FP-8F for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Feb 2009 18:41:42 +0100 Original-Received: from localhost ([127.0.0.1]:52965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LZ7S7-0005N0-Nk for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Feb 2009 12:40:19 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!feeder.erje.net!feeder2.news.saunalahti.fi!feeder1.news.saunalahti.fi!nntp.inet.fi!inet.fi!fi.sn.net!newsfeed2.fi.sn.net!news.song.fi!not-for-mail User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) Original-Newsgroups: gnu.emacs.help In-Reply-To: <4991527f$0$14913$9b536df3@news.fv.fi> Original-Lines: 43 Original-NNTP-Posting-Host: 83.102.12.46 Original-X-Trace: 1234777839 news.fv.fi 14920 83.102.12.46:49422 Original-X-Complaints-To: abuse@news.fv.fi Original-Xref: news.stanford.edu gnu.emacs.help:166837 X-Mailman-Approved-At: Mon, 16 Feb 2009 12:39:46 -0500 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:62147 Archived-At: 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... Oh, man... I'm such an IDIOT! *bangs head on wall* You see, Macs have this really weird keyboard configuration for the Finnish keyboard (which I'm using) which is completely different from the PC configuration which I'm accustomed to from well over 10 years. In the PC to get the curly braces you press AltGr+7 and AltGr+0, but on the Mac you have to press Alt+Shift+8 and Alt+Shift+9. Needless to say that this is really awkward to use, and I'm not accustomed to it. Thus I searched for a way in MacOS X to reconfigure this, and I couldn't find any way. (Maybe there is, but I just couldn't find it. So much for the famous "easy to use" OS...) So instead I went and tried to remap these keys in my .emacs instead. I suppose you already guess the reason why those braces were not being auto-indented... The thing is, no matter how much I tried to search info on how to do it, I couldn't find a way to remap keys in .emacs. Or more precisely, I couldn't find a way to make a given key combination be equivalent to pressing some other key. So I invented this really ugly hack to get around the problem: (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. And indeed, if I type the curly brace with Alt+Shift+8 then it gets properly auto-indented. I suppose my question is: What is the proper way of remapping keys, which will not bypass any auto-indenting routines?