GNU bug report logs - #9796
Major mode selection after "save as"

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Wed, 19 Oct 2011 16:08:01 UTC

Severity: normal

Found in version 24.0.90

Fixed in version 24.0.91

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9796 in the body.
You can then email your comments to 9796 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Wed, 19 Oct 2011 16:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dani Moncayo <dmoncayo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 19 Oct 2011 16:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.90; Mayor mode selection after "save as"
Date: Wed, 19 Oct 2011 18:05:36 +0200
From "emacs -Q":

1. Create a new buffer and write something into it.
2. Type "C-x C-s" and save the buffer as "test.txt".
3. Now Type "C-x C-w" and save another copy as "test.sql".

The mayor mode chosen for the "test.sql" buffer is "SQL", whereas the
one chosen when I kill all buffers and visit the "test.sql" file is
"SQL[ANSI]".  I expected that the chosen mode was the same in both
cases.


In GNU Emacs 24.0.90.1 (i386-mingw-nt5.1.2600)
 of 2011-10-18 on DANI-PC
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5)'

-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Wed, 19 Oct 2011 17:11:01 GMT) Full text and rfc822 format available.

Message #8 received at 9796 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: 9796 <at> debbugs.gnu.org
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Wed, 19 Oct 2011 19:09:24 +0200
retitle 9796 Major mode selection after "save as"
stop

> The mayor mode chosen for the "test.sql" buffer is "SQL", whereas the
      ^^^^^
s/mayor/major/

Sorry.

-- 
Dani Moncayo




Changed bug title to 'Major mode selection after "save as"' from '24.0.90; Mayor mode selection after "save as"' Request was from Dani Moncayo <dmoncayo <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 19 Oct 2011 17:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Wed, 19 Oct 2011 21:45:01 GMT) Full text and rfc822 format available.

Message #13 received at 9796 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 9796 <at> debbugs.gnu.org
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Wed, 19 Oct 2011 17:43:27 -0400
The issue you are reporting is specific to sql-mode.
The [] piece is added by sql-highlight-product, which sql-mode runs via
hack-local-variables-hook. Changing a buffer's filename changes the
major-mode (if change-major-mode-with-file-name is non-nil), but does
not re-hack the local variables.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Wed, 19 Oct 2011 21:53:01 GMT) Full text and rfc822 format available.

Message #16 received at 9796 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 9796 <at> debbugs.gnu.org
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Wed, 19 Oct 2011 17:51:48 -0400
Glenn Morris wrote:

> Changing a buffer's filename changes the major-mode (if
> change-major-mode-with-file-name is non-nil), but does not re-hack the
> local variables.

I guess it probably should, since any specified file local variables get
clobbered by the mode change.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Thu, 20 Oct 2011 00:33:01 GMT) Full text and rfc822 format available.

Message #19 received at 9796 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 9796 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Wed, 19 Oct 2011 20:30:53 -0400
>> Changing a buffer's filename changes the major-mode (if
>> change-major-mode-with-file-name is non-nil), but does not re-hack the
>> local variables.
> I guess it probably should, since any specified file local variables get
> clobbered by the mode change.

As mentioned in some earlier post (several months ago), I think that
normal-mode should run hack-local-variables.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Thu, 20 Oct 2011 01:28:02 GMT) Full text and rfc822 format available.

Message #22 received at 9796 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 9796 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Wed, 19 Oct 2011 21:26:45 -0400
Stefan Monnier wrote:

> As mentioned in some earlier post (several months ago), I think that
> normal-mode should run hack-local-variables.

It already does (and always has)?

set-auto-mode is being used here though, not normal-mode.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Thu, 20 Oct 2011 02:26:02 GMT) Full text and rfc822 format available.

Message #25 received at 9796 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 9796 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Wed, 19 Oct 2011 22:23:57 -0400
>> As mentioned in some earlier post (several months ago), I think that
>> normal-mode should run hack-local-variables.
> It already does (and always has)?
> set-auto-mode is being used here though, not normal-mode.

So I guess we shouldn't use set-auto-mode here.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Fri, 21 Oct 2011 06:18:01 GMT) Full text and rfc822 format available.

Message #28 received at 9796 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 9796 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Fri, 21 Oct 2011 02:16:18 -0400
Stefan Monnier wrote:

>> set-auto-mode is being used here though, not normal-mode.
>
> So I guess we shouldn't use set-auto-mode here.

normal-mode first switches to fundamental-mode, then changes to the
right mode, then turns font-lock off and on. Is that necessary here?
Also it does not have a "keep-mode-if-same" argument.
It seems simpler to me for set-visited-file-name just to
hack-local-variables.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9796; Package emacs. (Fri, 21 Oct 2011 12:54:02 GMT) Full text and rfc822 format available.

Message #31 received at 9796 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 9796 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Fri, 21 Oct 2011 08:52:15 -0400
>>> set-auto-mode is being used here though, not normal-mode.
>> So I guess we shouldn't use set-auto-mode here.
> normal-mode first switches to fundamental-mode, then changes to the
> right mode, then turns font-lock off and on. Is that necessary here?
> Also it does not have a "keep-mode-if-same" argument.
> It seems simpler to me for set-visited-file-name just to
> hack-local-variables.

For 24.1, yes.  But in general we'd want to restructure the code a bit
to make it harder to avoid running hack-local-variables-hook (or maybe
provide a new hook to replace it, which is guaranteed to run after
changing a major-mode).


        Stefan




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 27 Oct 2011 06:41:01 GMT) Full text and rfc822 format available.

Notification sent to Dani Moncayo <dmoncayo <at> gmail.com>:
bug acknowledged by developer. (Thu, 27 Oct 2011 06:41:02 GMT) Full text and rfc822 format available.

Message #36 received at 9796-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 9796-done <at> debbugs.gnu.org
Subject: Re: bug#9796: 24.0.90; Major mode selection after "save as"
Date: Thu, 27 Oct 2011 02:38:52 -0400
Version: 24.0.91

Should be fixed now.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Nov 2011 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 198 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.