Advertisement

emacs lisp(elisp)程序类似脚本行为

阅读量:

elisp程序的执行过程通常被称作取值,其常规操作方式为启动emacs编辑器,随后通过快捷键组合C-x C-e调用eval-current-buffer函数,从而运行当前缓冲区中的elisp代码。

emacs 22之后新增了#!/usr/bin/emacs --script这一功能,使得elisp程序能够像普通脚本一样直接运行,无需再手动开启emacs编辑器进行操作。

以下提供一个具体的示例程序,详见我的GitHub链接

复制代码
 #!/usr/bin/emacs --script

    
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
 ;; NAME 
    
 ;;    kit.el   ---- an example elisp script, which is 
    
 ;;             used to calculate intern salary.
    
 ;; 
    
 ;; USAGE
    
 ;;   emacs -Q --

全部评论 (0)

还没有任何评论哟~