I have tried to search Google and look in the manual, but still cannot find how to get major mode of a buffer object. Can you help me with an example or a reference. Thanks
only solution I could find was to query major-mode after changing the buffer and then changing back to original buffer. Is there a better way to do it?
(with-current-buffer buffer-or-string major-mode)
instead ofsave-excursion
. – Alonaalone