emacs lisp 基础 1
来源:互联网 发布:淘宝雷锋侠是什么意思 编辑:程序博客网 时间:2024/05/29 15:55
----------------------------------------
lisp 基础知识
----------------------------------------
1. lisp 一个形象的说法是:
lots of isolated silly parenthesis (大量分离的愚蠢的括号)
真实的含义是:
list processing (列表处理)
2. 列表是用括号括住的原子集合,原子间用空格分开,列表可以嵌套。
3. 如果列表前有一个引号,表示这是一个引用, 否则就是对函数求值。
列表的第一个参数就是函数名称,后面为函数参数。
8. message 内置函数相当于c 语言的printf 函数,
11. 自定义函数。
函数是一组指令集合。
defun 函数名 参数列表
"函数描述
是否交互
函数体
请参见后面的mark-whole-buffer 函数
----------------------------------------
emacs 浏览 lisp 源代码。
----------------------------------------
M-. find tag 命令
1. 我在ubuntu 上编译安装了emacs.
方法很简单,get source 后, 运行autogen.sh 即可生成configure 文件
然后建立一个build_my 目录,运行../configre, make , make install 即可使用了。
2. 在emacs/src 目录下,用etags 命令对所有el 文件生成TAGS 文件
3. 我们来观察一个函数的源代码.
你可以用任何编辑器去查阅源码,例如vim, 打开TAGS文件,查看mark-whole-buffer 的源码
emacs 下提供了一种简单访问浏览代码的方式,叫find-tag 命令
操作如下:
M-.
mark-whole-buffer
"Put point at beginning and mark at end of buffer.
If narrowing is in effect, only uses the accessible part of the buffer.
You probably should not use this function in Lisp programs;
it is usually a mistake for a Lisp function to use any subroutine
that uses or sets the mark."
(interactive)
(push-mark (point))
(push-mark (point-max) nil t)
lisp 基础知识
----------------------------------------
1. lisp 一个形象的说法是:
lots of isolated silly parenthesis (大量分离的愚蠢的括号)
真实的含义是:
list processing (列表处理)
2. 列表是用括号括住的原子集合,原子间用空格分开,列表可以嵌套。
3. 如果列表前有一个引号,表示这是一个引用, 否则就是对函数求值。
列表的第一个参数就是函数名称,后面为函数参数。
4.函数的求值过程总是从内到外。
函数的求值通常需要对它的参数依次进行求值,参数的类型需要同函数定义
的类型相匹配。否则执行时有类型不配置错误。
5. 对参数求值的结果:原子返回原子本身。即整数返回整数,字符串返回字符串,
引用返回引用。 而对变量求值,也必返回整数,字符串或引用。 对函数求值也是返回原子。
对列表求值,除非列表前有反引号,是个引用,否则就是对函数求值。
6. 有时候对函数求值,我们并不关心它的返回值,而是只关心它的过程。就是关心它的附加效果。
例如一些控制类操作。或者动画效果,我们要的是效果,而不是返回一个什么数值或字符串。
8. message 内置函数相当于c 语言的printf 函数,
9. 对一个变量赋值,使用set, setq函数,
setq 函数就相当于赋值语句,它会把第一个参数加上反引号当做引用而不是把它求值。
let 函数, 对局部变量赋值, 允许2值赋值,变量名称,变量数值
10. if 语句, while 语句
11. 自定义函数。
函数是一组指令集合。
defun 函数名 参数列表
"函数描述
是否交互
函数体
请参见后面的mark-whole-buffer 函数
----------------------------------------
emacs 浏览 lisp 源代码。
----------------------------------------
M-. find tag 命令
1. 我在ubuntu 上编译安装了emacs.
方法很简单,get source 后, 运行autogen.sh 即可生成configure 文件
然后建立一个build_my 目录,运行../configre, make , make install 即可使用了。
2. 在emacs/src 目录下,用etags 命令对所有el 文件生成TAGS 文件
3. 我们来观察一个函数的源代码.
你可以用任何编辑器去查阅源码,例如vim, 打开TAGS文件,查看mark-whole-buffer 的源码
emacs 下提供了一种简单访问浏览代码的方式,叫find-tag 命令
操作如下:
M-.
mark-whole-buffer
它就跳到代码处了,爽!
用M-S-8 (就是M-*)可退回调用处。
"Put point at beginning and mark at end of buffer.
If narrowing is in effect, only uses the accessible part of the buffer.
You probably should not use this function in Lisp programs;
it is usually a mistake for a Lisp function to use any subroutine
that uses or sets the mark."
(interactive)
(push-mark (point))
(push-mark (point-max) nil t)
(goto-char (point-min)))
这个例子的核心说明:
1.C-x f 是什么含义 (对应函数的注释部分)
0 0
- emacs lisp 基础 1
- Emacs Lisp基础数据类型
- emacs lisp 基础 2
- Emacs LISP
- emacs lisp
- common lisp for emacs
- Emacs Lisp[转载]
- Emacs Lisp语言
- emacs lisp 笔记
- Emacs Lisp List
- Emacs+Lisp环境搭建
- emacs lisp 语言基本概念
- Emacs Lisp 常见编程
- emacs 中使用lisp
- Emacs lisp入门
- Emacs&&Lisp学习
- GNU Emacs Lisp编程入门(学习笔记1)
- LISP基础
- 大牛讲堂 | 邬书哲:物体检测算法的革新与传承
- c语言时间编程
- 如何在Linux下安装vim编辑器
- java api 已取消到该网页的导航问题
- spring 加入<tx:annotation-driven>标签 起动TOMCAT报错
- emacs lisp 基础 1
- 在Matlab中绘制嵌套图形
- Ubuntu下 Astah professional 6.9 安装
- Linux查看版本的两种方法
- 插入排序-----希尔排序---升级版插入
- python 中的if _ _name_ _=='_ _main_ _'
- MySQL优化三(InnoDB优化)
- [NOIP2011] day1铺地毯,选择客栈,Mayan游戏
- [C++学习01]强制类型转换和volatile关键字