* Is c-indent-line-or-region already doing the same thing as smart-tabs?
@ 2016-05-15 21:19 john smith
2016-05-18 18:13 ` john smith
0 siblings, 1 reply; 3+ messages in thread
From: john smith @ 2016-05-15 21:19 UTC (permalink / raw
To: help-gnu-emacs
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? Are smart-tabs needed for other other modes
apart from C?
--
<wempwer@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Is c-indent-line-or-region already doing the same thing as smart-tabs?
[not found] <mailman.2860.1463347193.7477.help-gnu-emacs@gnu.org>
@ 2016-05-17 16:09 ` Alan Mackenzie
0 siblings, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2016-05-17 16:09 UTC (permalink / raw
To: help-gnu-emacs
Hello, John.
john smith <wempwer@gmail.com> 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
<CR>. 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.
> --
> <wempwer@gmail.com>
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Is c-indent-line-or-region already doing the same thing as smart-tabs?
2016-05-15 21:19 Is c-indent-line-or-region already doing the same thing as smart-tabs? john smith
@ 2016-05-18 18:13 ` john smith
0 siblings, 0 replies; 3+ messages in thread
From: john smith @ 2016-05-18 18:13 UTC (permalink / raw
To: help-gnu-emacs
Anyone?
--
<wempwer@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-18 18:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-15 21:19 Is c-indent-line-or-region already doing the same thing as smart-tabs? john smith
2016-05-18 18:13 ` john smith
[not found] <mailman.2860.1463347193.7477.help-gnu-emacs@gnu.org>
2016-05-17 16:09 ` Alan Mackenzie
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.