emacs lisp, how to get buffer major mode?
Is there a problem with that? (defun buffer-mode (buffer-or-string) “Returns the major mode associated with a buffer.” (with-current-buffer buffer-or-string major-mode)) with-current-buffer will restore your buffer when it returns.