这篇文章, 希望能有更多人喜欢 emacs.                                         

   
  ------------------------------------                                       
   
  Emacs 启动:                                                                
  
  直接打emacs, 如果有X-windows就会开视窗. 如果不想用X 的版本,                
  
  就用 emacs -nw      (No windows)起动.                                      
  
  符号说明                                                                   
   
  C-X 表示按住CTRL键, 然後按X, 再把CTRL, X一起放开.                          
 
  M-X         META                 META                                      
 
  在没有META键的电脑上, M-X 等於先按 ESC键, 接著按 X键.                     
 
   Sun上面META键就是菱形的那个键.                                            
  
   有些系统META键就是ALT键.(或者某一边的ALT键)                               
  
   C-X或 M-X的X没有大小写分别.                                               
  
  Emacs按键命令基本上是一串C-chr和M-chr组成的.                           
  
  超过两个以上的按键命令, Emacs会在萤幕最下面一行显示你按过什麽.             
  
  这一行叫作mini buffer                                                      
  
  结束Emacs按 C-x C-c                                                        
 
  取消执行 C-g                                                               
 
  有些Emacs命令会跑很久, 可以用C-g中断之. 按错键也可以按C-g取消.             
  
  上下移动   C-p 向上 (previous line) C-n向下(next line)                     
   
  左右移动   C-f 向右 (forward) C-b 向左 (backward)                          
  
  其实Emacs内部没有行的概念, 把一篇文章放在一个大buffer里面,                     
  (defun NAME (ARGS-LIST)                                                    
  
        "注解"                  ; optional                                   
 
        (interactive)           ; optional                                   
   
        BODY)                                                                
  
  定义一个叫NAME的函式. BODY 是一堆expression.                               
  
  注解是用来给C-h f显示的.                                                   
  
  (interactive) 表示这个函示会和user/buffer作用.                             
   
  (interactive "B") 表示执行此函式先问user一个buffer的名字,然後当作参数传给它. (如, 当user透过key-binding或者 M-x 呼叫此函式时)                                 
  (interactive "BAppend to buffer: 
r")
               问user buffer name时, 提示号 Append to buffer:                
  
               此function有两个引数,第一个是B, 就是buffer                    
 
               第二个是r, region                                             
 
               用
 隔开.                                                    
  
  (interactive "p") 用C-u 设的prefix 把它当作参数传给我.                     
  
                    预设值==4. C-u C-f 向右移四个字                          
  
  一些lisp 函式:                                                             
  
  (list 1 2 3 4)   产生 '(1 2 3 4)                                           
  
  (car '(1 2 3 4)       1                                                    
  
  (cdr '(1 2 3 4)       '(2 3 4)                                             
  
  (cons 1 '(2 3 4))     '(1 2 3 4)                                           
  
  (cons 1 2)            (1 . 2)                                              

  (cons 0 (cons 1  (cons 2 nil)))                                            
 
                  等於  '(0 1 2)                                             

        {list 是用 pair 串起来的,                                            
 
         用C 表示:                                                           
 
             pair: {Object *first, Object *second};                          
 
             *(pair[i].first) == i;                                          

             pair[i].second == pair[i+1]; }                                  
  
  (cons '(1 2) '(3 4))  '((1 2) 3 4)                                         
 
  (setq a 1)                                                                 
 
  (1+ a)        ; a+1                                                        

  (+ 2 a)       ; a+2                                                        
  
  (* 1 2 3 4)                                                                
 
  (current-buffer)  ; 传回目前buffer的资料物件                               
  
  (switch-to-buffer (other-buffer))                                          
  
  (set-buffer)                                                               
 
  (buffer-size)                                                              
 
  (setq current-pos (point))                                                 
  
  (point-min)                                                                
  
  (point-max)                                                                
 
  (message "Hello")   ; 在minibuffer显示Hello                                
 
  (if (test)                                                                 
 
       (then-part)                                                           
  
       (else-part))                                                          
 
  (cond ((test1) BODY1)                                                      
 
        ((test2) BODY2)                                                      
 
        (t  OTHER-WISE)                                                      
 
  (let ((var1 value)  ; local variable                                       
 
         var2             ; no value                                         
    
         (var3 value)                                                       
        ...)                                                               
  
          BODY ...)                                                          
  
  (lambda (ARG-LIST) ...) 同 defun, 但是没有名字 (anonymous).                
  
  可以存到变数去:                                                            
 
  (setq hello (lambda () (message "Hello,World")))                           
 
  (funcall hello)                                                            
   
  (goto-char (point-max))                                                    
 
  (defvar VAR VALUE "*注解") 如果VAR 不存在才定义. 有注解可以用C-h v 看. 注解打*号表是使用者可以直接改/ 这个变数本来就是给使用者设定用的.可以用 M-x edit-options 来线上设定 (emacs结束就没有了,不过edit-options可以给你所有可修改的变数的列表,你可以放到.emacs档内.(directory-files "./" t "..*")                
           return a list of files under directory X                          
  
  (load "xxxx.el")  同#include stdio.h                                     
  
               给使用者设定用的.                                             
 
               可以用 M-x edit-options 来线上设定 (emacs结束就没有了,不过edit-options可以给你所有可修改的变数的列表,你可以放到.emacs档内.(directory-files "./" t "..*")                                           
 
  return a list of files under directory X                          
 
  (load "xxxx.el")  同#include stdio.h                                     
  
  (setq load-path (cons "~/emacs" load-path)) ; load的search path.           
        
-- 
iamafan@linuxaid.com.cn