Skip to content

Commit da468f8

Browse files
committed
Fix variable evaluation on 'evaluate-stream'
1 parent 1c043f6 commit da468f8

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Diff for: lisp/l/toplevel.l

+15-13
Original file line numberDiff line numberDiff line change
@@ -124,28 +124,30 @@
124124
(let* ((eof (cons nil nil))
125125
(command (read input nil eof))
126126
(arglist) (arg) result)
127-
(cond ((eq command eof) )
127+
(flet ((normal-eval (comm)
128+
(setq - comm)
129+
(setq result (eval comm))))
130+
(cond
131+
((eq command eof) )
128132
((symbolp command)
129133
;; (if *history* (add-history (input . buffer)))
130134
(cond ((fboundp command)
131135
(setq arglist nil)
132136
(while (not (eq (setq arg (read input nil eof)) eof))
133137
(push arg arglist))
134-
(setq - (cons command (nreverse arglist)))
135-
(setq result (eval -)))
136-
((and (boundp command)
137-
(eq (read input nil eof) eof))
138-
(setq - command)
139-
(setq result (eval command)))
138+
(if (and (null arglist) (boundp command))
139+
(normal-eval command) ;; eval symbol if bound and w/o args
140+
(normal-eval (cons command (nreverse arglist)))))
141+
((boundp command)
142+
(normal-eval command))
140143
((find-package (string command)) (in-package (string command)))
141-
(*try-unix*
142-
(setq - (list 'unix:system (input . buffer)))
143-
(setq result (unix:system (input . buffer)) ) )
144-
(t (warn "?~%")) ))
144+
((and *try-unix*
145+
;; try normal-eval when unix command is not found (errno 127)
146+
(not (equal (normal-eval (list 'unix:system (input . buffer))) #x7f00))))
147+
(t (normal-eval command)) ))
145148
(t
146149
;; (if *history* (add-history (input . buffer)))
147-
(setq - command)
148-
(setq result (eval command)) ))
150+
(normal-eval command) )))
149151
result))
150152

151153
(defun toplevel-prompt (strm)

0 commit comments

Comments
 (0)