3
如何讓emacs縮進當前的續行(例如點或間接運算符後)比前一級更深一級?關於哪一個更漂亮的爭論在這裏是無關緊要的,因爲這是我們在工作中使用的風格,所以我沒有真正的選擇。Emacs爲每個續行縮進一個額外的級別
我猜這是一個偏移量(也許statement-cont
?),但我不知道如何動態地那樣做......
相關:How to control indentation after an open parenthesis in Emacs
有
#include <stdio.h>
struct thing {
int the_first_piece_of_data;
};
struct stuff {
struct thing the_first_thing_in_this_stuff;
struct thing *pointer_to_the_first_thing_in_this_stuff;
};
int main(int argc, char *argv[])
{
struct stuff some_stuff_to_work_with;
struct stuff *pointer_to_stuff = &some_stuff_to_work_with;
some_stuff_to_work_with.
pointer_to_the_first_thing_in_this_stuff =
&(some_stuff_to_work_with.
the_first_thing_in_this_stuff);
some_stuff_to_work_with.
the_first_thing_in_this_stuff.
the_first_piece_of_data = 42;
printf("The piece of data is => %d\n",
some_stuff_to_work_with.
the_first_thing_in_this_stuff.
the_first_piece_of_data);
pointer_to_stuff->
pointer_to_the_first_thing_in_this_stuff->
the_first_piece_of_data++;
printf("The piece of data is => %d\n",
pointer_to_stuff->
pointer_to_the_first_thing_in_this_stuff->
the_first_piece_of_data);
return 0;
}
想
#include <stdio.h>
struct thing {
int the_first_piece_of_data;
};
struct stuff {
struct thing the_first_thing_in_this_stuff;
struct thing *pointer_to_the_first_thing_in_this_stuff;
};
int main(int argc, char *argv[])
{
struct stuff some_stuff_to_work_with;
struct stuff *pointer_to_stuff = &some_stuff_to_work_with;
some_stuff_to_work_with.
pointer_to_the_first_thing_in_this_stuff =
&(some_stuff_to_work_with. /*exra indent*/
the_first_thing_in_this_stuff);
some_stuff_to_work_with.
the_first_thing_in_this_stuff.
the_first_piece_of_data = 42; /*exra indent*/
printf("The piece of data is => %d\n",
some_stuff_to_work_with.
the_first_thing_in_this_stuff. /*exra indent*/
the_first_piece_of_data); /*exra indent*/
pointer_to_stuff->
pointer_to_the_first_thing_in_this_stuff->
the_first_piece_of_data++; /*exra indent*/
printf("The piece of data is => %d\n",
pointer_to_stuff->
pointer_to_the_first_thing_in_this_stuff-> /*exra indent*/
the_first_piece_of_data); /*exra indent*/
return 0;
}
嘿,特雷,我只是想說說閱讀你的答案總是很高興! – Thomas 2011-05-18 19:23:40