Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Emacs Lisp 学习笔记
Search
Chi Zhang
October 17, 2012
Programming
220
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Emacs Lisp 学习笔记
Chi Zhang
October 17, 2012
Other Decks in Programming
See All in Programming
광주소프트웨어마이스터고등학교 DevFest 특강 - 바이브 코딩 시대에서 주니어 개발자로 살아남는 방법
utilforever
1
160
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
270
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
0
630
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
230
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
200
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
160
Build-to-own AI: Agentic Development for Humans
inesmontani
PRO
0
120
Prismを使った型安全な暗号化_関数型まつり2026
_fhhmm
0
150
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
110
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
140
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
300
Google Apps Script で Ruby を動かす
kawahara
0
120
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
440
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
600
Exploring anti-patterns in Rails
aemeredith
3
450
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
230
Bash Introduction
62gerente
615
220k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
350
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
230
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
Transcript
Emacs Lisp 学习笔记 Zhang Chi @ClvrObj
⼀一个简单目标
写⼀一个方法检查文件是否有 # -*- coding: utf-8 -*- 没有就给加上
⼀一步⼀一步来
基本元素
list, number, string, t, nil
在Emacs中执行和测试
M-x lisp-interaction-mode then C-j or C-x C-e
自带的⼀一些常用方法
+ - * / 1+ 1- /= = > <
equal and or not
方法声明
(defun func-name (arg, ...) "documentation..." body-of-function)
方法调用
(func-name arg, ...)
接受用户输入
(defun func-name (arg, ...) "documentation..." (interactive) body-of-function)
逻辑控制
let, if, cond, progn
(let ((variable value) (variable value) ...) body...)
(if true-or-false-test action-if-true action-if-false)
相当于switch case (cond (first-true-or-false-test first- consequent) (second-true-or-false-test second- consequent) (third-true-or-false-test
third- consequent) ...)
执行多个步骤 (progn body...)
回到目标
写⼀一个方法检查文件是否有 # -*- coding: utf-8 -*- 没有就给加上
目标达成
(defun add-py-header () "check and add # -*- coding: utf-8
-*-" (interactive) (let ((pyheader "# -*- coding: utf-8 -*-")) (if (not (equal pyheader (buffer-substring-no- properties 1 (1+ (length pyheader))))) (progn (goto-char 1) (insert (concat pyheader "\n\n")))))) https://gist.github.com/3795035/
Lisp
Born in 1958 by John McCarthy (1927 - 2011)
参考 • [为什么Lisp语言如此先进?(译文)](http://www.ruanyifeng.com/blog/ 2010/10/why_lisp_is_superior.html) • [Programming in Emacs Lisp](http://www.gnu.org/software/emacs/emacs- lisp-intro/html_mono/emacs-lisp-intro.html#multiply_002dby_002dseven-in-
detail) • [Learning GNU Emacs](http://book.douban.com/subject/1431970/) Chapter 11 • [Common Emacs Lisp Functions](http://ergoemacs.org/emacs/ elisp_common_functions.html)
:sparkles:Thanks!:sparkles: