Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将标记的文本区域更改为由下划线连接的所有小写单词。例如:
A fox caught a bird => a_fox_caught_a_bird
Emacs 23中的功能是什么?
没有内置函数可以满足您的需求,但此代码段可以解决问题。
(defun lower-and-concat (b e) (interactive "r") (save-restriction (narrow-to-region b e) (goto-char (point-min)) (downcase-region b e) (while (re-search-forward "[ \t]+" nil t) (replace-match "_"))))