DarwinAwardWinner / with-simulated-input

Test your interactive elisp functions non-interactively!
GNU General Public License v3.0
38 stars 4 forks source link

Request: friendlier error messages #7

Closed Trevoke closed 3 years ago

Trevoke commented 4 years ago

This looks like a massive timesaver and I look forward to leveraging this package's power, thank you! I do have a few requests for the error messages - hopefully they make sense and they're reasonable :)

Maybe there's something simple I can do that I don't know about to clear this up, but getting the entire backtrace is kind of annoying (and really slows things down if running the tests through eshell). The only things I really need are:

DarwinAwardWinner commented 4 years ago

At some point I need to more or less rewrite this package from scratch to fix #6, and I'll definitely keep this in mind when doing so. However, I would also note that the answer to your 3rd question is already given by the existing error message.

Trevoke commented 4 years ago

Really? Where? Here's my output.

phoenix@iMacGaia org-gtd.el % ~/bin/eldev test
Running 1 specs.

Clipboard pasted as level 1 subtree
What to do with this item? ([Q]uick, [T]hrow out, [P]roject, [C]alendar, [D]elegate it, [S]ingle action, [A]rchive this knowledge, [I]ncubate it, [?]):
Processing items
  can use a keybinding to finish clarifying an item  FAILED (606.27ms)

========================================
Processing items can use a keybinding to finish clarifying an item

Traceback (most recent call last):
  (let ((correct-current-buffer (current-buffer))) (let ((next-action-key (wsi-get-unbound-key))) (let ((result wsi--canary-sym)) (let ((thrown-error nil)) (let ((body-form (quote (throw (quote wsi-body-finished) (progn (org-gtd-process-inbox)))))) (let ((end-of-actions-form (list (quote throw) (quote (quote wsi-body-finished)) (list (quote quote) wsi--canary-sym)))) (let ((keylist (quote ("t")))) (let ((keylist (if (listp keylist) keylist (list keylist)))) (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old))))))))))))))
  (let ((next-action-key (wsi-get-unbound-key))) (let ((result wsi--canary-sym)) (let ((thrown-error nil)) (let ((body-form (quote (throw (quote wsi-body-finished) (progn (org-gtd-process-inbox)))))) (let ((end-of-actions-form (list (quote throw) (quote (quote wsi-body-finished)) (list (quote quote) wsi--canary-sym)))) (let ((keylist (quote ("t")))) (let ((keylist (if (listp keylist) keylist (list keylist)))) (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old)))))))))))))
  (let ((result wsi--canary-sym)) (let ((thrown-error nil)) (let ((body-form (quote (throw (quote wsi-body-finished) (progn (org-gtd-process-inbox)))))) (let ((end-of-actions-form (list (quote throw) (quote (quote wsi-body-finished)) (list (quote quote) wsi--canary-sym)))) (let ((keylist (quote ("t")))) (let ((keylist (if (listp keylist) keylist (list keylist)))) (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old))))))))))))
  (let ((thrown-error nil)) (let ((body-form (quote (throw (quote wsi-body-finished) (progn (org-gtd-process-inbox)))))) (let ((end-of-actions-form (list (quote throw) (quote (quote wsi-body-finished)) (list (quote quote) wsi--canary-sym)))) (let ((keylist (quote ("t")))) (let ((keylist (if (listp keylist) keylist (list keylist)))) (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old)))))))))))
  (let ((body-form (quote (throw (quote wsi-body-finished) (progn (org-gtd-process-inbox)))))) (let ((end-of-actions-form (list (quote throw) (quote (quote wsi-body-finished)) (list (quote quote) wsi--canary-sym)))) (let ((keylist (quote ("t")))) (let ((keylist (if (listp keylist) keylist (list keylist)))) (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old))))))))))
  (let ((end-of-actions-form (list (quote throw) (quote (quote wsi-body-finished)) (list (quote quote) wsi--canary-sym)))) (let ((keylist (quote ("t")))) (let ((keylist (if (listp keylist) keylist (list keylist)))) (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old)))))))))
  (let ((keylist (quote ("t")))) (let ((keylist (if (listp keylist) keylist (list keylist)))) (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old))))))))
  (let ((keylist (if (listp keylist) keylist (list keylist)))) (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old)))))))
  (let ((action-list (nconc (list (list (quote switch-to-buffer) correct-current-buffer) body-form) (let* ((--cl-var-- keylist) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (not (stringp action)) (progn (setq --cl-var-- (cons action --cl-var--)))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) (list end-of-actions-form)))) (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old))))))
  (let ((action-closures (let* ((--cl-var-- action-list) (action nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (setq --cl-var-- (cons (wsi-make-closure action lexenv) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))) (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old)))))
  (let ((full-key-sequence (let* ((--cl-var-- keylist) (action nil) (key-sequence-list nil)) (while (consp --cl-var--) (setq action (car --cl-var--)) (if (stringp action) (progn (setq key-sequence-list (nconc key-sequence-list (list action)))) (setq key-sequence-list (nconc key-sequence-list (list next-action-key)))) (setq --cl-var-- (cdr --cl-var--))) (concat next-action-key " " next-action-key " " (mapconcat (function identity) key-sequence-list " ") " " next-action-key)))) (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old))))
  (let* ((vnew (function (lambda nil (interactive) (condition-case err (if action-closures (let ((next-action (car-safe (prog1 action-closures (setq action-closures (cdr action-closures)))))) (funcall next-action)) (error "`with-simulated-input' reached end of action list without returning.")) (error (throw (quote wsi-threw-error) err)))))) (old (symbol-function (quote wsi-run-next-action)))) (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old)))
  (unwind-protect (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))) (fset (quote wsi-run-next-action) old))
  (progn (fset (quote wsi-run-next-action) vnew) (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result)))
  (let ((action-map (make-sparse-keymap))) (define-key action-map (kbd next-action-key) (quote wsi-run-next-action)) (setq thrown-error (catch (quote wsi-threw-error) (setq result (catch (quote wsi-body-finished) (let ((overriding-terminal-local-map action-map)) (execute-kbd-macro (kbd full-key-sequence))))) (throw (quote wsi-threw-error) nil))) (if thrown-error (progn (signal (car thrown-error) (cdr thrown-error)))) (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result))
  (if (eq result wsi--canary-sym) (error "Reached end of simulated input while evaluating body") result)
  (error "Reached end of simulated input while evaluating body")
  (signal error ("Reached end of simulated input while evaluating body"))
error: (error "Reached end of simulated input while evaluating body")
Trevoke commented 4 years ago

Waaaait never mind I have been reading this error message and assigning it the opposite meaning for a week now. This is saying that I ran out of keystrokes.. Not that I ran out of body. Okay, well, I don't know how to make this message clearer, but I request a clearer message :D

DarwinAwardWinner commented 4 years ago

Unfortunately, I don't think it's possible to provide a clearer message for this situation. In general, BODY might just be a call to a compiled function, so there isn't really a meaningful way to say exactly "where" in BODY the last input was consumed. Perhaps it's possible with some debugger magic, but that's beyond my ability.

Trevoke commented 4 years ago

Right - I thought I was looking at the opposite situation. That makes me think, I wonder if it might be enough to swap the order of the sentence -- that is to say, maybe:

with-simulated-input interrupted evaluation of body: ran out of input to feed to emacs

Or something like that. I think this is a more direct statement (even though the wording still sucks, I think) and I think it helps direct the reader towards what happened. What do you think?

On Sun, Jul 12, 2020 at 10:22 PM Ryan C. Thompson notifications@github.com wrote:

Unfortunately, I don't think it's possible to provide a clearer message for this situation. In general, BODY might just be a call to a compiled function, so there isn't really a meaningful way to say exactly "where" in BODY the last input was consumed. Perhaps it's possible with some debugger magic, but that's beyond my ability.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DarwinAwardWinner/with-simulated-input/issues/7#issuecomment-657324367, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQSSITMRJ3T2BGL6MA2X3R3JVYFANCNFSM4OX7YZLA .

DarwinAwardWinner commented 3 years ago

The core logic of with-simulated-input has recently been rewritten, and the new implementation should have much better error and warning messages, as of the upcoming 3.0 release.