分页: 2 / 2

Re: 用 Emacs 写 C++ 代码的几个问题

发表于 : 2010-04-28 0:45
cuiaoxiang
davyzhu 写了:
sweating 写了:
cuiaoxiang 写了:
sweating 写了:
cuiaoxiang 写了:" in c-mode-base-hook" 也是命令么?
定然不是XD :em06
对啊,所以我想知道写全怎么搞,我都说了现在还不熟悉 elisp,5L 这么指点江山的来一句对我一点帮助也没有啊

代码: 全选

(define-key c-mode-base-map (kbd "<return>") 'newline-and-indent)
;;;;;让我们举杯祝福那些嵌在重重括号里面的精灵罢....... :em09
;;;;上面那句非常重要,有科学研究表明配置文件中出现上面那句能够使得emacs配置起来更加的舒服
不过如果真要学emacs的话,还是考虑看一下SICP为上
否则用起来真不如vim
Read Emacs book and info doc if you want to *use* it. Read SICP if you want to *extend* it (side effect is you will hate elisp and fancy Emacs to be extended by Guile/Scheme).

I recommend "The Little Schemer". TLS is shorter than SICP but show the core design idea of Scheme.

I have written reviews for SICP and TLS.
SICP:http://book.douban.com/review/2322190/
TLS:http://book.douban.com/review/2215327/
你给的那行命令我这里是语法错误 “c-mode-base-map"没有定义
Debugger entered--Lisp error: (void-variable c-mode-base-map)
(define-key c-mode-base-map (kbd "<return>") (quote newline-and-indent))
eval((define-key c-mode-base-map (kbd "<return>") (quote newline-and-indent)))
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp nil nil)

反正自己不懂就是麻烦,可能别人只是一个手误,我就一点办法也没有了,不知道应该是那个变量阿

Re: 用 Emacs 写 C++ 代码的几个问题

发表于 : 2010-04-29 13:14
sweating
cuiaoxiang 写了:
davyzhu 写了:
sweating 写了:
cuiaoxiang 写了:
sweating 写了:
cuiaoxiang 写了:" in c-mode-base-hook" 也是命令么?
定然不是XD :em06
对啊,所以我想知道写全怎么搞,我都说了现在还不熟悉 elisp,5L 这么指点江山的来一句对我一点帮助也没有啊

代码: 全选

(define-key c-mode-base-map (kbd "<return>") 'newline-and-indent)
;;;;;让我们举杯祝福那些嵌在重重括号里面的精灵罢....... :em09
;;;;上面那句非常重要,有科学研究表明配置文件中出现上面那句能够使得emacs配置起来更加的舒服
不过如果真要学emacs的话,还是考虑看一下SICP为上
否则用起来真不如vim
Read Emacs book and info doc if you want to *use* it. Read SICP if you want to *extend* it (side effect is you will hate elisp and fancy Emacs to be extended by Guile/Scheme).

I recommend "The Little Schemer". TLS is shorter than SICP but show the core design idea of Scheme.

I have written reviews for SICP and TLS.
SICP:http://book.douban.com/review/2322190/
TLS:http://book.douban.com/review/2215327/
你给的那行命令我这里是语法错误 “c-mode-base-map"没有定义
Debugger entered--Lisp error: (void-variable c-mode-base-map)
(define-key c-mode-base-map (kbd "<return>") (quote newline-and-indent))
eval((define-key c-mode-base-map (kbd "<return>") (quote newline-and-indent)))
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp nil nil)

反正自己不懂就是麻烦,可能别人只是一个手误,我就一点办法也没有了,不知道应该是那个变量阿
c-mode-map
如果不会Lisp强烈建议用vim入手

Re: 用 Emacs 写 C++ 代码的几个问题

发表于 : 2010-04-29 21:14
cuiaoxiang
请推荐一本书看看吧?您当时学 lisp 看那本书的?

Re: 用 Emacs 写 C++ 代码的几个问题

发表于 : 2010-04-29 23:05
cuiaoxiang
我想问一下:
"c-mode-map" 指的是把 "(define-key c-mode-base-map (kbd "<return>") 'newline-and-indent)" 里面 "c-mode-base-map"
改成 "c-mode-map" 吗?

现在情况是,我依然不能编译那行命令

您一开始给我的那句应该是对的吧?为什么我编译出错呢?看上下文的注释应该是从一个 .emacs 文件里拷贝出来的。

Re: 用 Emacs 写 C++ 代码的几个问题

发表于 : 2010-04-29 23:09
cuiaoxiang
既然我是外行(您不要和我说不懂 elisp 就不要用 emacs 转用 vim 这种话,我只是把它作为一个打字工具,写的内容才是更有技术含量的)
既然您也想帮助别人
就请把前前后后应该有的命令完整的贴出来把,每次来半句术语,最后我还是不能编译

Re: 用 Emacs 写 C++ 代码的几个问题

发表于 : 2010-04-29 23:22
cuiaoxiang
今天有时间网上查了下
http://www.emacswiki.org/emacs/IndentingC
加上 “(require ‘cc-mode)”
然后 “(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)”

Re: 用 Emacs 写 C++ 代码的几个问题

发表于 : 2010-05-17 20:50
A_mu
davyzhu 写了:1. I confront with the same problem that Emacs determine how to indent after I type, my solution is ignore the problem :)
2. It's about face for font lock (you can find more in info elisp)
In my Emacs 23.1, neither first i nor other i change face (their have the default black font color)
不好意思啊!我也是进来学习的,但是我看到你的回复,还是想说:
别在这拽英文了,行不行?我就不相信你英文比中文说得好。这是ubuntu中文论坛。
况且,如果您的英文写得很好懂还成,看看上边的句子,确实有很多語法错误(例如:my solution is to ignore it.),而且生涩,拗口,难懂。
希望,各位牛人,回答问题时候能尽量,实用、切题,最重要的是易懂。这样才能帮助别人。
我不是真对你个人,不好意思。