summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAndreas Politz <politza@hochschule-trier.de>2019-08-03 16:33:06 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-08-03 16:33:06 +0200
commit95d2250bcf762296ec88e78d88f0c3b310b119ae (patch)
tree9a5fd853e2c088cc54d098565631606765937884 /lisp/emacs-lisp
parentd70bf3a1269281c8ae3315f2ae0684b945d5d680 (diff)
downloademacs-95d2250bcf762296ec88e78d88f0c3b310b119ae.tar.gz
emacs-95d2250bcf762296ec88e78d88f0c3b310b119ae.tar.bz2
emacs-95d2250bcf762296ec88e78d88f0c3b310b119ae.zip
Tweak tq queue processing
* lisp/emacs-lisp/tq.el (tq-process-buffer): Pop the queue before calling the function because the function may add new entries to the queue (bug#19016). Also report errors.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/tq.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/tq.el b/lisp/emacs-lisp/tq.el
index 4249305feee..a8c7e892893 100644
--- a/lisp/emacs-lisp/tq.el
+++ b/lisp/emacs-lisp/tq.el
@@ -153,15 +153,18 @@ This produces more reliable results with some processes."
(buffer-name buf)))
(goto-char (point-min))
(if (re-search-forward (tq-queue-head-regexp tq) nil t)
- (let ((answer (buffer-substring (point-min) (point))))
+ (let ((answer (buffer-substring (point-min) (point)))
+ (fn (tq-queue-head-fn tq))
+ (closure (tq-queue-head-closure tq)))
(delete-region (point-min) (point))
- (unwind-protect
- (condition-case nil
- (funcall (tq-queue-head-fn tq)
- (tq-queue-head-closure tq)
- answer)
- (error nil))
- (tq-queue-pop tq))
+ ;; Pop the queue before calling the function because
+ ;; the function may add new functions to the head of
+ ;; the queue.
+ (tq-queue-pop tq)
+ (condition-case err
+ (funcall fn closure answer)
+ (error (message "Error while processing tq callback: %s"
+ (error-message-string err))))
(tq-process-buffer tq))))))))
(provide 'tq)