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

[Fix #586] Fix emacs freezing when opening file containing "comment" #651

Merged
merged 3 commits into from
Jun 23, 2023

Conversation

OknoLombarda
Copy link
Contributor

Fixes #586
Context #586 (comment)


Before submitting a PR mark the checkboxes for the items you've done (if you
think a checkbox does not apply, then leave it unchecked):

  • The commits are consistent with our contribution guidelines.
  • You've added tests (if possible) to cover your change(s). Bugfix, indentation, and font-lock tests are extremely important!
  • You've run M-x checkdoc and fixed any warnings in the code you've written.
  • You've updated the changelog (if adding/changing user-visible functionality).
  • You've updated the readme (if adding/changing user-visible functionality).

Thanks!

Copy link
Member

@vemv vemv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - thanks much for the fix!

clojure-mode.el Show resolved Hide resolved
test/clojure-mode-sexp-test.el Outdated Show resolved Hide resolved
test/clojure-mode-sexp-test.el Outdated Show resolved Hide resolved
@OknoLombarda
Copy link
Contributor Author

@vemv, @bbatsov, can someone please take a look and accept PR or tell me what else I should improve

@@ -6,6 +6,10 @@

* Font-lock Lein's `defproject` as a keyword.

### Bugs fixed

* [#586](https://github.com/clojure-emacs/clojure-mode/issues/586): Fix infinite loop when opening file containing `comment` with `clojure-toplevel-inside-comment-form` set to `t`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, is this specific to comment or to just having a single form in the buffer? Looking at the code it's the latter.

Copy link
Contributor Author

@OknoLombarda OknoLombarda Jun 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If function clojure-sexp-starts-until-position is called directly, then yes, it will loop forever for any single form in buffer. But this bug is triggered without user doing anything (except for opening the buffer) only when there's just comment in buffer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would seem wise to create an issue for that edge case - having a more robust building block would make bugs less likely, in a future.

Other than that it seems good to merge this PR in!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #652

@vemv vemv merged commit 47ce793 into clojure-emacs:master Jun 23, 2023
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

Successfully merging this pull request may close these issues.

Emacs is stuck when opening file containing comment when clojure-toplevel-inside-comment-form is t
3 participants