On Mon, Jan 15, 2007 at 02:43:11PM +0000, Thorsten Glaser wrote:
> Dirk Nehring dixit:
>
> >Some nice macro for vim users (.vimrc):
>
> Interesting. (Except don't use it for mail signatures
> or prevent ^-- $ from being matched ;)
I'll drop that space for many years, nobody complaint until yet ;-) If
anyone like, here is the .emacs code:
-------------------------------------
;; ********************************
;; * Spaces am Zeilenende löschen *
;; ********************************
(defvar strip-buffer-flag t
"*Set to non-nil means strip the buffer before writing it to disk.
See strip-buffer documentation.")
(defun my-strip-buffer ()
"Remove trailing blanks on each line and delete trailing blank lines."
(interactive)
(if (not buffer-read-only)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "[ \t]+$" (point-max) t)
(replace-match ""))
(goto-char (point-min))
(delete-matching-lines "^\n+\\'"))))
(add-hook 'write-file-hooks
(function
(lambda ()
(if strip-buffer-flag (my-strip-buffer))
nil)))
-------------------------------------
Dirk
_______________________________________________
freewrt-developers mailing list
[email protected]
https://www.freewrt.org/lists/listinfo/freewrt-developers