Skip to content

Commit

Permalink
Emacs: fix logging when merlin call is interrupted (#1626)
Browse files Browse the repository at this point in the history
from bcc32/fix-interrupted-logging
  • Loading branch information
voodoos authored Jun 19, 2023
2 parents 409d6e8 + 4d654ce commit a69ec38
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions emacs/merlin.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit a69ec38

Please sign in to comment.