-
Notifications
You must be signed in to change notification settings - Fork 0
/
03.el
32 lines (25 loc) · 907 Bytes
/
03.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;; Write a non-interactive function that doubles the value of its
;; argument, a number. Make that function interactive.
;; Non-interactive
(defun double-it (arg)
"Return the 'double' of ARG"
(* arg 2))
;; Usage
(double-it 23)
;; Interactive
(defun interactive-double-it (arg)
"Return the 'double' of ARG"
(interactive "p")
(message "%d" (* arg 2)))
;; Write a function that tests whether the current value of
;; ‘fill-column’ is greater than the argument passed to the function,
;; and if so, prints an appropriate message.
(defun is-greater-than-fill-column (arg)
"Check 'fill-column' of current-buffer is greater than
ARG"
(if (> arg fill-column)
(message "Arg(%d) is greater than 'fill-column'(%d)" arg fill-column)
(message "Arg(%d) is not greater than 'fill-column'(%d)" arg fill-column)))
;; Usage
(is-greater-than-fill-column 10)
(is-greater-than-fill-column 80)