[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

major mode falsely changed when writing files

From: Frank Schimmel
Subject: major mode falsely changed when writing files
Date: Wed, 2 Apr 2003 12:30:00 +0200 (MEST)

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 
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 <RET>' gives:

   change-major-mode-with-file-name's value is t

   *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...

-Frank Schimmel

Recent input:
C-s C-s C-a C-x C-g <next> C-s C-s C-s C-a <next> 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 <return> t C-s m o d e <right> <left> <return> 
1 <next> <down> <up> <up> <next> <down> <down> <down> 
<down> <down> <left> <right> C-h c C-x C-w <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <S-right> C-h v <return> C-a C-x o C-SPC 
M-> <right> <up> <up> <up> M-w C-x k <return> C-x 0 
l l l <next> <up> M-x r e p o <tab> r <tab> <retur

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]