The one thing I consistently do in emacs that shocks my coworkers -- is running this (custom) function, that I call "arrayify":<p><pre><code> (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 insertion)))
</code></pre>
What it does: Given a list of strings separated by newlines (commonly, something copy-pasted from a table) like:<p><pre><code> josh
sam
jed
C.J.
toby
</code></pre>
You select the text, and run "arrayify". You can optionally provide a quote character and, in about half a second, get to:<p><pre><code> "josh", "jed", "sam", "C.J.", "toby"
</code></pre>
This is incredibly useful for taking lists of IDs, or email addresses, or whatever, and transforming them for pasting into documents, or emails, or "in" clauses in SQL, etc.<p>It is <i>unbelievably</i> useful.