22 June 2009


If you use Emacs to compose text that you paste into web forms (like, say, blog posts on blogger), you might want to remove the hard returns on the end of every line. Otherwise, you may get random spurious line breaks when the post is reformatted by a program that replaces \n with
or something equally awful. Here's a piece of code I found ages ago that provides a simple command to undo the formatting.
;; swiped from http://linux.umbc.edu/lug-mailing-list/2002-06/msg00300.html
(defun unfill-paragraph ()
(let ((saved-fill-col fill-column))
(setq fill-column 9999999)
(fill-paragraph nil)
(setq fill-column saved-fill-col)

(global-set-key "\C-c`" 'unfill-paragraph)

Just add it to your .emacs.el. To use it without restarting emacs, run M-x eval-buffer on .emacs.el.

No comments:

Post a Comment

About Me

blog at barillari dot org Older posts at http://barillari.org/blog