Issue #88 resolved

Noticable delay when opening new line

Dave Ray avatarDave Ray created an issue

To reproduce:

  • Open a new, empty Clojure buffer
  • Hit o to open a new line

There's about a one second delay before the operation completes. The same thing happens with opening a line above (shift-o). The delay seems independent of the size of content of the file. It's the same in an empty file or a 3000 line file.

I did some basic diagnosis. First note that clearing indentexpr remove the delay, and, of course, proper indenting. It's interesting that indenting by hitting enter at the end of a line has no delay.

Here's one thing I noticed: in indent/clojure.vim, add a "return 0" at the start of CheckForString(). The delay goes away. Now move the return statement to immediately after the definition of the closure function, but before the call to WithSavedPosition(). The delay returns. It's as if the definition of the closure function is the slowdown. I'm guessing there will be a similar problem with IsMethodSpecialCase().

Thoughts? I've chatted on Twitter with someone who has the same problem and I've seen it on both OSX and Linux.

Comments (4)

  1. Meikel Brandmeyer
    • changed status to open

    Wah. This issue is so old. It was reported one hundred times. And I never found this reason, because I looked for code which actually did something. *geez*

    Thanks a thousand times for tracking down the problem, Dave!

  2. Dave Ray

    No problem. Just remember me when you hit it big with vimclojure :)

    ah, function("NameOfFunction") is the trick. I actually tried extracting the anonymous funcs myself, but my vimscript was weak and I couldn't get it to work.

  3. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.