Skip to content

Commit

Permalink
delete process before killing buffer in sentinel
Browse files Browse the repository at this point in the history
  • Loading branch information
tpeacock19 committed Mar 3, 2024
1 parent fb0d54d commit 0f8c1ed
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions flymake-languagetool.el
Original file line number Diff line number Diff line change
Expand Up @@ -322,19 +322,17 @@ STATUS provided from `url-retrieve'."
:region (cons (point-min) (point-max))))))
((not proc-current)
(with-current-buffer source-buffer
(flymake-log :warning "Cancelling obsolete check"))))))
(flymake-log :warning "Skipping an obsolete check"))))
(kill-buffer c-buf)))

(defun flymake-languagetool--check (report-fn text)
"Run LanguageTool on TEXT from current buffer's contento.
The callback function will reply with REPORT-FN."
(when-let ((buf flymake-languagetool--proc-buf))
(flymake-log :warning "Canceling the obsolete check %s"
flymake-languagetool--proc-buf)
;; need to check if buffer has ongoing process or else we may
;; potentially delete the wrong one.
(when-let ((process (get-buffer-process buf)))
(delete-process process))
(kill-buffer buf)
(setf flymake-languagetool--proc-buf nil))
(let* ((url-request-method "POST")
(url-request-extra-headers
Expand Down Expand Up @@ -412,6 +410,7 @@ Once started call `flymake-languagetool' checker with REPORT-FN."
(lambda (proc _event)
(when (memq (process-status proc) '(exit signal))
(setq flymake-languagetool--local nil)
(delete-process proc)
(kill-buffer (process-buffer proc)))))))

(defun flymake-languagetool--checker (report-fn &rest _args)
Expand Down

0 comments on commit 0f8c1ed

Please sign in to comment.