Emacs Lisp(Elisp)
Tutorials
总是出现的错误提示
```sh Symbol's function definition is void: greeting ```
练习文件
1(setq my-name "tianheg")
2(insert "Hello!")
3(insert "Hello " "world.")Hello world.
4(insert "Hello, I am " my-name)Hello, I am tianheg
5
6(defun hello() (insert "Hello, I am " name))
7(hello "tianheg")Hello, I am tianheg
8
9(switch-to-buffer-other-window "*test*")
10
11(progn
12 (switch-to-buffer-other-window "*test*")
13 (hello "boy"))
14
15(progn
16 (switch-to-buffer-other-window "*test*")
17 (erase-buffer)
18 (hello "there")
19 (other-window 1))
20
21(let ((local-name "you"))
22 (switch-to-buffer-other-window "*test*")
23 (erase-buffer)
24 (hello local-name)
25 (other-window 1))
26
27(format "Hello %s!\n" "visitor")
28"Hello visitor!
29"
30
31(defun greeting (name)
32 (let ((your-name "tianheg"))
33 (insert (format "Hello %s!\n\nI am %s."
34 name
35 your-name
36 ))))
37(greeting "boys")
38
39
40(read-from-minibuffer "Enter your name: ")
41
42(defun greeting (from-name)
43 (let ((your-name (read-from-minibuffer "Enter your name: ")))
44 (insert (format "Hello!\n\nI am %s and you are %s."
45 from-name
46 your-name
47 ))))
48(greeting "Tom")
49
50(defun greeting (from-name)
51 (let ((your-name (read-from-minibuffer "Enter your name: ")))
52 (switch-to-buffer-other-window "*test*")
53 (erase-buffer)
54 (insert (format "Hello %s!\n\nI am %s." your-name from-name))
55 (other-window 1)))
56
57(greeting "Amy")
58
59(setq list '("Sarah" "Chloe" "Mathilde"))
60(car list)
61(cdr list)
62(push "Amy" list)
63(mapcar 'hello list)
64
65(defun greeting ()
66 (switch-to-buffer-other-window "*test*")
67 (erase-buffer)
68 (mapcar 'hello list)
69 (other-window 1))
70(greeting)
71
72(defun replace-hello-by-bonjour ()
73 (switch-to-buffer-other-window "*test*")
74 (goto-char (point-min))
75 (while (search-forward "Hello")
76 (replace-match "Bonjour"))
77 (other-window 1))
78(replace-hello-by-bonjour)
79
80(defun hello-to-bonjour ()
81 (switch-to-buffer-other-window "*test*")
82 (erase-buffer)
83 (mapcar 'hello list)
84 (goto-cahr (point-min))
85 (while (search-forward "Hello" nil t)
86 (replace-match "Bonjour"))
87 (other-window 1))
88(hello-to-bonjour)
89
90(defun boldify-names ()
91 (switch-to-buffer-other-window "*test*")
92 (goto-char (point-min))
93 (while (re-search-forward "Bonjour \\(.+\\)!"nil t)
94 (add-text-properties (match-beginning 1)
95 (match-end 1)
96 (list 'face 'bold)))
97 (other-window 1))
98(boldify-names)