-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Buffer freezes on (def ^{:macro})
#612
Comments
(def ^{:macro})
I can repro this by invoking I could also fix it by changing here: Lines 757 to 758 in c339353
-(progn (forward-sexp) (backward-sexp))
+(forward-sexp) I can't make sense of With my changed version, it completes and the function still does what I believe it does. I have no idea of what |
...according to Git blame, all this code is remarkably old and therefore presumably stable. Maybe this |
I use imenu all the time, but then again I rarely type |
I've looked into this problem and managed to figure out the cause of infinite loop, I think. This (def ^String foo "bar") before moving, the point will be just after the word I'm new to Clojure and don't know a single thing about Emacs Lisp, but here's a solution I came up with Line 757 in c339353
- (if (char-equal ?^ (char-after def-beg))
- (progn (forward-sexp) (backward-sexp))
+ (when (char-equal ?^ (char-after def-beg))
+ (progn (forward-sexp) (backward-sexp)))
+ (when (or (not (char-equal ?^ (char-after (point))))
+ (and (char-equal ?^ (char-after (point))) (= def-beg (point))))
(setq found? t)
(when (string= deftype "defmethod")
(setq def-end (progn (goto-char def-end)
(forward-sexp)
(point))))
(set-match-data (list def-beg def-end))) So, when metadata symbol is encountered, function will try to move to the beginning of the next sexp, and if the point is still where it was before, then it should exit the loop |
Released as clojure-mode 5.15.0, which will be available within a couple hours |
Thanks! |
Expected behavior
When I have
(def ^{:macro})
in my buffer (as the only code), I should see no freezing of emacs.Actual behavior
Emacs with clojure-mode freezes.
Steps to reproduce the problem
Put
(def ^{:macro})
as the sole code in a clojure buffer. Try to move the cursor a bit back and forth.When Emacs freezes, send:
and then see something like:
@vemv hinted that this looked suspicious:
clojure-mode/clojure-mode.el
Line 749 in c339353
Environment & Version information
clojure-mode version
Emacs version
27.2
Operating system
macOS
The text was updated successfully, but these errors were encountered: