From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Frank Schimmel Newsgroups: gmane.emacs.bugs Subject: major mode falsely changed when writing files Date: Wed, 2 Apr 2003 12:30:00 +0200 (MEST) Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200304021030.h32AU0j20628@timbuktu.dkrz.de> Reply-To: Frank Schimmel NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1049279544 3373 80.91.224.249 (2 Apr 2003 10:32:24 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 2 Apr 2003 10:32:24 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 02 12:32:23 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 190fXb-0000sH-00 for ; Wed, 02 Apr 2003 12:32:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 190fWc-0003NA-01 for gnu-bug-gnu-emacs@m.gmane.org; Wed, 02 Apr 2003 05:31:22 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 190fWF-0002oH-00 for bug-gnu-emacs@gnu.org; Wed, 02 Apr 2003 05:30:59 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 190fVU-0000QV-00 for bug-gnu-emacs@gnu.org; Wed, 02 Apr 2003 05:30:44 -0500 Original-Received: from mailto.dkrz.de ([136.172.44.4]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 190fVO-0008Aq-00 for bug-gnu-emacs@gnu.org; Wed, 02 Apr 2003 05:30:06 -0500 Original-Received: from timbuktu.dkrz.de (timbuktu.dkrz.de [136.172.100.197]) by mailto.dkrz.de (8.12.9/8.12.9) with ESMTP id h32AU0Y6006006 for ; Wed, 2 Apr 2003 12:30:00 +0200 (MEST) Original-Received: (from u232017@localhost) by timbuktu.dkrz.de (8.11.6+Sun/8.10.2) id h32AU0j20628; Wed, 2 Apr 2003 12:30:00 +0200 (MEST) Original-To: bug-gnu-emacs@gnu.org Sent-via: bug-gnu-emacs@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:4696 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:4696 This bug report will be sent to the Free Software Foundation, not to your local site managers! Please write in English, because the Emacs maintainers do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list, and to the gnu.emacs.bug news group. In GNU Emacs 21.1.2 (sparc-sun-solaris2.8, X toolkit, Xaw3d scroll bars) of 2002-02-11 on palpatine configured using `configure --prefix=/sw/solaris8/emacs-21.1 --with-x-toolkit=athena --x-includes=/usr/openwin/include --x-libraries=/usr/openwin/lib --with-xpm --with-jpeg --with-tiff --with-gif --with-png' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: en_US.ISO8859-1 value of $LC_CTYPE: en_US.ISO8859-1 value of $LC_MESSAGES: C value of $LC_MONETARY: en_US.ISO8859-1 value of $LC_NUMERIC: en_US.ISO8859-1 value of $LC_TIME: en_US.ISO8859-1 value of $LANG: en_US.ISO8859-1 locale-coding-system: iso-latin-1 default-enable-multibyte-characters: nil Please describe exactly what actions triggered the bug and the precise symptoms of the bug: Setting the file name via `set-visited-file-name' incorrectly changes the major mode according to the new file name only. For example, changing the name of a file containing `// -*- C++ -*-' as its first line from `test.h' to `test2.h' changes the major mode from c++-mode to c-mode. An important side effect is that the same thing happens when writing the file to a different name (`C-x C-w'). This is not consistent and also not what the documentation claims. >>From the info pages (`Choosing Modes'): The commands `C-x C-w' and `set-visited-file-name' change to a new major mode if the new file name implies a mode (*note Saving::). However, this does not happen if the buffer contents specify a major mode, and certain "special" major modes do not allow the mode to change. You can turn off this mode-changing feature by setting `change-major-mode-with-file-name' to `nil'. `C-h v change-major-mode-with-file-name ' gives: change-major-mode-with-file-name's value is t Documentation: *Non-nil means C-x C-w should set the major mode from the 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. Not all that important, but annoying... Regards, -Frank Schimmel Recent input: C-s C-s C-a C-x C-g C-s C-s C-s C-a C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-a C-x k t C-s m o d e 1 C-h c C-x C-w C-h v C-a C-x o C-SPC M-> M-w C-x k C-x 0 l l l M-x r e p o r Recent messages: Wrote /tmp/test.h Wrote /tmp/test2.h Note: file is write protected Mark saved where search started [7 times] C-x C-w runs the command write-file Type C-x 1 to remove help window. C-M-v to scroll the help. Mark set [2 times] call-interactively: End of buffer Making completion list... Loading emacsbug...done