-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
Indent very slow #606
Comments
This basically means we try harder to find an indentation spec for the current context (where your cursor is). As you can imagine that's slower, but yield better results in some case. See: (defun clojure--find-indent-spec ()
"Return the indent spec that applies to current sexp.
If `clojure-use-backtracking-indent' is non-nil, also do
backtracking up to a higher-level sexp in order to find the
spec."
(if clojure-use-backtracking-indent
(save-excursion
(clojure--find-indent-spec-backtracking))
(let ((function (thing-at-point 'symbol)))
(clojure--get-indent-method function)))) I'm open ideas how to make the indentation work faster. |
If someone is using fixed indentation ( |
@bbatsov It appears that when I turn it off, defprotocol and reify get indented incorrectly. Is this intended? |
Yeah, that's expected. Otherwise we wouldn't need the complicated backtracking indent. :-) I'll add some note to the docs, so it's clearer. |
But I'm talking about indenting the form as a whole, i. e. not from "where your cursor is" or having to look at a higher nesting level. |
Yeah, I understand this, but such forms are essentially composed of several definitions and can't be indented directly without extra work. At least not with the current state of the indentation engine. |
Use the template below when reporting bugs. Please, make sure that
you're running the latest stable clojure-mode and that the problem you're reporting
hasn't been reported (and potentially fixed) already.
Please, remove all of the placeholder text (the one in italics) in your final report!
Expected behavior
Fast
Actual behavior
Slow
Steps to reproduce the problem
Indent about a 1000 lines with little nesting.
After using the profiler, I determined that I can set
clojure-use-backtracking-indent
to nil and get a nice speedup of about 90%. I don't know what it does ("When non-nil, enable context sensitive indentation."??) - Still its too slow and takes more than a second. My machine is not the fastest, but 2 Ghz should suffice to indent a few pages of text in less than a second in a text editor.This is extremely important! Providing us with a reliable way to reproduce
a problem will expedite its solution.
Environment & Version information
clojure-mode version
5.13.0
Include here the version string displayed by
M-x clojure-mode-display-version
. Here's an example:Emacs version
E.g. 24.5 (use C-h C-a to see it)
26.3
Operating system
E.g. Windows 10
The text was updated successfully, but these errors were encountered: