有无快速删除区域中的所有空格的简单方法?

碰到类似的问题,Chatgpt 给出的结果,只删除中文字符之间的空格:

 (defun remove-multiple-spaces-between-chinese ()
  "Remove one or more spaces between Chinese characters."
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "\\([[:multibyte:]]\\) +\\([[:multibyte:]]\\)" nil t)
      (replace-match "\\1\\2"))))
1 个赞