FUEL: Improved handling of documentation markup errors
The fuel-eval--retort-result-safe function can be used to get the retort result and throw an error if the retort error is set. E.g. (fuel-help "prettyprint") will now throw an error because the markup is invalid instead of showing "No help available.."db4
parent
a80dc21337
commit
368abbe777
|
@ -188,13 +188,15 @@
|
|||
(get-buffer-create " *fuel connection retort*"))
|
||||
|
||||
(defun fuel-con--comint-buffer-form ()
|
||||
"Parse the text in the comint buffer into a
|
||||
sexp. fuel-con-error is thrown if the sexp is malformed."
|
||||
(with-current-buffer (fuel-con--comint-buffer)
|
||||
(goto-char (point-min))
|
||||
(condition-case nil
|
||||
(condition-case cerr
|
||||
(let ((form (read (current-buffer))))
|
||||
(if (listp form) form
|
||||
(list 'fuel-con-error (buffer-string))))
|
||||
(error (list 'fuel-con-error (buffer-string))))))
|
||||
(error (list 'fuel-con-error (format "%s" cerr))))))
|
||||
|
||||
(defun fuel-con--process-next (con)
|
||||
(when (not (fuel-con--connection-current-request con))
|
||||
|
|
|
@ -121,6 +121,12 @@
|
|||
(defsubst fuel-eval--retort-result (ret) (nth 1 ret))
|
||||
(defsubst fuel-eval--retort-output (ret) (nth 2 ret))
|
||||
|
||||
(defun fuel-eval--retort-result-safe (ret)
|
||||
"Retort result or throws an error if the retort error is set."
|
||||
(let ((err (fuel-eval--retort-error ret)))
|
||||
(when err (error "%s" err))
|
||||
(fuel-eval--retort-result ret)))
|
||||
|
||||
(defsubst fuel-eval--retort-p (ret)
|
||||
(and (listp ret) (= 3 (length ret))))
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
(message "Retrieving help vocabulary for vocabulary '%s' ..." name)
|
||||
(let* ((cmd `(:fuel* ((,name fuel-vocab-help)) "fuel" (,name)))
|
||||
(ret (fuel-eval--send/wait cmd))
|
||||
(res (fuel-eval--retort-result ret)))
|
||||
(res (fuel-eval--retort-result-safe ret)))
|
||||
(if (not res)
|
||||
(message "No help available for vocabulary '%s'" name)
|
||||
(fuel-help--insert-contents (list name name 'vocab) res)
|
||||
|
|
Loading…
Reference in New Issue