diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-12-16 01:14:28 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-12-16 01:14:28 -0500 |
commit | 4f55bdf9befbcf5d13dda5e857700db8b6bea70e (patch) | |
tree | b3c9959908a7d79585fad510ad15032d1537ce4e | |
parent | 8f6e15f84ca640f77c0592a7d25675f439f00714 (diff) | |
download | emacs.d-4f55bdf9befbcf5d13dda5e857700db8b6bea70e.tar.gz |
Add command reduce-to-single-spaces
-rw-r--r-- | lisp/init-editing.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/init-editing.el b/lisp/init-editing.el index 1842ebb..2f4840d 100644 --- a/lisp/init-editing.el +++ b/lisp/init-editing.el @@ -63,6 +63,15 @@ special case. (setq end (point)))) (fill-region (or beg (point-min)) (or end (point-max)))))) +(defun km/reduce-to-single-spaces () + "Reduce consecutive blank lines to a single line." + (interactive) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\\([ \t]*\n\\)\\{3,\\}" nil t) + (forward-line -1) + (delete-blank-lines)))) + (define-key search-map "s" 'query-replace) (define-key search-map "S" 'replace-string) (define-key search-map "r" 'query-replace-regexp) |