** C-x C-w, which saves the buffer into a specified file name,
now changes the major mode according to that file name. However, the mode will not be changed if (1) a local variables list or the `-*-' line specifies a major mode, or (2) the current major mode is a "special" mode, not suitable for ordinary files, or (3) the new file name does not particularly specify any mode.

This applies to M-x set-visited-file-name as well.

However, if you set change-major-mode-with-file-name to nil, then these commands do not change the major mode.