5

paredit restricts my editing freedom to guarantee me that my s-expressions are never unbalanced. Unfortunately, hippie-expand doesn't care a bit about rules and manages to disturb the balance by expanding to syntactically wrong text (e.g. text containing a couple of parentheses more than would be appropriate in the current context).

Cleaning up after the hippie is a chore; I have to disable paredit temporarily to delete the superfluous parentheses and reenable it afterward.

Can the hippie be made aware of paredit's efforts to keep the buffer clean? Is there an alternative expansion feature that is more well-behaved when paredit is around? Or is there a way to make paredit (or something like it) clean up invalid expansions automatically?

  • 1
    Not an answer, but you can directly insert parentheses with `C-q (`, and you can delete parentheses by marking them and killing the region with `C-w`. Those aren't overridden by paredit's own commands. – Kirill Dec 09 '14 at 21:47

1 Answers1

5

The problem you mentioned is why I remove the functions try-expand-line and try-expand-list from the list of functions hippie-expand uses to produce expansions. This doesn't really solve the problem but may be an acceptable workaround.

(dolist (f '(try-expand-line try-expand-list))
  (setq hippie-expand-try-functions-list
        (remq f hippie-expand-try-functions-list)))

So hippie-expand will still complete words, symbols, etc., but not full lines or lists - the things that are probably introducing excess delimiters.

jbm
  • 382
  • 1
  • 5