elisp debug

M-x  是运行command的意思。

若使用常规Emacs debugger(即不使用edebuger),先把要debug的函数加入到debug-on-entry

 M-x   debug-on-entry   the-function-name   RET
然后再使用eval-last-sexp命令运行单句elisp(需要移动焦点point到函数调用处),一般情况下它被绑定到键盘C-x C-e,
C-x C-e           runs   the   command   eval-last-sexp
然后就会popup一个debug窗口,按d键就可以单步调试,c键是skip and continue。


若要查看帮助,可以:
1、C-h a,  查看包含字串的command,C-h a runs the command apropos-command
2、C-h f,  查看elise的函数,
describe-function,它可以查看function和command,其实command也是function。
3、C-h v, 查看变量,
describe-variable
4、C-h m,查看mode的帮助, describe-mode


在emacs里执行elisp语句 :
M-x 后面跟任何function原则上都可以交互执行,比如:M-x getenv RET 之后,输入USER就可以获得环境用户名)
M-x eval-buffer     如果你有一个代码块要执行,把它拷贝到一个新建的buffer,然后执行行首的命令。
M-x eval-region    If you want something less hamfisted(拳头) you can tell Emacs to only evaluate the region by                                                      marking what you want to run and executing(代码不多可以选择执行region,没拳头那么大)
C-x C-e                    which is bound to eval-last-sexp: 这句和emacs工作的模式有关,但大多数模式都支持。但这句有一些特别                                             地方:它不会更新由defvar 或 defcustom什么的变量的值,另外你必须把point(光标)移动                                                       到要执行的语句的结尾。
C-M-x                     eval-defun,它可能是执行某条命令的最好方式了。它基本没有上面的命令的任何问题,你可                                               以在一个form的任何地方执行这条命令,它会自动选择执行最外层的form。
M-:                          被绑定到eval-expression,是让你自己输入要执行的语句,如 (getenv "USER")

Running Shell Commands from Emacs

M-! cmd RET

Run the shell command line cmd and display the output (shell-command).

M-| cmd RET

Run the shell command line cmd with region contents as input; optionally replace the region with the output (shell-command-on-region).

M-x shell

Run a subshell with input and output through an Emacs buffer. You can then give commands interactively.

M-x term

Run a subshell with input and output through an Emacs buffer. You can then give commands interactively. Full terminal emulation is available.

M-x eshell

Start the Emacs shell.

 

posted @ 2014-06-12 12:40  微信公众号--共鸣圈  阅读(683)  评论(0编辑  收藏  举报