Created
September 17, 2019 20:48
-
-
Save enisozgen/dc7aff180d2ecf6824055fe47de0d437 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Works as famous command which is exist in simple.el | |
# https://github.com/emacs-mirror/emacs/blob/cbc10ec71e9f189e8d6fd5c6927aec4872e0fd96/lisp/simple.el#L957 | |
# + Feature that I implement for function is you can select text as region than it will delete spaces if it's more than 1. | |
# - Feature: Base function allows you leave (n)Space I don't need this, so it is not exist. | |
(defun just-one-space-region (begin end) | |
"Deletes whitespaces for selected region if they more than one" | |
(interactive "r") | |
(if (use-region-p) | |
(save-excursion | |
(narrow-to-region begin end) | |
(goto-char (point-min)) | |
(while (search-forward-regexp " " (point-max) 'NOERROR) | |
(progn | |
(fixup-whitespace) | |
(forward-char))) | |
(widen))) | |
(fixup-whitespace)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is currently some bug in the code. I'll update for later.