Skip to content

Commit c7e18b3

Browse files
committed
Fix variable evaluation on 'evaluate-stream'
1 parent ab62abe commit c7e18b3

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

lisp/l/toplevel.l

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

152154
(defun toplevel-prompt (strm)

0 commit comments

Comments
 (0)