From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Is c-indent-line-or-region already doing the same thing as smart-tabs? Date: Tue, 17 May 2016 16:09:23 +0000 (UTC) Organization: muc.de e.V. Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1464883008 9249 80.91.229.3 (2 Jun 2016 15:56:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2016 15:56:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 02 17:56:47 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b8Uz8-0005a8-6R for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 17:56:38 +0200 Original-Received: from localhost ([::1]:48174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Uz7-0000wr-96 for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 11:56:37 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!news-peer.in.tum.de!news.muc.de!.POSTED.news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Injection-Date: Tue, 17 May 2016 16:09:23 +0000 (UTC) Injection-Info: colin.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="41310"; mail-complaints-to="news-admin@muc.de" User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE (amd64)) Original-Xref: usenet.stanford.edu gnu.emacs.help:217759 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110224 Archived-At: Hello, John. john smith wrote: > In Emacs 24.5.1 is c-indent-line-or-region already doing the same > thing as smart-tabs or do I miss something? As I tried this snippet > from https://www.emacswiki.org/emacs/SmartTabs: > int f(int x, > int y) { > return g(x, > y); > } > I got exactly same result when marking the whole function and pressing > Tab key regardless of smart-tabs-mode state. It seems that > c-indent-line-or-region can add both spaces and tabs on its own. Is > my thinking correct? Sort of, I think. C Mode can certainly add both spaces and tabs when indent-tabs-mode is non-nil. Whether it will do exactly the same as smart-tabs-mode depends on your CC Mode configuration, and possibly your smart-tabs-mode configuration (if that mode can, in fact, be configured). An easy way to get a glimpse of your CC Mode configuration is to put point on a line of text and type C-c C-o. It will prompt you with something like: Syntactic symbol to change: arglist-cont-nonempty . arglist-cont-nonempty is the "syntactic symbol" of the line. Hit . It will tell you that the "offset" for arglist-cont-nonempty is something like: (c-lineup-gcc-asm-reg c-lineup-arglist) . This is a list with two elements, both of which are functions. The CC Mode indentation engine first tries (and fails) #'c-lineup-gcc-asm-reg, then tries (and succeeds with) #'c-lineup-arglist. To find further details of this mechanism, have a look at chapters "Indentation Engine Basics" and "Customizing Indentation", together with their sections and subsections, in the CC Mode manual. > Are smart-tabs needed for other other modes apart from C? That depends entirely on what you want to do. (Sorry for that non-answer - what it really means is "I don't know" ;-). I think the fact that you got the same results in C Mode with smart-tabs-mode enabled and disabled is a bit of a coincidence - CC Mode can certainly be configured to do what smart-tabs-mode says it does. Disclaimer: I know a fair bit about CC Mode, but only came across smart-tabs-mode this afternoon as a result of reading your post. > -- > -- Alan Mackenzie (Nuremberg, Germany).