Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow resetting to previous error stacks; Fixes to toplevel variable evaluation #362

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions lisp/l/toplevel.l
Original file line number Diff line number Diff line change
@@ -124,28 +124,30 @@
(let* ((eof (cons nil nil))
(command (read input nil eof))
(arglist) (arg) result)
(cond ((eq command eof) )
(flet ((normal-eval (comm)
(setq - comm)
(setq result (eval comm))))
(cond
((eq command eof) )
((symbolp command)
;; (if *history* (add-history (input . buffer)))
(cond ((fboundp command)
(setq arglist nil)
(while (not (eq (setq arg (read input nil eof)) eof))
(push arg arglist))
(setq - (cons command (nreverse arglist)))
(setq result (eval -)))
((and (boundp command)
(eq (read input nil eof) eof))
(setq - command)
(setq result (eval command)))
(if (and (null arglist) (boundp command))
(normal-eval command) ;; eval symbol if bound and w/o args
(normal-eval (cons command (nreverse arglist)))))
((boundp command)
(normal-eval command))
((find-package (string command)) (in-package (string command)))
(*try-unix*
(setq - (list 'unix:system (input . buffer)))
(setq result (unix:system (input . buffer)) ) )
(t (warn "?~%")) ))
((and *try-unix*
;; try normal-eval when unix command is not found (errno 127)
(not (equal (normal-eval (list 'unix:system (input . buffer))) #x7f00))))
(t (normal-eval command)) ))
(t
;; (if *history* (add-history (input . buffer)))
(setq - command)
(setq result (eval command)) ))
(normal-eval command) )))
result))

(defun toplevel-prompt (strm)
@@ -291,8 +293,8 @@
(format *error-output* "~C[0m~%" #x1b)
(let ((*replevel* (1+ *replevel*))
(*reptype* "E"))
(catch *replevel* (reploop #'toplevel-prompt)))
(throw *replevel* nil))
(while (catch *replevel* (reploop #'toplevel-prompt))))
(throw *replevel* t))

;;;
;;; default toplevel