all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Difference in major mode autoload between 21.3.x and 22.0.x?
@ 2005-10-12 15:15 Markus Nißl
  2005-10-12 15:24 ` Slawomir Nowaczyk
       [not found] ` <mailman.11034.1129130655.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Nißl @ 2005-10-12 15:15 UTC (permalink / raw)


Hi!

Using Emacs 21.3.1, the following two lines in my .emacs worked fine:

(autoload 'xsl-mode "xslide" "Major mode for XSL stylesheets." t)
(setq auto-mode-alist (cons '("\\.xsl$" . xsl-mode) auto-mode-alist))

Using Emacs 22.0.50.1, xsl-mode is only loaded automatically when 
I create a new xsl file. When I open an existing xsl file, xml 
mode is loaded instead.

Anybody an idea what's wrong?

Thanks in advance,
Markus

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

* Re: Difference in major mode autoload between 21.3.x and 22.0.x?
  2005-10-12 15:15 Difference in major mode autoload between 21.3.x and 22.0.x? Markus Nißl
@ 2005-10-12 15:24 ` Slawomir Nowaczyk
       [not found] ` <mailman.11034.1129130655.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Slawomir Nowaczyk @ 2005-10-12 15:24 UTC (permalink / raw)


On Wed, 12 Oct 2005 17:15:53 +0200
Markus Nißl <mnissl@arcor.de> wrote:

#> Using Emacs 22.0.50.1, xsl-mode is only loaded automatically when 
#> I create a new xsl file. When I open an existing xsl file, xml 
#> mode is loaded instead.

#> Anybody an idea what's wrong?

From the documentation of auto-mode-alist:

    See also `interpreter-mode-alist', which detects executable script modes
    based on the interpreters they specify to run,
    and `magic-mode-alist', which determines modes based on file contents.
    
I suppose you should take a look at magic-mode-alist

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

The only "intuitive" interface is the nipple.
After that, it's all learned

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

* Re: Difference in major mode autoload between 21.3.x and 22.0.x?
       [not found] ` <mailman.11034.1129130655.20277.help-gnu-emacs@gnu.org>
@ 2005-10-14  8:08   ` Markus Nißl
  2005-10-14 12:20     ` Slawomir Nowaczyk
       [not found]     ` <mailman.11338.1129292518.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Nißl @ 2005-10-14  8:08 UTC (permalink / raw)


Slawomir Nowaczyk wrote:
> On Wed, 12 Oct 2005 17:15:53 +0200
> Markus Nißl <mnissl@arcor.de> wrote:
> 
> #> Using Emacs 22.0.50.1, xsl-mode is only loaded automatically when 
> #> I create a new xsl file. When I open an existing xsl file, xml 
> #> mode is loaded instead.
> 
> #> Anybody an idea what's wrong?
> 
> From the documentation of auto-mode-alist:
> 
>     See also `interpreter-mode-alist', which detects executable script modes
>     based on the interpreters they specify to run,
>     and `magic-mode-alist', which determines modes based on file contents.
>     
> I suppose you should take a look at magic-mode-alist

Thank you very much for your information. I now see where the 
different behaviour comes from.

By far, I'm no Emacs expert ... so, can you give me a hint in 
which way I have to modify magic-mode-alist so that xsl-mode is 
being started whenever a file with the extension ".xsl" is loaded?

In 21.x, it was a breeze for an elisp novice to copy those two 
lines and to adjust them to my needs.

Thank you very much in advance,
Markus

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

* Re: Difference in major mode autoload between 21.3.x and 22.0.x?
  2005-10-14  8:08   ` Markus Nißl
@ 2005-10-14 12:20     ` Slawomir Nowaczyk
       [not found]     ` <mailman.11338.1129292518.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Slawomir Nowaczyk @ 2005-10-14 12:20 UTC (permalink / raw)


On Fri, 14 Oct 2005 10:08:25 +0200
Markus Nißl <mnissl@arcor.de> wrote:

#> Slawomir Nowaczyk wrote:
#> > On Wed, 12 Oct 2005 17:15:53 +0200
#> > Markus Nißl <mnissl@arcor.de> wrote:
#> > 
#> > #> Using Emacs 22.0.50.1, xsl-mode is only loaded automatically when 
#> > #> I create a new xsl file. When I open an existing xsl file, xml 
#> > #> mode is loaded instead.

#> > I suppose you should take a look at magic-mode-alist

#> Thank you very much for your information. I now see where the 
#> different behaviour comes from.

A question to the rest of the list: I have seen this being asked a
couple of time recently... maybe it would make sense to change default
value of magic-mode-alist to not include "xml-mode" and "html-mode" ?

It seems to me that magic-mode-alist makes sense if there is only one
mode for visiting certain type of files... and there seems to be a
couple different modes commonly used for xml and html.

#> By far, I'm no Emacs expert ... so, can you give me a hint in 
#> which way I have to modify magic-mode-alist so that xsl-mode is 
#> being started whenever a file with the extension ".xsl" is loaded?

Well, try this (not tested):

(push magic-mode-alist '("<\\?xml " . nil))

I am sure those better versed in elisp can suggest a nicer solution :)

#> In 21.x, it was a breeze for an elisp novice to copy those two 
#> lines and to adjust them to my needs.

I agree, auto-mode-alist is much easier to customise.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

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

* Re: Difference in major mode autoload between 21.3.x and 22.0.x?
       [not found]     ` <mailman.11338.1129292518.20277.help-gnu-emacs@gnu.org>
@ 2005-10-14 13:02       ` Markus Nißl
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Nißl @ 2005-10-14 13:02 UTC (permalink / raw)


Slawomir Nowaczyk wrote:

 > A question to the rest of the list: I have seen this being
 > asked a couple of time recently... maybe it would make sense to
 > change default value of magic-mode-alist to not include
 > "xml-mode" and "html-mode" ?

Yeap, could make sense ... the problem is that an xsl file starts
the very same way an xml file does ...

 > #> By far, I'm no Emacs expert ... so, can you give me a hint
 > #> in which way I have to modify magic-mode-alist so that
 > #> xsl-mode is being started whenever a file with the extension
 > #> ".xsl" is loaded?
 >
 > Well, try this (not tested):
 >
 > (push magic-mode-alist '("<\\?xml " . nil))

Looks fine to me, but nope, this line results into the following
error:

Wrong type argument: symbolp, (quote (<\?xml ))

But I simply altered the line a bit using "setq" instead of "push":

(autoload 'xsl-mode "xslide" "Major mode for XSL stylesheets." t)
(setq auto-mode-alist (cons '("\\.xsl$" . xsl-mode) auto-mode-alist))
(setq magic-mode-alist (cons '("<\\?xml " . nil) magic-mode-alist))

 > I am sure those better versed in elisp can suggest a nicer solution :)

Well, I'm fine with the solution above. Elisp is pretty weird to
code if you come from C++ or Java ...

 > #> In 21.x, it was a breeze for an elisp novice to copy those two
 > #> lines and to adjust them to my needs.
 >
 > I agree, auto-mode-alist is much easier to customise.

Yeap, although magic-mode-alist is certainly a nice
"intelli-sense" feature ;-)

Thanks a bunch for your help,
Markus

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

end of thread, other threads:[~2005-10-14 13:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-12 15:15 Difference in major mode autoload between 21.3.x and 22.0.x? Markus Nißl
2005-10-12 15:24 ` Slawomir Nowaczyk
     [not found] ` <mailman.11034.1129130655.20277.help-gnu-emacs@gnu.org>
2005-10-14  8:08   ` Markus Nißl
2005-10-14 12:20     ` Slawomir Nowaczyk
     [not found]     ` <mailman.11338.1129292518.20277.help-gnu-emacs@gnu.org>
2005-10-14 13:02       ` Markus Nißl

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.