分页: 1 / 1

emacs的自动补齐的问题

发表于 : 2009-03-25 21:03
laoli_no1
我最近从win下转移到linux,做单片机开发的,用emacs写代码,关于自动补齐,查了很多资料,也都按照网上的教程试了很多方法,总是不成功,不知道这个自动补齐是不是一定要编译以后才能完成?
比如说,我在单个文件里定义了一个

代码: 全选

struct A
{ 
  unsigned int b;
  unsigned int c;
};
在变量定义为 struct A 以后想补齐其中的b和c, 不编译是不是不行阿?

另外,emacs可不可以让代码中的变量也改变颜色阿?就像win下面大部分的IDE那样。

Re: emacs的自动补齐的问题

发表于 : 2009-03-26 7:52
zhou3345
看的不是太明白,你用的是什么补齐方式?

我一直用的是万能的tab,也不知道是不是兄弟想要的自动补齐。

http://code.google.com/p/yasnippet/

Re: emacs的自动补齐的问题

发表于 : 2009-03-26 12:25
laoli_no1
找到问题了,我的一个配置C格式的出问题了,呵呵,网上的方法还是蛮有效果的,多谢楼上的指点

话说,没有办法让变量都改变颜色阿?就像win下的IDE基本都可以的那种

Re: emacs的自动补齐的问题

发表于 : 2009-03-28 15:42
anewbie
laoli_no1 写了:找到问题了,我的一个配置C格式的出问题了,呵呵,网上的方法还是蛮有效果的,多谢楼上的指点

话说,没有办法让变量都改变颜色阿?就像win下的IDE基本都可以的那种
.

That's easy.

You could customize "font-lock-variable-name-face" to get whatever you want.

Re: emacs的自动补齐的问题

发表于 : 2009-03-28 22:21
laoli_no1
能不能说的稍稍详细一点?我在网上搜了一下,还是不得要领

Re: emacs的自动补齐的问题

发表于 : 2009-03-29 9:24
anewbie
laoli_no1 写了:能不能说的稍稍详细一点?我在网上搜了一下,还是不得要领
M-x customize-face --> font-lock-variable-name-face <RET> --> In the Customize face buffer, you can set it to any style you like --> Click "Set for current session", then "Save for future sessions", final "Exit"

That's all.

Re: emacs的自动补齐的问题

发表于 : 2009-03-30 9:48
laoli_no1
我用了color-theme的配色方案,和这个有冲突么?

一堆选项看得我头晕,有没有直接写在.emacs文件里的配置阿?

Re: emacs的自动补齐的问题

发表于 : 2009-03-30 11:45
anewbie
laoli_no1 写了:我用了color-theme的配色方案,和这个有冲突么?
As I know, no.
But order is important, the previous one will be overwritten.
一堆选项看得我头晕
Did you see the option "Foreground"?
有没有直接写在.emacs文件里的配置阿?
"Save for future sessions" would save your choice in your .emacs file automatically.

Re: emacs的自动补齐的问题

发表于 : 2009-03-30 14:07
laoli_no1
多谢楼上的帮助,照你的方法尝试了一下,不过你好像误会我的意思了
我的意思是,比如我定义

代码: 全选

unsigned char a;

void main(void)
{
a = 0;

for(;;);
}

第一个a会变颜色,但是第二个a不会

能不能让第二个a也变颜色阿

Re: emacs的自动补齐的问题

发表于 : 2009-03-31 13:56
anewbie
laoli_no1 写了:多谢楼上的帮助,照你的方法尝试了一下,不过你好像误会我的意思了
我的意思是,比如我定义

代码: 全选

unsigned char a;

void main(void)
{
a = 0;

for(;;);
}

第一个a会变颜色,但是第二个a不会

能不能让第二个a也变颜色阿
There is no simply method to support that, but you can use the interface of semantic package to implement it. It's not difficult, but you should know both elisp and semantic package well. If not, it would be time-consuming.

Re: emacs的自动补齐的问题

发表于 : 2009-03-31 16:56
laoli_no1
呃,那还是算了吧
有人说为了emacs去学elisp纯粹是买椟还珠~~
多谢

多嘴一句,为什么楼上总是用英文呢?