Tuesday, January 29, 2008

emacs - a simple search and replace function

This function is for emacs; it searchs for any sequence composed of spaces and tabs and replaces it with a single tab


(defun space-and-tabs-to-tab()
(interactive)
(while (re-search-forward "[\t ]+" nil t)
(replace-match "\t" nil nil)))