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 "_"))))