summaryrefslogtreecommitdiff
path: root/src/init.lisp
blob: 5a8182c76ee789a48820343543cadca88eb6a4bd (plain)
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
36
37
38
39
40
41
42
(let ((old-displa (symbol-function 'displa)))
  (defun displa (x)
    (mapc #'princ
          (if (and (listp x) (cdr x)
              (equal (subseq (string-right-trim '(#\Space) (cadr x)) 0 3) "$%I"))
            (funcall old-displa x)
            (tex (caddr x) 
                 (list (format nil "(~A) $$" (print-invert-case (stripdollar (cadr x)))))
                 '("$$") 'mparen 'mparen)))))

(defun mread-synerr (format-string &rest l)
    (let (tem
          errset
          (file "stdin"))
      (errset
       (setq tem (file-position *parse-stream*))
       (setq file  (namestring *parse-stream*)))
      (when tem
        (format t "~%~a:~a:" file tem))
      (format t (intl:gettext "incorrect syntax: "))
      (apply 'format t format-string (mapcar #'(lambda (x)
                                                 (if (symbolp x)
                                                     (print-invert-case x)
                                                     x))
                                             l))
      (let ((n (get '*parse-window* 'length))
            some ch)
        (loop for i from (1- n) downto (- n 20)
               while (setq ch (nth i *parse-window*))
               do
               (cond ((eql ch #\newline)
                      (push #\n some)
                      (push #\\ some))
                     ((eql ch #\tab)
                      (push #\t some)
                      (push #\\ some))
                     (t (push ch some))))
        (format t "~%~{~c~}~%~vt^" some (- (length some) 2))
      (read-line *parse-stream* nil nil))
      (terpri)
      (throw-macsyma-top)))