4

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 9 '14 at 21:47
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.