Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs hangs when clojure-toplevel-inside-comment-form is t, and comment is used as a var #639

Open
Ramblurr opened this issue Nov 8, 2022 · 5 comments

Comments

@Ramblurr
Copy link

Ramblurr commented Nov 8, 2022

Expected behavior

I can edit code with comment shadowed from clojure.core without the editor hanging. (Whether or not I should do this in the first place is a lesson I should probably learn but the editor shouldn't hang in any case)

Actual behavior

When clojure-toplevel-inside-comment-form is t and comment is used in a buffer as a clojure var, emacs hangs indefinitely until C-ged.

See discussion here: https://clojurians.slack.com/archives/C099W16KZ/p1667918713039869

Here is a stacktrace when C-ged:

scrn-2022-11-08-17-09-25

Steps to reproduce the problem

(ns bug
  (:refer-clojure :exclude [comment]))


(def comment {:comment/body "I probably shouldn't be using comment"})

Load up that code, ensureclojure-toplevel-inside-comment-form is t, and then navigate edit inside and round the comment var or in the map.

Environment & Version information

clojure-mode version

I'm using doom which uses clojure-mode from git. The git hash of clojure-mode I'm using is 414157c3e523e80cc44dca8f86f1853122ee5f6b

Emacs version

GNU Emacs 28.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-07-15 [2 times]

Operating system

Fedora Silverblue 36

@Ramblurr Ramblurr changed the title Emacs hangs when clojure-toplevel-inside-comment-form is t, and 'comment' is used as a var Emacs hangs when clojure-toplevel-inside-comment-form is t, and comment is used as a var Nov 8, 2022
@vemv
Copy link
Member

vemv commented Nov 9, 2022

It would be interesting to see if this can be reproduced in our CI; that is to discard the possibility that this issue cannot be reproduced without the other libs also seen in the stacktrace (related to markdown and lsp).

Should be easy enough.

@OknoLombarda
Copy link
Contributor

Tried to reproduce on my machine (Prelude), but did not notice any hanging

@practicalli-johnny
Copy link

I experience what seems to be very similar issue with a (comment ) form hanging when I have both clojure-toplevel-inside-comment-form t and Clojure LSP and Lsp-mode enabled.

I navigate the cursor to the opening paren, ( and the cursor stops and cpu is 100%

Some editing within the (comment ) form can also cause the issue, although this is intermittent.

C-g pressed several times will kill what ever process is causing 100% CPU.

Shutting down the LSP server resolves the issue.
Restarting Emacs with clojure-toplevel-inside-comment-form nil also resolves the issue

I have experience the issue on both Spacemacs and Doom Emacs setups

@prestancedesign
Copy link

Yes same experience here and found this related issue #586.

@practicalli-johnny
Copy link

I have set lsp-eldoc-enable-hover to nil in my Emacs LSP (lsp-mode / lsp-ui) config and no longer have the issue with using clojure-toplevel-inside-comment-form

If I understand the slack discussion correctly, LSP is asking clojure-mode to font-lock doc-strings and causing a process to eat up the cpu.

lsp-eldoc-enable-hover is responsible for triggering the documentation pop-ups when moving the cursor or mouse over function names and seems to be running even if you have otherwise disabled those popups. Setting lsp-eldoc-enable-hover as nil ensures lsp doesnt call clojure-mode for this each time and therefore the problem is not tiggered.

(setq lsp-eldoc-enable-hover nil)

Obviously if the LSP hover functionality is desirable, then this is not a valid approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants