unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Special SQL mode?
@ 2012-11-20 21:29 Doug Lewan
  2012-11-22 16:47 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Lewan @ 2012-11-20 21:29 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

I work with a non-standard variant of SQL. (Don't ask.) I have, accordingly, a non-standard variant of SQL mode, defined via `(define-derived-mode pp-sql-mode sql-mode "PP sql" ...)'.

The stock SQL mode entry has been replaced in auto-mode-alist by `("\\.sql\\'" . pp-sql-mode)'. There is no other even remotely SQL-ish entry in auto-mode-alist. The variable  magic-mode-alist  is NIL, and there are no local file variables. Finally, there is no '#!'.

Nonetheless, my *.sql files automatically get SQL[ANSI] mode.

If the info about Choosing Major Modes is right, then I should not (if I'm smart enough to understand it). Apparently I'm not. Does anyone have a hint about what I might have missed?

Thanks.

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

There is no national science just as there is no national multiplication table; what is national is no longer science. - Anton Chekov




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

* Re: Special SQL mode?
  2012-11-20 21:29 Special SQL mode? Doug Lewan
@ 2012-11-22 16:47 ` Stefan Monnier
  2012-11-28 15:48   ` Doug Lewan
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2012-11-22 16:47 UTC (permalink / raw)
  To: help-gnu-emacs

> Nonetheless, my *.sql files automatically get SQL[ANSI] mode.

When pp-sql-mode calls sql-mode, sql-mode registers
`sql-highlight-product' on `hack-local-variables-hook' (which is run
later, even after running the mode hooks) to select which SQL variant
should be used.

A quick hack would be for you to (remove-hook 'hack-local-variables-hook
'sql-highlight-product t).  But maybe another approach (instead of
or additionally to creating a derived-mode) would be to add an entry in
sql-product-alist for your "pp sql".


        Stefan




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

* RE: Special SQL mode?
  2012-11-22 16:47 ` Stefan Monnier
@ 2012-11-28 15:48   ` Doug Lewan
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Lewan @ 2012-11-28 15:48 UTC (permalink / raw)
  To: Stefan Monnier, help-gnu-emacs@gnu.org

Stefan,

Thank you. These are details that I had known nothing about. I'll give your suggestions a try.

,Doug

> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Stefan Monnier
> Sent: Thursday, 2012 November 22 11:47
> To: help-gnu-emacs@gnu.org
> Subject: Re: Special SQL mode?
> 
> > Nonetheless, my *.sql files automatically get SQL[ANSI] mode.
> 
> When pp-sql-mode calls sql-mode, sql-mode registers
> `sql-highlight-product' on `hack-local-variables-hook' (which is run
> later, even after running the mode hooks) to select which SQL variant
> should be used.
> 
> A quick hack would be for you to (remove-hook 'hack-local-variables-
> hook
> 'sql-highlight-product t).  But maybe another approach (instead of
> or additionally to creating a derived-mode) would be to add an entry in
> sql-product-alist for your "pp sql".
> 
> 
>         Stefan
> 




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

end of thread, other threads:[~2012-11-28 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-20 21:29 Special SQL mode? Doug Lewan
2012-11-22 16:47 ` Stefan Monnier
2012-11-28 15:48   ` Doug Lewan

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