Skip to content

font-lock mode hangs with unbalanced left-parenthesis in type signature near top of long file #1344

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

Closed
ChrisKuklewicz opened this issue May 31, 2016 · 6 comments

Comments

@ChrisKuklewicz
Copy link

I am running Emacs (GNU Emacs 24.5.1 (i686-pc-mingw32)) on Windows, and haskell-mode 1.5

When I am in a big haskell file (1000 lines) and at the bottom of the file I can type a new line:

foo :: (some text goes here

This works well and performance appears fine.

But if I type that at the top of the file (just under the import statements for instances) then once I hit the left-parenthesis (which is unbalanced) the rate of response from Emacs drops to less than one character per second, often I have to wait for 10 to 20 seconds for any of "some text goes here" to appear in the buffer after the left parenthesis.

Note that this performance bug only occurs when the unbalanced left parenthesis is part of a type, not when it is part of a normal expression.

This is such a serious performance bug it essentially hangs Emacs. I have to disable font-lock mode when editing many haskell files.

@ChrisKuklewicz
Copy link
Author

Using profile-report in Emacs, it appears to blame haskell-syntax-propertize, but I have no practice at profiling elisp.

@gracjan
Copy link
Contributor

gracjan commented May 31, 2016

Culprit is here:

((member (match-string-no-properties 0)

I guess we cannot rely on balanced parentheses in type declarations.

@ChrisKuklewicz
Copy link
Author

Good to know where the 20 second delay comes from. Quickly failing to balance and not updating highlighting should be okay. Too bad there is no background thread for this sort of thing.

@gracjan
Copy link
Contributor

gracjan commented May 31, 2016

I've found a better solution.

@gracjan
Copy link
Contributor

gracjan commented May 31, 2016

@ChrisKuklewicz, fixed. It should be on melpa even today.

@ChrisKuklewicz
Copy link
Author

Awesomely fast response, thanks!

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

2 participants