Created
March 15, 2017 17:05
-
-
Save et2010/d7a547d689f65345a06011a35f5044f1 to your computer and use it in GitHub Desktop.
Remove needless whitespace when joining two lines in Chinese
This file contains 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
(defun et/fixup-whitespace () | |
"Fixup white space between objects around point. | |
Leave one space or none, according to the context." | |
(interactive "*") | |
(save-excursion | |
(delete-horizontal-space) | |
(if (or (looking-at "^\\|\\s)") | |
(save-excursion (forward-char -1) | |
;; we adapted the regexp here: | |
(looking-at "\\cc\\|$\\|\\s(\\|\\s'"))) | |
nil | |
(insert ?\s)))) | |
(defun et/delete-indentation (old-func &rest args) | |
(cl-letf (((symbol-function 'fixup-whitespace) #'et/fixup-whitespace)) | |
(apply old-func args))) | |
(advice-add #'delete-indentation :around #'et/delete-indentation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment