annotate lisp/edebug/edebug-test.el @ 142:1856695b1fa9 r20-2b5

Import from CVS: tag r20-2b5
author cvs
date Mon, 13 Aug 2007 09:33:18 +0200
parents 376386a54a3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;; Some tests for edebug.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;=======================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Reading tests.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 (testing (one two) three)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 (progn '(testing))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 (a . (b . c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 (a . "test")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 (a . (b . nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 (a . [one two three])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;===========================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; Backquote test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 (macroexpand '(` ((, (a)) . (, test))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (progn (` ((, (point)) . (, (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (` (, (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (message "%d" 999999)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (defun test1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (message "%d" 99999))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (test1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (eval (edebug-` (append [(, (point)) (, (point))] nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (eval (edebug-` (append (, (point)) (, (point)) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (eval (progn (edebug-` (edebug-` (, '(, (point)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (eval (edebug-` (let (((, 'a) 'b))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (message "%s" a))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (let ((r '(union x y)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (` (` (foo (, '(, r))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (let ((a '(one two))) a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (def-edebug-spec test-func (sexp &rest def-form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (setq edebug-unwrap-results t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (setq edebug-unwrap-results nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defmacro test-func (func &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (edebug-` ((, func) (,@ args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (test-func message (concat "hi%s" "there") (+ 1 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (defmacro test-progn (&rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (edebug-` (progn (,@ body))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (def-edebug-spec test-progn (&rest def-form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (test-progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (message "testing"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;;=================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;; Testing read syntax.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (format "testing %s %s %s" 1 2 (+ 1 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (defun test-syntax ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (setq mode-line-stuff'("draft(%b) ^C^S(end) ^C^Q(uit) ^C^K(ill)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;; (re-search-forward "[.?!][])""']*$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; (let (test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (test-syntax)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (let ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;; Testing function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (defun foo (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (mapconcat (function identity) x ", "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (defun foo (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (mapconcat 'identity x ", "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (defun foo (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (mapconcat (function (lambda (x) x)) x ", "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (require 'cl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (defun foo (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (mapconcat (function* (lambda (x &optional (y (1+ x)) &key xyz) x)) x ", "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (defun foo (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (mapconcat '(lambda (x) x) x ", "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (foo '(1 2 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (apply 'identity one two)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (defun test1 (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (def-edebug-spec test1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (setq x 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (test1 (+ x 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (("test1" test1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (def-edebug-spec test1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (&define sexp form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (test (test1 xyz (message "jfdjfd")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;; Anonymous function test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (defun hej (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 "docstring"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (interactive (list 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ((lambda (luttr &rest params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (apply luttr luttr params))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (function (lambda (self n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (edebug-trace "n: %s" n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (if (= n 5) (edebug nil "n is 5"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (edebug-tracing "cond"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ((= 0 n) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (t (* n (funcall self self (1- n))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 11))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (defun hej-test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 "testing")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (hej edebug-execution-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (hej-test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defun lambda-test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ((lambda (arg) arg) 'xyz))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (lambda-test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 "doc string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (with left paren on start of line)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (split-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (split-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (setq w (next-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (edebug-window-live-p w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;; Test edebugging top-level-forms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (def-edebug-spec test nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (let ((arg (list 'a 'b 'c)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (defun test (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (test arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (fset 'emacs-setq (symbol-function 'setq))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (defmacro my-setq (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (while args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (set (car args) (eval (car (cdr args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (setq args (cdr (cdr args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (defmacro test-macro (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (cons 'list args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (def-edebug-spec test-macro 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (test-macro (message "testing")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (message "someting")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (function (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (message "something else")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (funcall (test))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;; Test for and inc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (def-edebug-spec for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (symbolp ["from" def-form ["to" def-form] ["do" &rest def-form]]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; (symbolp ['from form ['to form] ['do &rest form]])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (inc x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (defmacro inc (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (list 'setq var (list '1+ var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (defmacro for (var from init to final do &rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (let ((tempvar (make-symbol "max")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (edebug-` (let (((, var) (, init))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ((, tempvar) (, final)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (while (<= (, var) (, tempvar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (,@ body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (inc (, var)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (defun test-for (one two)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (for i from one to two do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (message "%s" i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (let ((n 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (for i from n to (* n (+ n 1)) do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (message "%s" i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (test-for 3 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; Test condition-case
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (def-edebug-spec condition-case
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (symbolp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 &rest (symbolp &optional form)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (setq edebug-on-signal '(error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (defun test-condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (signal 'error '(oh))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (error (message "error: %s" err))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (test-condition-case)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (require 'cl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;;=============
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;; lexical let
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (defun test-lexical ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (funcall (lexical-let ((xyz 123))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (function (lambda (arg) (+ arg xyz))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 456))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (test-lexical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ;; case test.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (defun test-case (one)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (case one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ((one) (message "(one)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ("one" (message "one"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ('one (message "'one"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (test-case 'one)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;; Test of do from cl.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (defun list-reverse (list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (do ((x list (cdr x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (y nil (cons (car x) y)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ((endp x) y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (message "x: %s y: %s" x y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (list-reverse '(testing one two three))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (defmacro test-backquote (arg list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (edebug-`
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (message "%s %s" (, arg) (, list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (mapcar (function (lambda (arg1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (message "%s %s" arg1 (, arg)))) (, list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (def-edebug-spec test-backquote (def-form def-form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (test-backquote (symbol-name 'something) (list 1 2 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (defmacro dired-map-over-marks (body arg &optional show-progress)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (edebug-` (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (let (buffer-read-only case-fold-search found results)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (if (, arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (if (integerp (, arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (progn;; no save-excursion, want to move point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (dired-repeat-over-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (, arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (function (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (if (, show-progress) (sit-for 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (setq results (cons (, body) results)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (if (< (, arg) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (nreverse results)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 results))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ;; non-nil, non-integer ARG means use current file:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (list (, body)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (let ((regexp (dired-marker-regexp)) next-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 ;; remember position of next marked file before BODY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 ;; can insert lines before the just found file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 ;; confusing us by finding the same marked file again
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 ;; and again and...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (setq next-position (and (re-search-forward regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (point-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 found (not (null next-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (while next-position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (goto-char next-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (if (, show-progress) (sit-for 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (setq results (cons (, body) results))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 ;; move after last match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (goto-char next-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (set-marker next-position nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (setq next-position (and (re-search-forward regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (point-marker)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (if found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 results
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (list (, body))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 ;; save-excursion loses, again
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (dired-move-to-filename))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (def-edebug-spec dired-map-over-marks (&rest def-form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (dired-map-over-marks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (message "here") (+ 1 2) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;; circular structure test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (edebug-install-custom-print)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (edebug-uninstall-custom-print)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (setq a '(1 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (edebug-install-custom-print)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (setq a '(1 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (setcar a a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (with-custom-print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (format "%s" (setcar a a)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (setcdr a a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (let ((b a)) b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (with-custom-print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (let ((print-circle t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (circ-list (list 'a 'b (vector 1 2 3 4) 'd 'e 'f)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (setcar (nthcdr 3 circ-list) circ-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (aset (nth 2 circ-list) 2 circ-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (prin1-to-string circ-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 ;; interactive-p test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (defun test-interactive ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (interactive-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (test-interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (call-interactively 'test-interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 ;; test several things:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ;; - nested defun.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ;; - display scrolling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (defmacro testmacro ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 '(interactive-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (call-interactively 'testing1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (testing1 9)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (defun testing1 (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (interactive (list 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (message "%s" (interactive-p)) (sit-for 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (edebug-trace "interactive: %s" (testmacro))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (defun testing1-1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (testing1 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;; (custom-message "%s" arg "extra")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (while (< 0 (setq arg (1- arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 arg ; middle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 arg ; jump
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (edebug-trace-display "*testing*" "one")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (edebug-tracer "one\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (testing1 a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (call-interactively 'testing1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (testing1 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (testing1-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (defmacro testmacro ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 '(one))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (defun testing2 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (let* ((buf (get-buffer-create "testing"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (win (get-buffer-window buf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (testing1 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (window-point win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (window-point win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 ;; (read-stream-char buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (testing2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (defun testing3 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (set-buffer (get-buffer-create "*testing*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (testing3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 ;; anonymous function test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (defun testanon (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (mapcar '(lambda (x) x) arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (mapcar (function (lambda (x) x)) arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (mapcar (function testing3 ) arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (testanon '(1 2 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 ;; upward funarg test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (defmacro lambda (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 "Return the quoted lambda expression."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (cons 'function (list (cons 'lambda args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (lambda (testing) one two)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (defun testanon2 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 "return an anoymous function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (function (lambda (x) x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ;; Emacs 19 has a lambda macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (defun testanon2 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 "return an anoymous function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (lambda (x) x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (testanon2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (setq func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (testanon2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (funcall func 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (defun foo ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (mapcar #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (message "%S" x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (append '(0) '(a b c d e f))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (foo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 ;; downward funarg test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (defun xxx (func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (funcall func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (defun yyy ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (xxx (function (lambda () (message "hello")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (yyy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ;; eval this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (def-edebug-spec test nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (defun test (func list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (dolist (el list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (funcall func el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 ;; edebug this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (defun testcall (l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (test (function (lambda (x) (print x))) ;; set breakpoints in anon.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 ;; test call:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (testcall '(a b c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ;; flet test.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (defun alep-write-history (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (message "alep-write-history( %s )\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ;; write out header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 '(write-region (format ";;Saved on %s\n" (current-time-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 nil buffer-file-name nil 'shut-up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 ;; dump all not deleted actions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (flet ((write-solution (sol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (write-action (action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (if (a-h-action-deleted action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 ;; nothing to be done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (write-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (format "(alep-new-history-action %S %S %S)\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (a-h-action-name action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (alep-tnowv-string (a-h-action-in-tnowv
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 action))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (a-h-action-timestamp action))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 nil buffer-file-name t 'shut-up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (mapc 'write-solution
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (a-h-action-solutions action)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (mapc 'write-action
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 history-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (setq history-list '(1 2 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (alep-write-history)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ;;=========================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (edebug-trace "my stuff")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (defun fac (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (if (= n 0) (edebug))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 ;#6 1 0 =5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (if (< 0 n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 ;#5 =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (* n (fac (1- n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 ;# 5 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 ;# 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (fac 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 ;; Timing test - how bad is edebug?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (defun looptest (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (let ((i 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (while (< i n) (setq i (1+ i)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (looptest 10000)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 ;; eval-depth testing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (defun test-depth (i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (test-depth (1+ i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 ;; Without edebug i reaches 193, failing on eval depth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 ;; With edebug, i reaches about 57. Better safe than sorry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (setq max-lisp-eval-depth 200)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (test-depth 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 ;; specpdl-size testing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (defun test-depth2 (i max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (let ((test max-specpdl-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (max-lisp-eval-depth (+ 2 max-lisp-eval-depth))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (test-depth2 (1+ i) max-specpdl-size)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (let ((max-lisp-eval-depth 300)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (max-specpdl-size 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (test-depth2 0 max-specpdl-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 ;; Buffer testing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (defun zprint-region-1 (start end switches)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (let ((name (concat (buffer-name) ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (width tab-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (message "Spooling...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (let ((oldbuf (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (set-buffer (get-buffer-create " *spool temp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (insert-buffer-substring oldbuf start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (setq tab-width width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (if (/= tab-width 8)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (untabify (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (setq start (point-min) end (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (apply 'call-process-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (nconc (list start end zpr-command nil nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 "-h" name switches)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (message "Spooling...done")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (defun quick-hanoi (nrings)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (with-output-to-temp-buffer "*hanio*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (set-buffer "*hanio*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (princ (format "Solution to %s ring hanoi problem\n\n" nrings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (hanoi0 nrings 'pole-1 'pole-2 'pole-3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (defun hanoi0 (n from to work)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;; (edebug-set-window-configuration (edebug-current-window-configuration))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (if (> n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 ;; (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 ;; (set-buffer "*hanio*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 ;; (message "Point=%s window-point=%s" (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;; (window-point (get-buffer-window "*hanio*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;; (set-window-point (get-buffer-window "*hanio*") (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 ;; )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (hanoi0 (1- n) from work to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (princ (format "ring %s from %s to %s\n" n from to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (hanoi0 (1- n) work to from))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (quick-hanoi 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 ;; Error test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (defun error-generating-function ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (message "try again?") (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (signal 'bogus '("some error" xyz abc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (error "debug-on-error: %s edebug-entered: %s edebug-recursion-depth: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 debug-on-error edebug-entered edebug-recursion-depth)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ;; --><-- point will be left between the two arrows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (setq debug-on-error nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (setq edebug-on-signal '(bogus))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (testing-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (defun testing-function ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (message "YYY")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (error-generating-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (message "ZZZ"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (let ((debug-on-error t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 xyzzyz)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 ;; Quitting with unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (defun unwind-test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (message "testing")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (message "unwinding1"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (message "unwinding2")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (unwind-test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (defmacro save-buffer-points (&rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (` (let ((buffer-points
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (mapcar (function (lambda (buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (cons buf (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (buffer-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (,@ body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (mapcar (function (lambda (buf-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (if (buffer-name (car buf-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (set-buffer (car buf-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (goto-char (cdr buf-point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 buffer-points)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (defun testing4 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (with-output-to-temp-buffer "*testing*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (princ "Line 1\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (save-buffer-points
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (recursive-edit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (princ "Line 2\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (testing4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 test!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 ;;====================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 ;; edebug-form-specs for Guido Bosch's flavors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (def-edebug-spec defmethod defun) ; same as defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (def-edebug-spec defwhopper defun) ; same as defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 ;;======================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 ;; Check syntax errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (defun test-too-many-arguments ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (mapcar 'test one two))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (mapcar 'not-enough)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (defun test-not-enough-arguments ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (mapcar 'test))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (defun test-bad-function ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (defun test-bad-function ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (bad () )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (defun test-bad-lambda-arguments ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (function (lambda "bad" )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (defun test-bad-defun-arguments "bad"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (function (lambda "bad" )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (defun test-bad-defun-arguments (arg "bad") ;; wrong error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (function (lambda "bad" )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (defun test-bad-defun-arguments (&optional)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (function (lambda "bad" )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (defun test-bad-let-in-lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (function (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (let ((something one bad)))))) ;; wrong error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (defun test-bad-interactive ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (interactive one bad))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (defun test-bad-defvar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (defvar test-defvar nil [bad]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (defun test-bad-let1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (let bad))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (defun test-bad-let2 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (let ((something one bad))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (defun test-good-let ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (let ((a b))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (defun test-bad-let3 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (let (((bad)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (defun test-bad-let4 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (let ("bad")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (let ((good (list 'one))) good)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (defun test-bad-setq ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (setq "bad" ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (setq good ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 "bad")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (defun test-bad-cond ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (cond "bad"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (cond ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (defun test-bad-cond ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (cond () [] "bad"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (defun test-bad-condition-case1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (condition-case "bad"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (defun test-bad-condition-case2 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 "bad"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (defun test-bad-condition-case3 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (error "messages")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;; ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 ((error quit) (message "%s" err))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 (def-edebug-spec do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 ((&rest &or symbolp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (fence symbolp &optional form form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (form body) body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (defun bad-do (list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (do ( x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (x list (cdr x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (y nil (cons (car x) y))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (x list (cdr x) bad)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 "bad"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 ((endp x) y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (defun ok ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (defun "bad" () )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 ;;=========================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ;; Test printing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (defun test-window-buffer-change (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 "testing"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (interactive arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (set-window-buffer (selected-window) (get-buffer "*scratch*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (get-buffer-window (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (test-window-buffer-change 'test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (defun test-window-buffer-change ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (test-window-buffer-change 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (def-edebug-spec edebug-forms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (&rest edebug-form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (def-edebug-spec edebug-form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (&or (edebug-function-symbolp edebug-forms)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (anonymous-function edebug-forms)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (edebug-macro-symbolp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (defun test-mapatoms () )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (mapatoms (function (lambda (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (princ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (test-mapatoms)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 ;; Test embedded &rest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (def-edebug-spec symbol-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 ([&rest "a" symbolp] form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (symbol-list a b a (+ c d)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (test)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (def-edebug-spec group-alternates-test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (&or ["foo" "bar"] "baz"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (group-alternates-test foo bar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (group-alternates-test baz )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 ;;---------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (dolist (f (list 1 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (message f)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (dolist (el (list 'a 'b 'c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (print el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 ;; (of-type (type (more type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (def-edebug-spec test-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (&or symbolp "nil"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (test-nil () )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 ((lambda (arg) arg) two)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 ;; Dot notation testing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (def-edebug-spec test-dot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (symbolp . [&or symbolp (stringp)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (test-dot xyz . jk)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (test-dot xyz "jk")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (def-edebug-spec test-dot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (&or symbolp (test-dot1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (def-edebug-spec test-dot1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (test-dot2 . test-dot2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (def-edebug-spec test-dot2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (symbolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (def-edebug-spec test-dot2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 ([&or test-dot1 nil]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (def-edebug-spec test-dot1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (symbolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (&or symbolp (test-dot)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (test-dot (a . b)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (def-edebug-spec edebug-specs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (symbolp . symbolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (def-edebug-spec edebug-specs1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (&or symbolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (def-edebug-spec edebug-spec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (&or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 symbolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (def-edebug-spec test-not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (symbolp . [&not symbolp form]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (test-not "string")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 ;;--------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 ;; Loop macro testing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (loop-var (((var1 (var2 var4) . (var3 var5)) . var1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (loop-var (var1 var2 . var3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (loop-var (var1 ["bad"] . "bad"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 ' (var2 var3 . var4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (loop for ((a . b) (c . d))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 of-type ((float . float) (integer. integer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (loop if some-test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 collect a-form into var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 else minimize x ;; of-type some-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 and append x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (loop for x from 1 to 9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 and y = nil then x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 collect (list x y)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (loop for i from 10 downto 1 by 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 do (print i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (loop for item = 1 then (+ item 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 repeat 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 collect item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (loop for z upfrom 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 thereis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (loop for n upfrom 3 below (+ z 2) ;; + was log
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 thereis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (loop for x below z
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 thereis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (loop for y below z
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 thereis (= (+ (* x n) ;; * was expt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (* y n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (* z n)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (loop for name in '(fred sue alice joe june)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 as age in '(22 26 19 20 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 append (list name age) into name-and-age-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 count name into name-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 sum age into total-age
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 finally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (return (values (round* total-age name-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 name-and-age-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (loop for x from 0 to 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 do (print x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 if (zerop (mod x 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 do (princ " a")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 and if (zerop (floor* x 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 do (princ " b")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 and do (princ " c")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (loop initially do (message x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 do (dispatch-event event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (loop initially do (popup-menu menu) ;; do is an error here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 with event = (allocate-event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 do (dispatch-event event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (defun popup-menu-synchronously (menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (loop initially (popup-menu menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 with event = (allocate-event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 until (button-release-event-p (next-event event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 do (dispatch-event event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 finally do (deallocate-event event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (loop with list = '(1 2 3 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 for item in list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 sum item into summation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 collect (list item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (defun test-catch (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (if (> n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (let* ((test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (catch 'test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (test-catch (1- n)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (if test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (do-throw)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (do-throw)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (defun do-throw ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (funcall 'throw 'test 'here))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (test-catch 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 ;;------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (defun* foo (a &optional b &key c d (e 17)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (def-edebug-spec test-vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 ((vector form)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (test-vector [one]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 [testing one two three]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (testing one two three)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (def-edebug-spec test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (&optional &or ["something" keywordp] symbolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (test something :somekey)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (defun find-faq (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 "Hmtar en faq."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 (all-faq-a-valid-ftp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 (intern-soft
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (let ((minibuffer-help-form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (let* ((partial (buffer-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (soft (intern-soft partial all-faq-known-files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 (if soft
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (set soft (append (cdr (symbol-value soft))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 (list (car (symbol-value soft))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 (if (and soft (all-faq-a-valid-ftp soft))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 (mapconcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 (lambda (apair)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (car apair)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (symbol-value soft)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 "\n"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (completing-read "What faq? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 all-faq-known-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (function all-faq-a-valid-ftp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 t ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 all-faq-known-files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (find-file filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 ;;===============
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 ;; Keyword testing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (def-edebug-spec test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (&key (bad "one") (good "thing")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (defun test-key ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (test :bad one)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (test1 :bad one))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (def-edebug-spec test
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (("one")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (&rest ["one" "two"]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (test (one))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (progn (message "one" ) )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 (testet xxx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (progn (message "one" ) )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 (let ((a (+ 1 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (1+ a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 (mapcar 'test (list 1 2 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (defun test (testing) testing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 ;;==================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 ;; Test defstruct.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (defun test ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 (defstruct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 (test (:constructor construct (args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (b (+ a c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 ;;================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 ;; advice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (defun foo (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 "Add 1 to x."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (1+ x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 (require 'advice)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 (defadvice foo (before add2 first activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 " Add 2 to x"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 (setq x (1+ x)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 (foo 3)