Ted's Blog

Happy coding


Ted posted @ 2008年9月16日 22:36 in emacs with tags emacs , 4564 阅读


    emacs配置文件的文件名为“.emacs.el“或“.emacs“。它们通常位于计算机的 $HOME 目录,如果是MS Windows (Windows 2000, Windows XP以上),默认是 c:\Documents and Settings\username\Application Data\,这个适用于 Emacs22 以上的版本。Emacs21 默认的 $HOME 目录在 C:\ 。当然也可以通过环境变量 $HOME 重新设置,总之在比较大众化的操作系统中,你都可以通过C-x C-f ~/.emacs 来编辑您的个性化配置文件。


1. 只有当插件被 emacs 成功加载了,我们才能使用该插件提供的函数

2. (require 'ecb):该函数首先会判断插件是否已经被加载,如果没有,则使用 load 函数来从 lisp目录中加载插件


  1. 键位映射图:多个按键绑定构成的一个集合。Emacs中有两类映射图:(1).全局影射图:对所有模式的编辑缓冲区都起作用的按键映射图 (2).局部映射图:对具体的编辑模式起作用的映射图。例如:c模式、文本模式等。当按下某个按键时,Emacs会首先查看当前编辑缓冲区的局部映射图里有没有对它进行定义。如果没有,就会查找全局映射图。如果找到了与按键对应的定义项,那么按键关联的命令就会被执行。
  2. 如果自定义的快捷键与系统中默认的快捷键冲突,则系统中默认的快捷键将会被替换


(1).(define-key keymap "keystroke" 'command-name):将快捷键定义保存到指定的keymap中
(2).(global-set-key "keystroke" 'command):只能将快捷键定义保存到全局keymap射图中
(3).(local-set-key "keystroke" 'command-name):只能将按键绑定到局部映射图中。每种编辑模式都对应了一张局部映射图。



(setq auto-save-interval 800)


a. 数据类型

  1. t:true
  2. nil:false
  3. 字符串:使用""括起来
  4. 字符:以?开头。例如:?x代表字符x
  5. 标志符:以'开头。例如:表示函数名时使用‘command-name


b. 函数的定义


(defun my-cpp-mode()

(define-key c++-mode-map [return] 'newline-and-indent)

(define-key c++-mode-map [(control c) (c)] 'compile)


(c-set-style "K&R")



(setq c-basic-offset 4)




c. 常用函数

  1. add-hook:该函数用来将某个函数与指定的模式绑定,当emacs进入相应的模式时,将自动调用与该模式绑定的函数。例如:(add-hook 'c++-mode-hook 'my-cpp-mode)
  2. require:该函数检测在当前emacs会话中是否加载了指定的插件,如果没有,则使用load函数来从系统的LISP目录中加载指定的插件。例如:(require 'session):从lisp-path中加载session.el文件


  1. emacs编辑器的主要功能是使用LISP编程语言来写的,因此我们可以往emacs中加载LISP包来为emacs添加更多的功能。LISP语言是一种解释型语言,其程序文件的扩展名为*.el。
  2. c-h p:查看当前emacs会话所加载的LISP包
  3. 在".emacs“文件中使用require函数来加载指定的LISP包。例如:(require 'session):加载session包
  4. *scratch*缓冲区可以用来进行LISP代码的测试。首先,将LISP语句复制到该缓冲区中,然后将光标移动LISP语句的末尾,最后,使用C-x C-e来执行该LISP语句
  5. 系统默认的LISP包的目录为:“/usr/share/emacs/site-lisp”。安装LISP包时只需要将其复制到该目录下即可。
https://royalcbd.com 说:
2020年4月08日 16:28

You made a number of nice points there. I did a hunt on the theme and found mainly persons can believe your blog.

https://thegeneralin 说:
2020年4月09日 17:16

i would love to see a massive price drop on internet phones coz i like to buy lots of em,

The Linq At Beauty W 说:
2020年6月14日 17:16

Nice post. I discover something harder on different blogs everyday. Most commonly it is stimulating to read content off their writers and employ something from their site. I’d want to apply certain while using the content in my blog whether you do not mind. Natually I’ll supply you with a link with your internet weblog. Thank you sharing.

cbd flower 说:
2020年6月14日 17:16

I think your blog is getting more and more visitors.`”:,,

2020年8月16日 15:46 I think this is an informative post and it is very beneficial and knowledgeable. Therefore, I would like to thank you for the endeavors that you have made in writing this article. All the content is absolutely well-researched. Thanks... forex trading metatrader 4
2020年8月18日 16:25

Wow, cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though. 안전놀이터

Lincoln Pulsford 说:
2020年9月28日 07:31

In many countries racial discrimination is dominant. In these countries feuds are seen on daily basis as people do not like to be neglected and top proofreading services gets his rights taken away then there surely will be violence.

Click Here 说:
2020年10月05日 18:22

Do you have any tips and pieces of information for longing creators? I'm needing to start my own site soon yet I'm to some degree lost on everything.

Robinjack 说:
2020年12月08日 21:04

Thankfully the world has moved on since the age of flares and bad haircuts, and that includes dating, but do not despair, meeting potential dates is extremely easy if you use internet dating. 婚姻介紹所

Robinjack 说:
2020年12月21日 20:33

Just want to say your article is as amazing. The clarity in your post is simply nice and i can assume you are an expert on this subject. Fine with your permission allow me to grab your RSS feed to keep updated with forthcoming post. Thanks a million and please keep up the gratifying work. meeting room booking

best face wash for m 说:
2021年2月06日 13:12

The second step for maintaining healthy skin is exfoliating. Shaving helps exfoliate skin if done routinely, however it does not reach all portions of your face. Face scrubs will help keep new skin cells on the surface and remove any dead skin cells. Exfoliators will uproot any ingrown hairs, unclog pores, smooth out fine lines, and tone your skin. Enjoy a younger and tighter looking complexion. It is recommended for use only once or twice a week, since repeated use can lead to dry, irritant skin. Scrubs will differs based on the size of the exfoliating beads and abrasiveness.

beauty hooked 说:
2021年2月06日 17:47

Your one-stop shop for expert beauty advise, authentic product reviews, and original makeup products—all vetted by our editors and the industry's top pros.

Best Hospital in Isl 说:
2021年2月07日 23:25

We provide the patient with five-star treatment, in the best environment and the most pleasant possible to make his stay more comfortable and less stressful. We hire and train young, motivated and highly skilled health professionals and staff to provide the best possible services to our patients.

Teka Teki 说:
2021年2月08日 12:23

You've just set foot on your new favorite site. Here you can get the best puzzles from us. Our collection of puzzles consists of jokes, love, animals and puzzles for kids. We will always add puzzles because knowing puzzles is the best way to expand your knowledge.

Robinjack 说:
2021年2月17日 21:47

I definitely appreciate your website. Thank you for your insights and guidance. meeting room booking system free download

2021年3月03日 16:29

Department of Pre-University Examination, Karnataka has every year releasing for 2nd PUC Model Question Papers with Subject wise Syllabus uploaded to board official websitePUC Question Paper 2021So every student we can Download Karnataka PUE 12th Class Sample Paper 2021 with Answer, pue.kar.nic.in 2nd PUC model question paper 2021 Karnataka 1st PUE Annual exam Question Papers and KAR II PUC Economics Question Bank with Answers pdf Download.

2021年3月08日 18:22

I haven't any word to value this post.....Really i am awed from this post....the individual who make this post it was an extraordinary human..thanks for imparted this to us. Seo package

登录 *

loading captcha image...
or Ctrl+Enter