unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* precedence of auto-mode-alist and magic-fallback-mode-alist
@ 2007-12-08 14:23 Stephen Berman
  2007-12-08 15:03 ` Lennart Borgman (gmail)
  2007-12-08 23:45 ` Jason Rumney
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Berman @ 2007-12-08 14:23 UTC (permalink / raw)
  To: emacs-devel

On GNU Emacs 23.0.50.3 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of
2007-11-29 on escher I do the following:

1. emacs -Q
2. M-x browse-url-emacs RET http://www.gnu.org RET
3. After a short time a buffer www.gnu.org pops up containing the HTML
source of the gnu.org home page.  This buffer is in Org mode, because
auto-mode-alist takes precedence over magic-fallback-mode-alist (if I
save the buffer as "testme" then C-x C-f opens the file in html-mode).

I don't remember if cases like this were considered when this precedence
relation was established.  If not, is the above an argument against this
precedence relation, or just evidence that we can't always DTRT, or is
it a bug that can be fixed while retaining the current precedence
relation?

Steve Berman

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

* Re: precedence of auto-mode-alist and magic-fallback-mode-alist
  2007-12-08 14:23 precedence of auto-mode-alist and magic-fallback-mode-alist Stephen Berman
@ 2007-12-08 15:03 ` Lennart Borgman (gmail)
  2007-12-08 20:09   ` Stefan Monnier
  2007-12-08 23:45 ` Jason Rumney
  1 sibling, 1 reply; 4+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-08 15:03 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

Stephen Berman wrote:
> On GNU Emacs 23.0.50.3 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of
> 2007-11-29 on escher I do the following:
> 
> 1. emacs -Q
> 2. M-x browse-url-emacs RET http://www.gnu.org RET
> 3. After a short time a buffer www.gnu.org pops up containing the HTML
> source of the gnu.org home page.  This buffer is in Org mode, because
> auto-mode-alist takes precedence over magic-fallback-mode-alist (if I
> save the buffer as "testme" then C-x C-f opens the file in html-mode).
> 
> I don't remember if cases like this were considered when this precedence
> relation was established.  If not, is the above an argument against this
> precedence relation, or just evidence that we can't always DTRT, or is
> it a bug that can be fixed while retaining the current precedence
> relation?
> 
> Steve Berman


Should not the rules be different for a file fetched from the net? We 
can't know association between the URL and the content type. (Maybe the 
headers can be used?)

BTW, why is the new-window argument ignored in browse-url-emacs?

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

* Re: precedence of auto-mode-alist and magic-fallback-mode-alist
  2007-12-08 15:03 ` Lennart Borgman (gmail)
@ 2007-12-08 20:09   ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2007-12-08 20:09 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Stephen Berman, emacs-devel

>> 2. M-x browse-url-emacs RET http://www.gnu.org RET
>> 3. After a short time a buffer www.gnu.org pops up containing the HTML
>> source of the gnu.org home page.  This buffer is in Org mode, because
>> auto-mode-alist takes precedence over magic-fallback-mode-alist (if I
>> save the buffer as "testme" then C-x C-f opens the file in html-mode).
>> 
>> I don't remember if cases like this were considered when this precedence
>> relation was established.  If not, is the above an argument against this
>> precedence relation, or just evidence that we can't always DTRT, or is
>> it a bug that can be fixed while retaining the current precedence
>> relation?

> Should not the rules be different for a file fetched from the net?

Indeed.  We should use the content-type info provided in the HTTP
response, but we don't have any support for that right now.


        Stefan

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

* Re: precedence of auto-mode-alist and magic-fallback-mode-alist
  2007-12-08 14:23 precedence of auto-mode-alist and magic-fallback-mode-alist Stephen Berman
  2007-12-08 15:03 ` Lennart Borgman (gmail)
@ 2007-12-08 23:45 ` Jason Rumney
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Rumney @ 2007-12-08 23:45 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

Stephen Berman wrote:
> On GNU Emacs 23.0.50.3 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of
> 2007-11-29 on escher I do the following:
>
> 1. emacs -Q
> 2. M-x browse-url-emacs RET http://www.gnu.org RET
> 3. After a short time a buffer www.gnu.org pops up containing the HTML
> source of the gnu.org home page.  This buffer is in Org mode, because
> auto-mode-alist takes precedence over magic-fallback-mode-alist (if I
> save the buffer as "testme" then C-x C-f opens the file in html-mode).
>
> I don't remember if cases like this were considered when this precedence
> relation was established.  If not, is the above an argument against this
> precedence relation, or just evidence that we can't always DTRT, or is
> it a bug that can be fixed while retaining the current precedence
> relation?
>   

The word fallback in the variable name suggests that it is intended to
work this way. There is a corresponding magic-mode-alist which has
higher priority. But the real bug is that www.gnu.org is being treated
as a filename after being fetched by browse-url. It shouldn't be going
anywhere near auto-mode-alist.

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

end of thread, other threads:[~2007-12-08 23:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-08 14:23 precedence of auto-mode-alist and magic-fallback-mode-alist Stephen Berman
2007-12-08 15:03 ` Lennart Borgman (gmail)
2007-12-08 20:09   ` Stefan Monnier
2007-12-08 23:45 ` Jason Rumney

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