Wrapping (filling) a long list of lines in Emacs (clojure -mode)

In Emacs (in Clojure mode) I want to populate this:

(def items
  ["freezing" "drum" "lean" "deputy" "deputy" "session" "critic" "ace" "rat" "racket" "trap" "inconvenient" "guidance" "ruins"])

      

To make it look like this:

(def items
  ["freezing" "drum" "lean" "deputy" "deputy" "session" "critic" "ace"
   "rat" "racket" "trap" "inconvenient" "guidance" "ruins"])

      

I am looking for a function to do this. I have tried, unsuccessfully:

  • M-q

    (for example paredit-reindent-defun

    )
  • C-u M-q

    (for example paredit-reindent-defun

    )
  • M-x fill-paragraph

  • C-u M-x fill-paragraph

+3


source to share


2 answers


fill-region-as-paragraph

- Is this what you want.



You can optionally print (to string or buffer) using a function from the library pp.el

before filling. Pretty-printing will not fill, but if you are showing a Lisp sexp it will greatly change the width and readability of the line.

+3


source


lispy-fill

can do it.

The gif below fill-column

is in 70

and:



  • M-q fills in
  • fand hmove the cursor
  • O un-fill

lispy-fill

+1


source







All Articles