Defindit Docs and Howto Home
title:Emacs paste at cursor, unfill paragraph
description:Emacs paste at cursor, unfill paragraph
You may have noticed that when you paste into an X-windows (graphical)
Emacs session, the insertion point becomes the location of the mouse
cursor. This is a minor irritatant since you almost always want to
insert at the current text cursor location. (And if you wanted to move
the text cursor, you could left-click at that new location. Moving the
text cursor upon middle-click is inconsistent and odd to my view of
the UI.)
There is an easy fix. Add this line to your .emacs or .xemacs/init.el file:
(setq mouse-yank-at-point t)
Every now and then you may want to unfill a paragraph. This would be
the opposite of fill-paragraph. The naive solutions simply set the
fill-column to some very large number. It is unlikely that I'll have a
paragraph with 10000000 characters, but that naive method is inelegant.
If found the following bit of code is slightly better because it uses
point-max (a function) as the fill-column value. Using the function
unfill-paragraph does not alter your fill-column value.
;;; Stefan Monnier <foo at acm.org>. It is the opposite of fill-paragraph
;;; Takes a multi-line paragraph and makes it into a single line of text.
(defun unfill-paragraph ()
(interactive)
(let ((fill-column (point-max)))
(fill-paragraph nil)))
You could put this in your .emacs file and bind it to a key (or not I
suppose) or you could paste it into your *scratch* buffer and hit C-j
at the end of the last line.
The *scratch* buffer is a "Lisp interaction" buffer which means that
Lisp statements in this buffer are executed if you type C-j at the end
of the statement. The "result" of the statement will print after you
type C-j (control-j).