Я использую это при преобразовании кода C # в PHP.
(defun un-camelcase-word-at-point ()
"un-camelcase the word at point, replacing uppercase chars with
the lowercase version preceded by an underscore.
The first char, if capitalized (eg, PascalCase) is just
downcased, no preceding underscore.
"
(interactive)
(save-excursion
(let ((bounds (bounds-of-thing-at-point 'word)))
(replace-regexp "\\([A-Z]\\)" "_\\1" nil
(1+ (car bounds)) (cdr bounds))
(downcase-region (car bounds) (cdr bounds)))))
А потом в моем php-режиме fn:
(local-set-key "\M-\C-C" 'un-camelcase-word-at-point)