GNU bug report logs -
#2355
23.0.60; Enabling minor-mode disables major mode
Previous Next
Reported by: Leo <sdl.web <at> gmail.com>
Date: Tue, 17 Feb 2009 11:55:06 UTC
Severity: minor
Fixed in version 24.1
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2355 in the body.
You can then email your comments to 2355 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Tue, 17 Feb 2009 11:55:07 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Leo <sdl.web <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 17 Feb 2009 11:55:07 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
In a file like this:
---------------- file: sample.tex ----------------
%% -*- mode:outline-minor; -*-
% Empty
--------------------------------------------------
Opening it and emacs will put it in fundamental mode with
outline-minor-mode and it is undesirable.
However,
---------------- file: sample.tex ----------------
% Empty
%% Local Variables:
%% mode: outline-minor
%% End:
--------------------------------------------------
Emacs will put it in LaTeX/TeX mode with outline-minor-mode.
I wonder if this is a bug.
Best,
Leo
GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600) of 2008-12-14 on BREPNB
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Tue, 17 Feb 2009 14:45:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juanma Barranquero <lekktu <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 17 Feb 2009 14:45:03 GMT)
Full text and
rfc822 format available.
Message #10 received at 2355 <at> emacsbugs.donarmstrong.com (full text, mbox):
tags 2355 + notabug
quit
> ---------------- file: sample.tex ----------------
> %% -*- mode:outline-minor; -*-
You're abusing the "mode" file variable. It's intended to set the
*major* mode. See node "57.3.4.1 Specifying File Variables" in the
Emacs manual.
> ---------------- file: sample.tex ----------------
> % Empty
>
> %% Local Variables:
> %% mode: outline-minor
> %% End:
> --------------------------------------------------
>
> Emacs will put it in LaTeX/TeX mode with outline-minor-mode.
>
> I wonder if this is a bug.
No. The buffer is autodetected as tex-mode buffer, and then the local
variables section is acted upon; but calling (funcall
'outline-minor-mode) does not change the major mode, so it stays in
tex-mode.
Juanma
Tags added: notabug
Request was from
Juanma Barranquero <lekktu <at> gmail.com>
to
control <at> emacsbugs.donarmstrong.com
.
(Tue, 17 Feb 2009 14:45:05 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Tue, 17 Feb 2009 16:10:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Leo <sdl.web <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 17 Feb 2009 16:10:03 GMT)
Full text and
rfc822 format available.
Message #17 received at 2355 <at> emacsbugs.donarmstrong.com (full text, mbox):
On 2009-02-17 14:37 +0000, Juanma Barranquero wrote:
> tags 2355 + notabug
> quit
>
>> ---------------- file: sample.tex ----------------
>> %% -*- mode:outline-minor; -*-
>
> You're abusing the "mode" file variable. It's intended to set the
> *major* mode. See node "57.3.4.1 Specifying File Variables" in the
> Emacs manual.
Why is that an abuse? The manual does not specify what is not allowed.
>> ---------------- file: sample.tex ----------------
>> % Empty
>>
>> %% Local Variables:
>> %% mode: outline-minor
>> %% End:
>> --------------------------------------------------
>>
>> Emacs will put it in LaTeX/TeX mode with outline-minor-mode.
>>
>> I wonder if this is a bug.
>
> No. The buffer is autodetected as tex-mode buffer, and then the local
> variables section is acted upon; but calling (funcall
> 'outline-minor-mode) does not change the major mode, so it stays in
> tex-mode.
Sorry I was not clear. I am questioning whether the different behaviour
between these two ways of specifying local variables is a bug or not. In
my view, it is confusing at least.
> Juanma
--
.: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Tue, 17 Feb 2009 16:50:06 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juanma Barranquero <lekktu <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 17 Feb 2009 16:50:06 GMT)
Full text and
rfc822 format available.
Message #22 received at 2355 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Tue, Feb 17, 2009 at 17:04, Leo <sdl.web <at> gmail.com> wrote:
> Why is that an abuse? The manual does not specify what is not allowed.
"You can specify any number of variables/value pairs in this way, each
pair with a colon and semicolon as shown above. `mode: MODENAME;'
specifies the major mode; this should come first in the line."
It does explicitly says that mode: specifies the major mode. It does
not say that it should not be a minor mode, but it also doesn't say
that you cannot use any arbitrary function (ending in -mode). If the
function that you use does not set major-mode, it will cause confusion
(to Emacs or the user, or both).
> Sorry I was not clear. I am questioning whether the different behaviour
> between these two ways of specifying local variables is a bug or not. In
> my view, it is confusing at least.
Mode autodetection is complex (there are file variables,
interpreter-mode-alist, magic-mode-alist, magic-fallback-mode-alist,
etc.). It is not impossible to get nonsense (or, at least, unexpected)
results when given inconsistent input data. It would perhaps be better
to detect when a supposed major mode (found with -*-, auto-mode-alist
or whatever) is not really setting major-mode, but that's another bug
;-)
Juanma
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 07:45:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Leo <sdl.web <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 07:45:04 GMT)
Full text and
rfc822 format available.
Message #27 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
On 2009-02-17 16:43 +0000, Juanma Barranquero wrote:
>> Sorry I was not clear. I am questioning whether the different
>> behaviour between these two ways of specifying local variables is a
>> bug or not. In my view, it is confusing at least.
>
> Mode autodetection is complex (there are file variables,
> interpreter-mode-alist, magic-mode-alist, magic-fallback-mode-alist,
> etc.). It is not impossible to get nonsense (or, at least, unexpected)
> results when given inconsistent input data. It would perhaps be better
> to detect when a supposed major mode (found with -*-, auto-mode-alist
> or whatever) is not really setting major-mode, but that's another bug
> ;-)
But we are only talking about file variables in this case. There are two
ways of specifying file variables: in the header and at the end of the
file.
When they contain the pseudo-variable mode specifying a minor mode, they
behave differently.
The two behaviours are as follows.
1. put file in fundamental mode and the minor mode (when in header)
2. put file in a major mode by auto mode detection and the minor mode
(when at the end of file)
This causes confusion. Do you think this is a bug? If not, I think at
least the manual can be improved.
Thanks,
--
.: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 09:00:07 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juanma Barranquero <lekktu <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 09:00:07 GMT)
Full text and
rfc822 format available.
Message #32 received at 2355 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Wed, Feb 18, 2009 at 08:42, Leo <sdl.web <at> gmail.com> wrote:
> When they contain the pseudo-variable mode specifying a minor mode, they
> behave differently.
>
> The two behaviours are as follows.
Yes, that was perfectly clear in the bug report.
> 1. put file in fundamental mode and the minor mode (when in header)
> 2. put file in a major mode by auto mode detection and the minor mode
> (when at the end of file)
>
> This causes confusion. Do you think this is a bug?
No. It is undefined, but harmless, behavior after a user error.
> If not, I think at
> least the manual can be improved.
As I've said, I think the only way to improve the manual regarding
this issue is to make clearer that "mode:" should *not* specify a
minor mode, and that if you use it for that, you can get unexpected
behavior.
Juanma
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 14:30:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 14:30:02 GMT)
Full text and
rfc822 format available.
Message #37 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
> But we are only talking about file variables in this case. There are two
> ways of specifying file variables: in the header and at the end of the
> file.
> When they contain the pseudo-variable mode specifying a minor mode, they
> behave differently.
> The two behaviours are as follows.
> 1. put file in fundamental mode and the minor mode (when in header)
> 2. put file in a major mode by auto mode detection and the minor mode
> (when at the end of file)
> This causes confusion. Do you think this is a bug? If not, I think at
> least the manual can be improved.
Yes, the difference is undesirable. IIUC there's also another
difference: if the major mode is specified at the end, it is set after
setting the major-mode based on the file name.
It would be good to fix those discrepancies.
But it would also be good to improve the documentation so as to say
clearly that at least one of the `mode's specified should be
a major mode.
Stefan
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 14:30:12 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 14:30:12 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 15:20:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juanma Barranquero <lekktu <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 15:20:06 GMT)
Full text and
rfc822 format available.
Message #47 received at 2355 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Wed, Feb 18, 2009 at 15:23, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
> IIUC there's also another
> difference: if the major mode is specified at the end, it is set after
> setting the major-mode based on the file name.
That is, indeed, what causes the difference in behavior. BTW,
lisp/doc-view.el abuses it:
;; Local Variables:
;; mode: outline-minor
;; End:
> It would be good to fix those discrepancies.
I don't think investing effort in fixing wrong (harmless) behavior
caused by user error is very useful...
> But it would also be good to improve the documentation so as to say
> clearly that at least one of the `mode's specified should be
> a major mode.
You seem to be implying that it is OK to use mode: to set a minor
mode. That seems to contradict the docs, at least my reading of
(emacs)"27.1 How Major Modes are Chosen" and (emacs)"57.3.4.1
Specifying File Variables".
Also, a few times has been mentioned in emacs-devel that minor modes
are intended to be set by the user, not by the file.
Juanma
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 17:05:08 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 17:05:08 GMT)
Full text and
rfc822 format available.
Message #52 received at 2355 <at> emacsbugs.donarmstrong.com (full text, mbox):
> That is, indeed, what causes the difference in behavior. BTW,
> lisp/doc-view.el abuses it:
> ;; Local Variables:
> ;; mode: outline-minor
> ;; End:
This seems like a misuse because it just reflects the
author's preference.
>> It would be good to fix those discrepancies.
> I don't think investing effort in fixing wrong (harmless) behavior
> caused by user error is very useful...
I do not plan on investing any effort into it. But a patch would
probably be welcome, if it doesn't make the code more complex.
>> But it would also be good to improve the documentation so as to say
>> clearly that at least one of the `mode's specified should be
>> a major mode.
> You seem to be implying that it is OK to use mode: to set a minor mode.
Yes, it is.
> That seems to contradict the docs, at least my reading of
> (emacs)"27.1 How Major Modes are Chosen" and (emacs)"57.3.4.1
> Specifying File Variables".
My 57.3.4.1 here says:
You can use the `mode' "variable" to set minor modes as well as the
major modes; in fact, you can use it more than once, first to set the
major mode and then to set minor modes which are specific to particular
buffers. But most minor modes should not be specified in the file at
all, because they represent user preferences.
-- Stefan
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 17:50:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Leo <sdl.web <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 17:50:04 GMT)
Full text and
rfc822 format available.
Message #57 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
On 2009-02-18 15:13 +0000, Juanma Barranquero wrote:
>> It would be good to fix those discrepancies.
>
> I don't think investing effort in fixing wrong (harmless) behavior
> caused by user error is very useful...
You seem to always regard my use case wrong. Actually it is entirely
legitimate in accordance with the manual, not to mention there are many
similar cases one can find in the internet. The fact is people are using
mode to specify minor mode and there is no other means that can offer
more flexibility.
--
.: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 17:50:07 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juanma Barranquero <lekktu <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 17:50:07 GMT)
Full text and
rfc822 format available.
Message #62 received at 2355 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Wed, Feb 18, 2009 at 17:58, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
> This seems like a misuse because it just reflects the
> author's preference.
OK.
> My 57.3.4.1 here says:
>
> You can use the `mode' "variable" to set minor modes as well as the
> major modes; in fact, you can use it more than once, first to set the
> major mode and then to set minor modes which are specific to particular
> buffers. But most minor modes should not be specified in the file at
> all, because they represent user preferences.
OK, I'll eat my words right now :-) (Sorry, Leo, you were right)
OTOH, I think that's a documentation bug (ordering, not content).
There's this paragraph at the start:
You can specify any number of variables/value pairs in this way, each
pair with a colon and semicolon as shown above. `mode: MODENAME;'
specifies the major mode; this should come first in the line. The
VALUEs are not evaluated; they are used literally. Here is an example
that specifies Lisp mode and sets two variables with numeric values:
then about fifty lines discussing other things, then
Some "variable names" have special meanings in a local variables
list. Specifying the "variable" `mode' really sets the major mode,
while any value specified for the "variable" `eval' is simply evaluated
as an expression (its value is ignored). [...etc...]
(which again seems to suggest that mode: sets the major mode, BTW),
then the two paragraphs that talk about minor modes. So after three
quick browses of that node in search of mode information, I failed to
get the significant info. While I readily admit that my reading
ability in hurried situations (and foreign languages) could be
improved, I'd like to suggest that 57.3.4.1 would also benefit from
some reordering. :)
Juanma
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 18:15:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
bojohan+news <at> dd.chalmers.se (Johan Bockgård)
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 18:15:03 GMT)
Full text and
rfc822 format available.
Message #67 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> My 57.3.4.1 here says:
>
> You can use the `mode' "variable" to set minor modes as well as the
> major modes; in fact, you can use it more than once, first to set the
> major mode and then to set minor modes which are specific to particular
> buffers. But most minor modes should not be specified in the file at
> all, because they represent user preferences.
Indeed. But then there's the issue that minor modes are toggled, not set.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2355
; Package
emacs
.
(Wed, 18 Feb 2009 19:50:06 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> IRO.UMontreal.CA>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 18 Feb 2009 19:50:06 GMT)
Full text and
rfc822 format available.
Message #72 received at 2355 <at> emacsbugs.donarmstrong.com (full text, mbox):
> (which again seems to suggest that mode: sets the major mode, BTW),
> then the two paragraphs that talk about minor modes. So after three
> quick browses of that node in search of mode information, I failed to
> get the significant info. While I readily admit that my reading
> ability in hurried situations (and foreign languages) could be
> improved, I'd like to suggest that 57.3.4.1 would also benefit from
> some reordering. :)
Patches welcome ;-)
Stefan
Merged 2355 3430.
Request was from
Glenn Morris <rgm+emacsbugs <at> gnu.org>
to
control <at> emacsbugs.donarmstrong.com
.
(Thu, 18 Jun 2009 00:50:06 GMT)
Full text and
rfc822 format available.
Tags set to:
Request was from
Glenn Morris <rgm+emacsbugs <at> gnu.org>
to
control <at> emacsbugs.donarmstrong.com
.
(Thu, 18 Jun 2009 02:35:08 GMT)
Full text and
rfc822 format available.
Disconnected #3430 from all other report(s).
Request was from
Glenn Morris <rgm+emacsbugs <at> gnu.org>
to
control <at> emacsbugs.donarmstrong.com
.
(Thu, 18 Jun 2009 02:35:08 GMT)
Full text and
rfc822 format available.
Reply sent
to
Glenn Morris <rgm <at> gnu.org>
:
You have taken responsibility.
(Tue, 10 May 2011 02:34:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Leo <sdl.web <at> gmail.com>
:
bug acknowledged by developer.
(Tue, 10 May 2011 02:34:02 GMT)
Full text and
rfc822 format available.
Message #83 received at 2355-done <at> debbugs.gnu.org (full text, mbox):
Version: 24.1
The use of "mode:" to enable minor modes is now deprecated
(precisely because it has problems like this and others).
Use "eval: (minor-mode)" instead. See bug#8613.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 07 Jun 2011 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 19 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.