Emacs: Why I Don't Use paredit

By Xah Lee. Date: . Last updated: .

i don't use paredit because i despise its manual diddling with code formatting as core concept. On the surface, it appears to be a semantic-unit-based editor. Namely, you edit code by the language's semantic units. But, at its core, it's really a helper tool for hard-formatting, with concerns about indentation, line width, etc.

Why is paredit not a semantic unit based editor?

here's a simple test. Supppose i have this emacs lisp code:

(defun insert-p-tag () "Insert <p></p> at cursor point." (interactive) (insert "<p></p>") (backward-char 4))

using paredit, can i press a button and transform it to the following?

(defun insert-p-tag ()
  "Insert <p></p> at cursor point."
  (insert "<p></p>")
  (backward-char 4))

what language editors can do this? XML editors can, Mathematica can, golang gofmt can.

in order to have such a editor, first of all you need a language whose syntactic structure corresponds to semantic units. XML, Mathematica, LISP, are such languages. (it needs not be nested. I think APL also qualify.)

then, you need people working with such languages aware of this correspondence. The typical Lisp hacker types of past 2 decades don't understand this, in fact, they often insist hard-coded formatting. For example, lisp communities advertise where closing paranthesis should be positioned. Here's a quote from emacs lisp manual:

Don't make a habit of putting close-parentheses on lines by themselves; Lisp programmers find this disconcerting.

(from Gnu Emacs Lisp Reference Manual. (info "(elisp) Coding Conventions"))

〔➤see Emacs Lisp: Automatic Code Formatting, Auto Indentation

Google's new language golang, is a good one in this respect. Because: ① it enforce using tab for indentation, not spaces. 〔➤see Computer Programing: Tabs vs Spaces in Source Code〕② It has syntax reformat tool (aka lint) builtin, as part of the language platform. See the “Mechanical source transformation” section at http://blog.golang.org/go-fmt-your-code. This point lispers don't get. See: Programing Language: Fundamental Problems of Lisp.

Alternative to ParEdit

See: Emacs: ParEdit, Smartparens, Lispy, and ErgoEmacs, xah-fly-keys.

Like it? Buy Xah Emacs Tutorial. Thanks.