From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Tony Harbin Newsgroups: gmane.emacs.help Subject: Re: automatic indentation in C,C++ modes Date: Fri, 19 Apr 2002 12:30:46 -0500 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <3CC05446.50EEB4AD@hiwaay.net> References: <3CB7662B.82AA21D9@hiwaay.net> <3CBB052E.4B5C6FAB@hiwaay.net> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1019237877 28071 127.0.0.1 (19 Apr 2002 17:37:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 19 Apr 2002 17:37:57 +0000 (UTC) Cc: Greg Hill , help-gnu-emacs@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16ycKa-0007Ie-00 for ; Fri, 19 Apr 2002 19:37:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16ycJu-0000Yu-00; Fri, 19 Apr 2002 13:37:14 -0400 Original-Received: from sed04.sed.redstone.army.mil ([136.205.12.4]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16ycIe-0000V3-00 for ; Fri, 19 Apr 2002 13:35:56 -0400 Original-Received: from hiwaay.net (dh900-249.sed.redstone.army.mil [136.205.148.246]) by sed04.sed.redstone.army.mil (PMDF V6.0-24 #41095) with ESMTP id <01KGQXS3460000009E@sed04.sed.redstone.army.mil>; Fri, 19 Apr 2002 12:35:57 -0500 (CDT) Original-To: Greg Hill X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:116 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:116 No go. I've inserted these commands into my .emacs file, but still, when I type a "(", the line gets re-indented. Also, when I do a "C-h k (", the key is still described as running c-electric-paren. I had this behavior turned off in an older version on Solaris, but the methods that I used there no longer work. The best solution would be to remap the '(', '{', ':', and '/' keys to simple self-insert-command functions. I have a particular indentation style that is common where I work and I *hate* some software trying to enforce it's own style. Any other suggestions? Thanks in advance. Greg Hill wrote: > Tony, > > It just takes more of the same, e.g.: > > (add-hook 'c-mode-hook > (function (lambda () > (substitute-key-definition > 'c-indent-command 'self-insert-command c-mode-map) > (substitute-key-definition > 'c-electric-paren 'self-insert-command c-mode-map)))) > > M-x apropos > c-electric > > will give you a list of all the c-electric- commands. Just use > substitute-key-definition in your c-mode-hook and c++-mode-hook > lambdas to replace any of them that you don't want with > self-insert-command. If you want to keep the automatic indentation > performed by the TAB key and ditch only the "electric" stuff, then > just leave the substitution for c-indent-command out of your lambdas. > > --Greg > > At 11:51 AM -0500 4/15/02, Tony Harbin wrote: > >Not quite. C/C++ mode binds open-paren, open-brace, colon, and slash (among > > > >others) to "electric" functions that, when the key is typed, automatically > >change > >the spacing and/or indentation on the line. I would like to > >disable/override/turn off this behavior. I was able to do this in an older > >version where I had to explicitly load the C/C++ mode modules, but in my > >current version (20.7.1), the stuff was already compiled in and the same > >tricks no longer work. > > > >Basically, I would just like those keys above to just self-insert and not > >run the > >"electric" functions. Is there a way to do this? > > _______________________________________________ > Help-gnu-emacs mailing list > Help-gnu-emacs@gnu.org > http://mail.gnu.org/mailman/listinfo/help-gnu-emacs