From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Tabs and Spaces Date: Mon, 25 May 2009 13:48:25 +0200 Organization: Anevia SAS Message-ID: <7chbz9bdyu.fsf@pbourguignon.anevia.com> References: <77vbbiF1jhhubU1@mid.individual.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1243256430 12955 80.91.229.12 (25 May 2009 13:00:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 May 2009 13:00:30 +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 May 25 15:00:23 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 1M8Zmv-0008TE-Hh for geh-help-gnu-emacs@m.gmane.org; Mon, 25 May 2009 15:00:21 +0200 Original-Received: from localhost ([127.0.0.1]:51318 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M8Zmv-0002xx-0g for geh-help-gnu-emacs@m.gmane.org; Mon, 25 May 2009 09:00:21 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp16-1.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:ODU3ZmQwMTg1Zjg4OGVkNTU2ODgyMjYyNzZjZDdmZTI1NDkxZGE4Mg== Original-Lines: 38 Original-NNTP-Posting-Date: 25 May 2009 13:48:25 MEST Original-NNTP-Posting-Host: 88.170.236.224 Original-X-Trace: 1243252105 news-3.free.fr 29465 88.170.236.224:43759 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:169451 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:64686 Archived-At: use.address@my.homepage.invalid (Chris Gordon-Smith) writes: > Hello All > > I have recenly started using emacs for programming, after years using > KDevelop. One problem I have is indenting code. I have my own indentation > style. and ideally I would like to setup emacs to support it automatically. > However, in the short term I'll settle for having emacs convert a TAB > keypress into the correct number of spaces to fill whitespace up to the > next tabstop. > > At the moment I have > > (global-set-key (kbd "TAB") 'self-insert-command) > > in my .emacs to force insertion of a tab, but I have to keep invoking > untabify manually (otherwise my code looks misaligned when I upload it to > Google Code). > > Can anyone help. You shouldn't insert TAB, this is very bad. At the very least, you may compute the number of spaces you need to insert and insert them rather. But depending on the language you use, a different mode will be used to edit your source and each mode may provide its own indenting rules. In the case of Lisp, you may add a indent-function property to the plist of the operator name. In the case of C, you may customize the variable: c-offsets-alist. See also: c-style-alist ; perhaps there's already a style defined that you'll like. -- __Pascal Bourguignon__