EMACS-DOCUMENT

=============>随便,谢谢

Part 3: 列表与颜色

遍历list

ELISP> (setq bar '("do" "re" "mi" "fa"))
("do" "re" "mi" "fa")

ELISP> (dolist (note bar)
     (insert note))
nil
ELISP> doremifa

List 中的 list

ELISP> (setq foo '(("hello" 5)
         ("bye" 2)
         ("later" 7)))
(("hello" 5)
 ("bye" 2)
 ("later" 7))

ELISP> (dolist (item foo)
     (dotimes (x (nth 1 item))
     (insert (nth 0 item)))
     (newline))
nil
ELISP> hellohellohellohellohello
byebye
laterlaterlaterlaterlaterlaterlater

着色

(insert (propertize "bar" 'face '(:foreground "red")))
(insert (propertize "bar" 'face '(:background "gray30")))
(insert (propertize "bar" 'face '(:foreground "#33AAFF")))
(insert (propertize "bar" 'face '(:foreground "orange" :background "purple")))

ielm 中需要先输入 M-x font-lock-mode. 然后你会在屏幕底部看到一列信息 Font-Lock mode disabled (如果提示的是 enabled, 那么再输入一次 M-x font-lock-mode ).