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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] changed section end    
    (if (or (looking-at "^\\|\\s)")
            (save-excursion (forward-char -1)
                            (looking-at "$\\|\\s(\\|\\s'")))
        nil
      (insert ?\s))))

Enjoy!

Andreas Röhler


_______________________________________________
gnu-emacs-sources mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources

Reply via email to