Adam Hardy <emacs@cyberspaceroad.com> writes:
I am using a brute force method of stopping myself from writing long
lines of code, using this in my .emacs:
(defun my-dont-insert-after-fill-column (&rest x)
(when (> (current-column)
fill-column)
(delete-char -1)
(beep)))
(add-hook 'after-change-functions 'my-dont-insert-after-fill-column)
But I discovered this is also acting on the command buffer, so I
cannot add more than my fill column when doing simple file copies or
renames or text search & replaces.
Well, you could just check whether the current buffer is the
minibuffer:
(when (and (not (minibufferp))
(> (current-column)
fill-column))
...)