File: setup.el

package info (click to toggle)
pymacs 0.25-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 772 kB
  • sloc: python: 3,542; lisp: 740; makefile: 79; sh: 34
file content (35 lines) | stat: -rw-r--r-- 1,210 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
; Emacs side of the testing protocol.

(push ".." load-path)
(load "pymacs.el" nil t)

(defun run-one-request ()
  (let ((buffer (get-buffer-create "*Tests*")))
    (with-current-buffer buffer
      (buffer-disable-undo)
      (set-buffer-multibyte t)
      (set-buffer-file-coding-system 'utf-8-unix)
      (insert-file-contents "_request")
      (let ((lisp-code (read (current-buffer)))
            (standard-output (current-buffer)))
        (delete-region (point-min) (point-max))
        (eval lisp-code))
      (write-region nil nil "_reply" nil 0))))

(defun run-all-requests ()
  (let ((buffer (get-buffer-create "*Tests*")))
    (with-current-buffer buffer
      (buffer-disable-undo)
      (set-buffer-multibyte t)
      (set-buffer-file-coding-system 'utf-8-unix)
      (while t
        (while (file-exists-p "_reply")
          (sleep-for .005))
        (insert-file-contents "_request")
        (let ((lisp-code (read (current-buffer)))
              (standard-output (current-buffer)))
          (delete-region (point-min) (point-max))
          (eval lisp-code))
        (write-region nil nil "_reply" nil 0)
        (delete-region (point-min) (point-max))
        (delete-file "_request")))))