Depending on your team, you can:
M-: (mapc (lambda (b) (set-buffer b) (*command*)) (buffer-list))
But I have a feeling that you want something not too lazy. See keyboard macros . Namely, decide what you want to do:
C-x ( <do-your-command> C-x )
M-: (mapc (lambda (b) (set-buffer b) (kmacro-end-and-call-macro)) (buffer-list))
You will probably want to define this last part as a function if you use it a lot:
(defun bufdo ()
"execute last macro on all buffers, ala bufdo from vi"
(interactive)
(mapc (lambda (b)
(with-current-buffer b
(kmacro-end-and-call-macro)))
(buffer-list)))
Note: code not verified
source
share