abo-abo / lispy

Short and sweet LISP editing
http://oremacs.com/lispy/
1.2k stars 132 forks source link

lispy-parens inserts extraneous space when at SLY prompt #550

Open Ambrevar opened 3 years ago

Ambrevar commented 3 years ago

Recipe:

Result:

CL-USER>  ()

instead of the expected

CL-USER> ()

Took me a while to figure this one out, turns out that the issue is in lispy--delimiter-space-unless:

(defun lispy--delimiter-space-unless (preceding-syntax-alist)
  "Like `lispy--space-unless' but use PRECEDING-SYNTAX-ALIST for decision.
PRECEDING-SYNTAX-ALIST should be an alist of `major-mode' to a list of regexps.
When `looking-back' at any of these regexps, whitespace, or a delimiter, do not
insert a space."
  (lispy--space-unless
   (concat "^\\|\\s-\\|" lispy-left
           (lispy--preceding-syntax preceding-syntax-alist "\\|"))))

The problem is that \\s- does not match in the SLY REPL because spaces are not in the syntax table.

Easy fix: change \\s- for [[:space:]].