Emacs factor mode: bug fix: don't depend on cl's DO.

db4
Jose A. Ortega Ruiz 2008-11-28 13:23:15 +01:00
parent c8a8d69382
commit 4c1e23b82d
1 changed files with 19 additions and 14 deletions

View File

@ -596,23 +596,28 @@ buffer."
(defconst factor--regex-error-marker "^Type :help for debugging") (defconst factor--regex-error-marker "^Type :help for debugging")
(defconst factor--regex-data-stack "^--- Data stack:") (defconst factor--regex-data-stack "^--- Data stack:")
(defun factor--prune-stack (ans) (defun factor--prune-ans-strings (ans)
(do ((res '() (cons (car s) res)) (s ans (cdr s))) (nreverse
((or (not s) (catch 'done
(and (car res) (string-match factor--regex-stack-effect (car res))) (let ((res))
(string-match factor--regex-data-stack (car s))) (dolist (a ans res)
(and (not (string-match factor--regex-error-marker (car res))) (cond ((string-match factor--regex-stack-effect a)
(nreverse res))))) (throw 'done (cons a res)))
((string-match factor--regex-data-stack a)
(throw 'done res))
((string-match factor--regex-error-marker a)
(throw 'done nil))
(t (push a res))))))))
(defun factor--see-ans-to-string (ans) (defun factor--see-ans-to-string (ans)
(let ((s (mapconcat #'identity (factor--prune-stack ans) " "))) (let ((s (mapconcat #'identity (factor--prune-ans-strings ans) " "))
(font-lock-verbose nil))
(and (> (length s) 0) (and (> (length s) 0)
(let ((font-lock-verbose nil))
(with-temp-buffer (with-temp-buffer
(insert s) (insert s)
(factor-mode) (factor-mode)
(font-lock-fontify-buffer) (font-lock-fontify-buffer)
(buffer-string)))))) (buffer-string)))))
(defun factor--see-current-word (&optional word) (defun factor--see-current-word (&optional word)
(let ((word (or word (factor--symbol-at-point)))) (let ((word (or word (factor--symbol-at-point))))