Skip to content

Instantly share code, notes, and snippets.

@theanalyst
Last active December 11, 2015 20:48
Show Gist options
  • Save theanalyst/4657278 to your computer and use it in GitHub Desktop.
Save theanalyst/4657278 to your computer and use it in GitHub Desktop.
Removes non printable (possibly control characters) in files
(defun remove-non-print-ascii()
"Remove non printable ascii characters from buffer"
(interactive)
(save-match-data
(save-excursion
(goto-char (point-min))
(while (re-search-forward "[^ -~\n]" (point-max) t)
(replace-match "" nil nil))
(message "Removed non-printable ascii chars"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment