Bug#370051: emacs-snapshot-x: html-helper mode only invoke on new files

2006-06-21 Thread Sven Joachim

Romain Francoise wrote:

Ah, thanks Sven.  I had missed the connection with `magic-mode-alist' in
this report...

I don't think this is a bug, `magic-mode-alist' *voluntarily* overrides
`auto-mode-alist', it's mentioned in the docstring:

,[ C-h v magic-mode-alist RET ]
|
| Documentation:
| Alist of buffer beginnings vs. corresponding major mode functions.
| Each element looks like (REGEXP . FUNCTION).  After visiting a file,
| if REGEXP matches the text at the beginning of the buffer,
| `normal-mode' will call FUNCTION rather than allowing `auto-mode-alist'
| to decide the buffer's major mode.
|
| If FUNCTION is nil, then it is not called.  (That is a way of saying
| allow `auto-mode-alist' to decide for these files.)
`

and in the manual:

|Sometimes the major mode is determined from the way the file's text
| begins.  The variable `magic-mode-alist' controls this.  Its value is a
| list of elements of this form:
|
|  (REGEXP . MODE-FUNCTION)
|
| This looks like an element of `auto-mode-alist', but it doesn't work
| the same: this REGEXP is matched against the text at the start of the
| buffer, not against the file name.  `magic-mode-alist' takes priority
| over `auto-mode-alist'.

So the problem here is that html-helper-mode should replace the
html-mode entry with one of its own in `magic-mode-alist', or just
remove it to let `auto-mode-alist' decide.

What do you think?


Now that I learned about magic-mode-alist ;-), that sounds absolutely right.
I think it's best for html-helper-mode to replace the html-mode entry in
auto-mode-alist; that needs to be done in its startup file,
/etc/emacs/site-start.d/50html-helper-mode.el.

I'm afraid my lisp knowledge is too limited to come up with a patch.
Would you like to write one?



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#370051: emacs-snapshot-x: html-helper mode only invoke on new files

2006-06-21 Thread Romain Francoise
retitle 370051 html-helper-mode: Should add itself to `magic-mode-alist' too
reassign 370051 html-helper-mode
thanks, control

Sven Joachim [EMAIL PROTECTED] writes:

 Now that I learned about magic-mode-alist ;-), that sounds absolutely
 right. [...]

 I'm afraid my lisp knowledge is too limited to come up with a patch.
 Would you like to write one?

No, but that's something the html-helper-mode maintainer can do.
I'm now reassigning this bug back.

Thanks,

-- 
  ,''`.
 : :' :Romain Francoise [EMAIL PROTECTED]
 `. `' http://people.debian.org/~rfrancoise/
   `-


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#370051: emacs-snapshot-x: html-helper mode only invoke on new files

2006-06-20 Thread Sven Joachim

reassign 370051 emacs-snapshot
thanks

Romain Francoise wrote:

reassign 370051 html-helper-mode
quit

Dan Jacobson [EMAIL PROTECTED] writes:


$ emacs-snapshot file.html
will invoke html-helper mode if the file didn't exist before.
But it will invoke plain html mode if the file already exists!


I can reproduce this with html-helper-mode, but not with any of the
other modes started via the Debian startup scripts... which leads me to
believe that the problem lies with html-helper-mode rather than Emacs.

If it turns out not to be the case, feel free to reassign back.


I think this is a bug in emacs-snapshot after all.  The problem is that
Emacs is a bit too clever: it sees the file's contents and, noticing that
it is a HTML file (e.g., it has !DOCTYPE HTML ... or html as first text),
decides to put it in html-mode, without even looking at auto-mode-alist which
tells otherwise.

To see this in detail:

M-x debug-on-entry RET set-auto-mode RET
open some HTML file, entering the debugger
single-step through the function in the debugger with the 'd' key

This should probably forwarded to emacs-pretest-bug, so that the Emacs
maintainers can DTRT.

Cheers,

Sven






--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#370051: emacs-snapshot-x: html-helper mode only invoke on new files

2006-06-20 Thread Romain Francoise
Sven Joachim [EMAIL PROTECTED] writes:

 I think this is a bug in emacs-snapshot after all.  The problem is
 that Emacs is a bit too clever: it sees the file's contents and,
 noticing that it is a HTML file (e.g., it has !DOCTYPE HTML ... or
 html as first text), decides to put it in html-mode, without even
 looking at auto-mode-alist which tells otherwise.

Ah, thanks Sven.  I had missed the connection with `magic-mode-alist' in
this report...

I don't think this is a bug, `magic-mode-alist' *voluntarily* overrides
`auto-mode-alist', it's mentioned in the docstring:

,[ C-h v magic-mode-alist RET ]
|
| Documentation:
| Alist of buffer beginnings vs. corresponding major mode functions.
| Each element looks like (REGEXP . FUNCTION).  After visiting a file,
| if REGEXP matches the text at the beginning of the buffer,
| `normal-mode' will call FUNCTION rather than allowing `auto-mode-alist'
| to decide the buffer's major mode.
|
| If FUNCTION is nil, then it is not called.  (That is a way of saying
| allow `auto-mode-alist' to decide for these files.)
`

and in the manual:

|Sometimes the major mode is determined from the way the file's text
| begins.  The variable `magic-mode-alist' controls this.  Its value is a
| list of elements of this form:
|
|  (REGEXP . MODE-FUNCTION)
|
| This looks like an element of `auto-mode-alist', but it doesn't work
| the same: this REGEXP is matched against the text at the start of the
| buffer, not against the file name.  `magic-mode-alist' takes priority
| over `auto-mode-alist'.

So the problem here is that html-helper-mode should replace the
html-mode entry with one of its own in `magic-mode-alist', or just
remove it to let `auto-mode-alist' decide.

What do you think?

-- 
  ,''`.
 : :' :Romain Francoise [EMAIL PROTECTED]
 `. `' http://people.debian.org/~rfrancoise/
   `-


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#370051: emacs-snapshot-x: html-helper mode only invoke on new files

2006-06-02 Thread Dan Jacobson
Package: emacs-snapshot
Version: 1:20060518-1
Severity: normal

Big problem.
$ emacs-snapshot file.html
will invoke html-helper mode if the file didn't exist before.
But it will invoke plain html mode if the file already exists!
Had to do
(fset 'html-mode 'html-helper-mode)
getting
Loading html-helper-mode (source)...done
meddling with auto-mode-alist didn't help.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#370051: emacs-snapshot-x: html-helper mode only invoke on new files

2006-06-02 Thread Romain Francoise
reassign 370051 html-helper-mode
quit

Dan Jacobson [EMAIL PROTECTED] writes:

 $ emacs-snapshot file.html
 will invoke html-helper mode if the file didn't exist before.
 But it will invoke plain html mode if the file already exists!

I can reproduce this with html-helper-mode, but not with any of the
other modes started via the Debian startup scripts... which leads me to
believe that the problem lies with html-helper-mode rather than Emacs.

If it turns out not to be the case, feel free to reassign back.

-- 
  ,''`.
 : :' :Romain Francoise [EMAIL PROTECTED]
 `. `' http://people.debian.org/~rfrancoise/
   `-


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]