From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: kala Newsgroups: gmane.emacs.help Subject: Re: indent-according-to-mode Date: Wed, 2 Aug 2006 04:39:31 -0700 (PDT) Message-ID: <5612101.post@talk.nabble.com> References: <87irldwrgn.fsf@localhost.localdomain> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1154518790 31702 80.91.229.2 (2 Aug 2006 11:39:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 2 Aug 2006 11:39:50 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 02 13:39:50 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G8F4l-0005xp-06 for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Aug 2006 13:39:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G8F4k-00028o-I2 for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Aug 2006 07:39:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G8F4Y-00027t-1f for help-gnu-emacs@gnu.org; Wed, 02 Aug 2006 07:39:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G8F4X-00027h-Kj for Help-gnu-emacs@gnu.org; Wed, 02 Aug 2006 07:39:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G8F4X-00027e-Ef for Help-gnu-emacs@gnu.org; Wed, 02 Aug 2006 07:39:33 -0400 Original-Received: from [72.21.53.35] (helo=talk.nabble.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G8F7d-0005aG-Pg for Help-gnu-emacs@gnu.org; Wed, 02 Aug 2006 07:42:45 -0400 Original-Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1G8F4V-0002z2-Jz for Help-gnu-emacs@gnu.org; Wed, 02 Aug 2006 04:39:31 -0700 Original-To: Help-gnu-emacs@gnu.org In-Reply-To: <87irldwrgn.fsf@localhost.localdomain> X-Nabble-Sender: p_andakarhu@hotmail.com X-Nabble-From: kala 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:36414 Archived-At: Hi Gary Wessle-2. I'm writing Linux kernel level c-code, and thus have to use Linux kernel indentation (8 characters.) I'm using GNU Emacs 21.4.1, and the following works for me. Write in the .emacs-file: ;; use Linux kernel style (indendation of 8 characters etc.) for all C like languages. (defun my-c-mode-common-hook () (c-set-style "linux")) ;; Add a hook to common mode. (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) ;; Bind F5-key to indent a region of code according to the current indentation style (global-set-key [f5] 'indent-region) Now in emacs you can indent a region by moving to the beginning of the region and pressing CTRL + SPACE and then moving to the end of the region and pressing F5. Following indentation styles are available: bsd, cc-mode, ellemtel, gnu, java, k&r, linux, python, stroustrup, user, whitesmith. Hope this was a useful piece of advice to you. -- View this message in context: http://www.nabble.com/indent-according-to-mode-tf2029327.html#a5612101 Sent from the Emacs - Help forum at Nabble.com.