[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fixup-whitespace (snippet)
From: |
Andreas Röhler |
Subject: |
fixup-whitespace (snippet) |
Date: |
Wed, 28 Nov 2007 22:25:18 +0100 |
User-agent: |
KMail/1.9.5 |
A fixup-whitespace working over multiple lines
(defun fixup-whitespace ()
"Fixup white space between objects around point.
Leave one space or none, according to the context."
(interactive "*")
(save-excursion
;; 2007-11-28 address@hidden changed section start
(skip-chars-backward " \t\r\n\f")
(set-mark (point))
(skip-chars-forward " \t\r\n\f")
(kill-region (point) (mark))
;;; (delete-horizontal-space)
;; 2007-11-28 address@hidden changed section end
(if (or (looking-at "^\\|\\s)")
(save-excursion (forward-char -1)
(looking-at "$\\|\\s(\\|\\s'")))
nil
(insert ?\s))))
Enjoy!
Andreas Röhler
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- fixup-whitespace (snippet),
Andreas Röhler <=