Elisp 基础知识

Table of Contents

hello world

(message "hello world")

切换到 *scratch* 缓冲区,确保当前模式是 lisp-interaction-mode ,用 M-x lisp-interaction-mode 转换到 lisp-interaction-mode ,然后输入前面这一行语句,按 C-j 键,输出 “hello world”。

输入输出

(defun hello(my-name)
  (interactive "hello with name: ")
  (let ((your-name (read-from-minibuffer "enter your name: ")))
    (switch-to-buffer-other-window "*test*")
    (erase-buffer)
    (insert (format "hello %s!\n\nI am %s." your-name my-name))
    (other-window 1)))

(hello "haoran")