emacs-languagetool / flymake-languagetool

Flymake support for LanguageTool
GNU General Public License v3.0
33 stars 11 forks source link

Buffer " *http api.languagetool.org:443*-719434" has a running process; kill it? #22

Closed jcubic closed 6 months ago

jcubic commented 6 months ago

When using the flymake-languagetool I got this GUI popup when I need to confirm to kill the process. First time seeing something like this. This happens when I save the file.

Przechwycenie obrazu ekranu_2024-02-29_16-07-27

When I hover over flymake in the minibuffer it says 2 known backends, 0 running, 2 disabled

I also got this stack trace of of the time when the question is in minibuffer:

Debugger entered--Lisp error: (error "[Flymake] Obsolete report from backend flymake-lan...")
  error("[Flymake] Obsolete report from backend flymake-lan...")
  flymake-error("Obsolete report from backend %s with explanation %..." flymake-languagetool--checker nil)
  flymake--handle-report(flymake-languagetool--checker backend-token51 (#s(flymake--diag :locus #<buffer macros.md> :beg 10119 :end 10122 :type :typography :text "Do you wish to inser..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10119 :orig-end 10122) #s(flymake--diag :locus #<buffer macros.md> :beg 10065 :end 10066 :type :punctuation :text "Unpaired symbol: ‘'’..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10065 :orig-end 10066) #s(flymake--diag :locus #<buffer macros.md> :beg 10038 :end 10043 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10038 :orig-end 10043) #s(flymake--diag :locus #<buffer macros.md> :beg 10034 :end 10036 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10034 :orig-end 10036) #s(flymake--diag :locus #<buffer macros.md> :beg 10022 :end 10027 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10022 :orig-end 10027) #s(flymake--diag :locus #<buffer macros.md> :beg 10018 :end 10020 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10018 :orig-end 10020) #s(flymake--diag :locus #<buffer macros.md> :beg 10006 :end 10011 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10006 :orig-end 10011) #s(flymake--diag :locus #<buffer macros.md> :beg 10002 :end 10004 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10002 :orig-end 10004) #s(flymake--diag :locus #<buffer macros.md> :beg 9996 :end 9997 :type :punctuation :text "Unpaired symbol: ‘'’..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 9996 :orig-end 9997) #s(flymake--diag :locus #<buffer macros.md> :beg 9051 :end 9057 :type :casing :text "Only proper nouns st..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 9051 :orig-end 9057) #s(flymake--diag :locus #<buffer macros.md> :beg 8987 :end 8990 :type :typography :text "Do you wish to inser..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8987 :orig-end 8990) #s(flymake--diag :locus #<buffer macros.md> :beg 8974 :end 8979 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8974 :orig-end 8979) #s(flymake--diag :locus #<buffer macros.md> :beg 8970 :end 8972 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8970 :orig-end 8972) #s(flymake--diag :locus #<buffer macros.md> :beg 8958 :end 8963 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8958 :orig-end 8963) #s(flymake--diag :locus #<buffer macros.md> :beg 8954 :end 8956 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8954 :orig-end 8956) #s(flymake--diag :locus #<buffer macros.md> :beg 8942 :end 8947 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8942 :orig-end 8947) #s(flymake--diag :locus #<buffer macros.md> :beg 8938 :end 8940 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8938 :orig-end 8940) #s(flymake--diag :locus #<buffer macros.md> :beg 8737 :end 8738 :type :punctuation :text "Unpaired symbol: ‘'’..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8737 :orig-end 8738) #s(flymake--diag :locus #<buffer macros.md> :beg 8732 :end 8737 :type :typography :text "Possible typo: you r..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8732 :orig-end 8737) #s(flymake--diag :locus #<buffer macros.md> :beg 8720 :end 8722 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8720 :orig-end 8722) ...) :region (1 . 10234))
  apply(flymake--handle-report flymake-languagetool--checker backend-token51 ((... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :region (1 . 10234)))
  #f(compiled-function (&rest args) #<bytecode 0x1564483062305084>)((#s(flymake--diag :locus #<buffer macros.md> :beg 10119 :end 10122 :type :typography :text "Do you wish to inser..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10119 :orig-end 10122) #s(flymake--diag :locus #<buffer macros.md> :beg 10065 :end 10066 :type :punctuation :text "Unpaired symbol: ‘'’..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10065 :orig-end 10066) #s(flymake--diag :locus #<buffer macros.md> :beg 10038 :end 10043 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10038 :orig-end 10043) #s(flymake--diag :locus #<buffer macros.md> :beg 10034 :end 10036 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10034 :orig-end 10036) #s(flymake--diag :locus #<buffer macros.md> :beg 10022 :end 10027 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10022 :orig-end 10027) #s(flymake--diag :locus #<buffer macros.md> :beg 10018 :end 10020 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10018 :orig-end 10020) #s(flymake--diag :locus #<buffer macros.md> :beg 10006 :end 10011 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10006 :orig-end 10011) #s(flymake--diag :locus #<buffer macros.md> :beg 10002 :end 10004 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 10002 :orig-end 10004) #s(flymake--diag :locus #<buffer macros.md> :beg 9996 :end 9997 :type :punctuation :text "Unpaired symbol: ‘'’..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 9996 :orig-end 9997) #s(flymake--diag :locus #<buffer macros.md> :beg 9051 :end 9057 :type :casing :text "Only proper nouns st..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 9051 :orig-end 9057) #s(flymake--diag :locus #<buffer macros.md> :beg 8987 :end 8990 :type :typography :text "Do you wish to inser..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8987 :orig-end 8990) #s(flymake--diag :locus #<buffer macros.md> :beg 8974 :end 8979 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8974 :orig-end 8979) #s(flymake--diag :locus #<buffer macros.md> :beg 8970 :end 8972 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8970 :orig-end 8972) #s(flymake--diag :locus #<buffer macros.md> :beg 8958 :end 8963 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8958 :orig-end 8963) #s(flymake--diag :locus #<buffer macros.md> :beg 8954 :end 8956 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8954 :orig-end 8956) #s(flymake--diag :locus #<buffer macros.md> :beg 8942 :end 8947 :type :casing :text "This sentence does n..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8942 :orig-end 8947) #s(flymake--diag :locus #<buffer macros.md> :beg 8938 :end 8940 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8938 :orig-end 8940) #s(flymake--diag :locus #<buffer macros.md> :beg 8737 :end 8738 :type :punctuation :text "Unpaired symbol: ‘'’..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8737 :orig-end 8738) #s(flymake--diag :locus #<buffer macros.md> :beg 8732 :end 8737 :type :typography :text "Possible typo: you r..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8732 :orig-end 8737) #s(flymake--diag :locus #<buffer macros.md> :beg 8720 :end 8722 :type :typography :text "Don’t put a space be..." :backend nil :data ... :overlay-properties nil :overlay nil :orig-beg 8720 :orig-end 8722) ...) :region (1 . 10234))
  flymake-languagetool--handle-finished((:peer (:certificates ((:version 3 :serial-number "04:32:23:0d:c0:e2:4b:c5:48:7a:a2:8e:e7:b9:d0:85:85..." :issuer "C=US,O=Let's Encrypt,CN=R3" :valid-from "2024-01-08" :valid-to "2024-04-07" :subject "CN=api.languagetool.org" :public-key-algorithm "EC/ECDSA" :certificate-security-level "High" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:fc:a1:fe:82:43:48:85:8b:68:6e:72:6b:f7:45:d7:..." :certificate-id "sha1:a4:ff:e0:7a:47:de:34:0e:49:2b:13:39:fa:b7:4b:..." :pem "-----BEGIN CERTIFICATE-----\nMIIEKjCCAxKgAwIBAgISBD...") (:version 3 :serial-number "00:91:2b:08:4a:cf:0c:18:a7:53:f6:d6:2e:25:a7:5f:5a" :issuer "C=US,O=Internet Security Research Group,CN=ISRG Ro..." :valid-from "2020-09-04" :valid-to "2025-09-15" :subject "C=US,O=Let's Encrypt,CN=R3" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:8a:93:82:f4:c8:04:08:34:5e:5b:c2:f8:d7:55:d3:..." :certificate-id "sha1:a0:53:37:5b:fe:84:e8:b7:48:78:2c:7c:ee:15:82:..." :pem "-----BEGIN CERTIFICATE-----\nMIIFFjCCAv6gAwIBAgIRAJ...") (:version 3 :serial-number "40:01:77:21:37:d4:e9:42:b8:ee:76:aa:3c:64:0a:b7" :issuer "O=Digital Signature Trust Co.,CN=DST Root CA X3" :valid-from "2021-01-20" :valid-to "2024-09-30" :subject "C=US,O=Internet Security Research Group,CN=ISRG Ro..." :public-key-algorithm "RSA" :certificate-security-level "High" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:f8:16:51:3c:fd:1b:44:9f:2e:6b:28:a1:97:22:1f:..." :certificate-id "sha1:93:3c:6d:de:e9:5c:9c:41:a4:0f:9f:50:49:3d:82:..." :pem "-----BEGIN CERTIFICATE-----\nMIIFYDCCBEigAwIBAgIQQA...")) :certificate (:version 3 :serial-number "04:32:23:0d:c0:e2:4b:c5:48:7a:a2:8e:e7:b9:d0:85:85..." :issuer "C=US,O=Let's Encrypt,CN=R3" :valid-from "2024-01-08" :valid-to "2024-04-07" :subject "CN=api.languagetool.org" :public-key-algorithm "EC/ECDSA" :certificate-security-level "High" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:fc:a1:fe:82:43:48:85:8b:68:6e:72:6b:f7:45:d7:..." :certificate-id "sha1:a4:ff:e0:7a:47:de:34:0e:49:2b:13:39:fa:b7:4b:..." :pem "-----BEGIN CERTIFICATE-----\nMIIEKjCCAxKgAwIBAgISBD...") :key-exchange "ECDHE-RSA" :protocol "TLS1.3" :cipher "AES-256-GCM" :mac "AEAD" :encrypt-then-mac nil)) #<buffer macros.md> #f(compiled-function (&rest args) #<bytecode 0x1564483062305084>))
  url-http-activate-callback()
  url-http-chunked-encoding-after-change-function(8176 9341 1165)
  url-http-generic-filter(#<process api.languagetool.org<1>> "j\264\2200!\310mZ\204H\342cB$\366iQb\201Q\220\202\324\250Gj:\337 t\352\221\"qU\364\n\362\223\36)\222\0263R\24\326\256\303\6...")
  read-from-minibuffer(#("Buffer \" *http api.languagetool.org:443*-792808\" h..." 82 83 (face help-key-binding font-lock-face help-key-binding) 87 88 (face help-key-binding font-lock-face help-key-binding)) nil (keymap (keymap (escape . abort-recursive-edit) (remap keymap (quit . abort-recursive-edit) (exit-prefix . abort-recursive-edit) (exit . y-or-n-p-insert-other) (scroll-other-window-down . minibuffer-scroll-other-window-down) (scroll-other-window . minibuffer-scroll-other-window) (scroll-down . minibuffer-scroll-down-command) (scroll-up . minibuffer-scroll-up-command) (recenter . minibuffer-recenter-top-bottom) (self-insert-command . y-or-n-p-insert-other) (ignore . y-or-n-p-insert-other) (delete-and-edit . y-or-n-p-insert-other) (edit-replacement . y-or-n-p-insert-other) (edit . y-or-n-p-insert-other) (undo-all . y-or-n-p-insert-other) (undo . y-or-n-p-insert-other) (backup . y-or-n-p-insert-other) (skip . y-or-n-p-insert-n) (automatic . y-or-n-p-insert-y) (act-and-exit . y-or-n-p-insert-y) (act-and-show . y-or-n-p-insert-y) (act . y-or-n-p-insert-y)) keymap (3 keymap (6 . open-clipboard-filename)) (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the min...") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuf...") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "\15" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (24 keymap (down . minibuffer-complete-defaults) (up . minibuffer-complete-history)) (13 . exit-minibuffer) (10 . exit-minibuffer) (7 . minibuffer-keyboard-quit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (60 . minibuffer-beginning-of-buffer) (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) keymap (escape . exit-prefix) (M-prior . scroll-other-window-down) (M-next . scroll-other-window) (prior . scroll-down) (next . scroll-up) (27 keymap (33554454 . scroll-other-window-down) (22 . scroll-other-window) (118 . scroll-down)) (22 . scroll-up) (29 . quit) (7 . quit) (63 . help) (help . help) (f1 . help) (8 . help) (85 . undo-all) (117 . undo) (94 . backup) (33 . automatic) (12 . recenter) (23 . delete-and-edit) (18 . edit) (46 . act-and-exit) (return . exit) (13 . exit) (113 . exit) (44 . act-and-show) (69 . edit-replacement-exact-case) (101 . edit-replacement) (78 . skip) (89 . act) (110 . skip) (121 . act) (backspace . skip) (delete . skip) (127 . skip) (32 . act)) nil t)
  yes-or-no-p("Buffer \" *http api.languagetool.org:443*-792808\" h...")
  process-kill-buffer-query-function()
  flymake-languagetool--check(#f(compiled-function (&rest args) #<bytecode 0x1564483036705084>))
  flymake-languagetool--checker(#f(compiled-function (&rest args) #<bytecode 0x1564483036705084>) :recent-changes ((138 138 "")) :changes-start 138 :changes-end 138)
  apply(flymake-languagetool--checker #f(compiled-function (&rest args) #<bytecode 0x1564483036705084>) (:recent-changes ((138 138 "")) :changes-start 138 :changes-end 138))
  flymake--run-backend(flymake-languagetool--checker (:recent-changes ((138 138 "")) :changes-start 138 :changes-end 138))
  #f(compiled-function (backend) #<bytecode 0x34d8551f71f4c8d>)(flymake-languagetool--checker)
  flymake-start(t)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_45>(#<buffer macros.md>)
  apply(#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_45> #<buffer macros.md>)
  timer-event-handler([t 0 0 500000 nil #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_45> (#<buffer macros.md>) idle 0 nil])

Sometimes I also end up with recursive editing mode after saving the file. This is when the question happen in minibuffer.

I'm using GNU Emacs 29.2 and just installed the package from Melpa.

tpeacock19 commented 6 months ago

Thanks for the report. For a bit more information, does this happen with every file you open or a single one? If the latter, do you mind sharing a copy of the document? You can do so privately if you prefer it not be on GitHub.

Also, it states that two backends are disabled, can you let me know what other flymake backend is used?

Ideally, if you can reproduce this using emacs -Q and a very basic init file it would be helpful as well.

jcubic commented 6 months ago

I tested it in two different markdown files. Can reproduce it in emacs -Q, the second error is invisible unless you have debugger on error enabled.

tpeacock19 commented 6 months ago

I was able to reproduce your issue. Can you try out that pull request mentioned above, or using the branch fix/warnings and let me know if this helps?

jcubic commented 6 months ago

Sure, will check, that was pretty fast.

jcubic commented 6 months ago

It's not fully fixed. What I had was the prompt and error that appear shortly after, it created recursive edit. But when I called [2]M-x exit-recursive-edit from inside minibuffer I was able to give "y" to the prompt and didn't get the error again.

I'm not sure if the same was before, I just learned about recursive edit and how it exit it.

tpeacock19 commented 6 months ago

It is not entirely clear to me what you mean. I do not know if you are having the same issues. Can you please share the bare configuration that you used with emacs -Q and an example file.

jcubic commented 6 months ago

I still can reproduce with emacs -Q. This is the file:

https://github.com/jcubic/lips-website/blob/docusaurus/docs/docs/scheme-intro/macros.md

And my config look like this:

(add-to-list 'load-path "/home/kuba/projects/emacs-modes/flymake-languagetool")

(setq flymake-languagetool-server-jar nil)
(setq flymake-languagetool-url "https://api.languagetool.org")

(require 'flymake-languagetool)

(defun markdown ()
  (interactive)
  (setq fill-column 100)
  (if (let ((name (buffer-file-name)))
        (or (string-match-p "jcubic/www/blog/repo" name)
            (string-match-p "jcubic/www/jankiewicz" name)
            (string-match-p "/pl/" name)))
      (setq-local flymake-languagetool-language "pl-PL")
    (setq-local flymake-languagetool-language "en-US"))
  (flymake-languagetool-load)
  (flymake-mode))

I open the file (linked above) and run M-x markdown, try to edit, and save.

tpeacock19 commented 6 months ago

Okay, I think the latest commit (0f8c1ed24858cf72bc84fdce88cb54fb9ba8ed65) on this branch should fix it. let me know whenever you have time. Thanks for your patience.

jcubic commented 6 months ago

Yes, it seems to work now. Thanks.