удобная штука "заменить во всех открытых буферах"
(defun query-replace-in-open-buffers (arg1 arg2)
"query-replace in open files"
(interactive "sQuery Replace in open Buffers: \nsquery with: ")
(mapcar
(lambda (x)
(find-file x)
(save-excursion
(beginning-of-buffer)
(query-replace arg1 arg2)))
(delq
nil
(mapcar
(lambda (x)
(buffer-file-name x))
(buffer-list)))))