unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9796: 24.0.90; Mayor mode selection after "save as"
@ 2011-10-19 16:05 Dani Moncayo
  2011-10-19 17:09 ` bug#9796: 24.0.90; Major " Dani Moncayo
  0 siblings, 1 reply; 10+ messages in thread
From: Dani Moncayo @ 2011-10-19 16:05 UTC (permalink / raw)
  To: 9796

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-19 16:05 bug#9796: 24.0.90; Mayor mode selection after "save as" Dani Moncayo
@ 2011-10-19 17:09 ` Dani Moncayo
  2011-10-19 21:43   ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Dani Moncayo @ 2011-10-19 17:09 UTC (permalink / raw)
  To: 9796

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-19 17:09 ` bug#9796: 24.0.90; Major " Dani Moncayo
@ 2011-10-19 21:43   ` Glenn Morris
  2011-10-19 21:51     ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2011-10-19 21:43 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 9796


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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-19 21:43   ` Glenn Morris
@ 2011-10-19 21:51     ` Glenn Morris
  2011-10-20  0:30       ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2011-10-19 21:51 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 9796

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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-19 21:51     ` Glenn Morris
@ 2011-10-20  0:30       ` Stefan Monnier
  2011-10-20  1:26         ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2011-10-20  0:30 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 9796

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-20  0:30       ` Stefan Monnier
@ 2011-10-20  1:26         ` Glenn Morris
  2011-10-20  2:23           ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2011-10-20  1:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9796

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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-20  1:26         ` Glenn Morris
@ 2011-10-20  2:23           ` Stefan Monnier
  2011-10-21  6:16             ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2011-10-20  2:23 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 9796

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-20  2:23           ` Stefan Monnier
@ 2011-10-21  6:16             ` Glenn Morris
  2011-10-21 12:52               ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2011-10-21  6:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9796

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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-21  6:16             ` Glenn Morris
@ 2011-10-21 12:52               ` Stefan Monnier
  2011-10-27  6:38                 ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2011-10-21 12:52 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 9796

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9796: 24.0.90; Major mode selection after "save as"
  2011-10-21 12:52               ` Stefan Monnier
@ 2011-10-27  6:38                 ` Glenn Morris
  0 siblings, 0 replies; 10+ messages in thread
From: Glenn Morris @ 2011-10-27  6:38 UTC (permalink / raw)
  To: 9796-done

Version: 24.0.91

Should be fixed now.





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-10-27  6:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-19 16:05 bug#9796: 24.0.90; Mayor mode selection after "save as" Dani Moncayo
2011-10-19 17:09 ` bug#9796: 24.0.90; Major " Dani Moncayo
2011-10-19 21:43   ` Glenn Morris
2011-10-19 21:51     ` Glenn Morris
2011-10-20  0:30       ` Stefan Monnier
2011-10-20  1:26         ` Glenn Morris
2011-10-20  2:23           ` Stefan Monnier
2011-10-21  6:16             ` Glenn Morris
2011-10-21 12:52               ` Stefan Monnier
2011-10-27  6:38                 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).