From 4d654ce0358a704618e1c8a60f764a35cb3aec84 Mon Sep 17 00:00:00 2001 From: "Aaron L. Zeng" Date: Wed, 14 Jun 2023 17:58:29 -0400 Subject: [PATCH] Emacs: fix logging when merlin call is interrupted Currently, "interrupted" is only logged when the result parsing is interrupted (by C-g), but it seems pretty clear that the original intent (and more useful behavior) was to log "interrupted" when the actual merlin call was interrupted. We do this by setting up separate condition handlers for (1) the result parse failing; and (2) the merlin call or result parse being interrupted. --- CHANGES.md | 4 ++++ emacs/merlin.el | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index d5a00842ab..d4ba015ca7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ unreleased ========== + merlin binary - Handle concurrent server start (#1622) + + editor modes + - emacs: call merlin-client-logger with "interrupted" if the + merlin binary itself is interrupted, not just the parsing of the + result (#1626). merlin 4.9 diff --git a/emacs/merlin.el b/emacs/merlin.el index ea55c2e41a..61931ef967 100644 --- a/emacs/merlin.el +++ b/emacs/merlin.el @@ -565,16 +565,19 @@ argument (lookup appropriate binary, setup logging, pass global settings)" (defun merlin-call (command &rest args) "Execute a command and parse output: return an sexp on success or throw an error" - (let* ((binary (merlin-command)) - (result (merlin--call-merlin command args))) + (let ((binary (merlin-command)) result) (condition-case err - (setq result (car (read-from-string result))) - (error - (merlin-client-logger binary command -1 "failure") - (error "merlin: error %s trying to parse answer: %s" - err result)) + (progn + (setq result (merlin--call-merlin command args)) + (condition-case err + (setq result (car (read-from-string result))) + (error + (merlin-client-logger binary command -1 "failure") + (error "merlin: error %s trying to parse answer: %s" + err result)))) (quit - (merlin-client-logger binary command -1 "interrupted"))) + (merlin-client-logger binary command -1 "interrupted") + (signal (car err) (cdr err)))) (let* ((notifications (cdr-safe (assoc 'notifications result))) (timing (cdr-safe (assoc 'timing result))) (class (cdr-safe (assoc 'class result)))