lisp-paredit
lisp-paredit copied to clipboard
Enter key not working
For reasons I can't explain, lisp-paredit won't respond to the enter key. The enter key works fine outside Atom or with lisp-paredit disabled.
The tricky bit: I have no idea how to reproduce this bug.
Atom version 1.4.0 (highest available through my package manager at the moment)
Ubuntu 14.04.3 LTS
Lisp-paredit 0.5.2
A few questions: Does it not respond at all or is it an intermittent problem? Did it start happening today or beforehand? Are there any errors in the console (View -> Developer -> Toggle Developer Tools) after it occurs?
Wow, thanks for the fast response! It doesn't respond at all, anywhere in the document. It started happening last week, round about Thursday 21st Jan.
Nothing at all appears in the console when I intentionally trigger the error.
ok, I have figured it out! The package itself was enabled, but in the lisp-paredit settings, somehow the "Enabled " had become unchecked. A colleague of mine was able to reproduce the same behaviour.
Is it only lisp documents affected?
One thing you can do is turn on the keybinding resolver (Cmd-. on Mac, probably Ctrl-. on linux) then hit enter. Do you see the lisp-paredit:newline command at the top? Something like this
.
Ok thanks, sounds like a bug in the enable toggle.
I was able to resolve by going to settings > core > Packages with Keymaps Disabled > *removed lisp-paredit. Thsi got me the indentation back correctly.
What is the status on this one? I am also having this issue. I can't find the Packages With Keymaps Disabled
option in Atom 1.7.4 settings any more - has it been removed?
I have a problem similar to the above when editing a .lisp file:
- With lisp-paredit enabled the Enter key correctly inserts a newline but the cursor immediately goes to the start of the previous line.
- With lisp-paredit toggled off, the Enter key does not work at all.
In both cases, the key binding resolver shows "lisp-paredit-newline" in green when I press the Enter key.
On a regular (non Lisp) file, the Enter key works normally and the key binding resolver shows "editor:newline" (same behaviour with lisp-paredit toggled on or off).
@Adrien79 I have the same problem, did you find a solution?
Edit: For the record, I found the solution in my case, so simple... In case you are using Windows too, just alter the line ending to CRLF! 😆
Thanks
I was having a similar issue on windows. Where |
is the cursor location.
(do something
something)|
Pressing enter while using CRLF results in:
(do something
something)|
; NEW LINE CREATED with no indent, but cursor remains upper line
And the cursor doesn't move. Changing to LF endings works much better resulting in
(do something
something)
|
Inside the ()
works well in either mode.
Same problem on windows. Looks like line ending issue. Also, probably the same issue, the delete key does not work in that situation at the end of the line.
The issue describes my the newer comments relates to assumptions about line endings in the underlying paredit.js library. Specifically, in the indentRange function. Changing the split regex to /\r\n|[\n\v\f\r\x85\u2028\u2029]/
partially helps, but there are still some indexing issues that I haven't figured out yet.
Relatedly, the delete key issue comes from trying to delete a single character, but needing to delete a pair of characters.