The one thing I consistently do in emacs that shocks my coworkers -- is running this (custom) function, that I call "arrayify": (defun arrayify (start end quote) "Turn strings on newlines into a QUOTEd, comma-separated one-liner." (interactive "r\nMQuote: ") (let ((insertion (mapconcat (lambda (x) (format "%s%s%s" quote x quote)) (split-string (buffer-substring start end)) ", "))) (delete-region start end) (insert in…
I usually end up doing that in two steps, with the first being a recursive macro to quote each line:
q y s $ " A , 0 j @ q
Then visually selecting and replacing new lines with spaces: V G :s/CTRL+Q CTRL+J/ /g