help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Major mode weirdness.


From: PJ Weisberg
Subject: Re: Major mode weirdness.
Date: Wed, 13 Jul 2011 12:42:37 -0700

On Wed, Jul 13, 2011 at 8:25 AM, R. Clayton <rvclayton@verizon.net> wrote:

> Although I expect I know the answer to this one, I'll ask it anyway: why is it
> that a "top-level" setq on major-mode in .emacs doesn't work?

Two reasons:

1)  As has already been mentioned, setq sets the buffer-local value in
the current buffer, which is *scratch*.  I.e., it's not "top-level".

2)  The `major-mode' variable gets set when you switch modes, but it
doesn't work the other way around.*  If you're in lisp interaction
mode, and you set `major-mode' to `text-mode', now you're in lisp
interaction mode with `major-mode' equal to `text-mode'.  All that
does is confuse any code that looks at that variable to see what the
mode is.  To switch to text mode, you have to call the function
`text-mode'.

*Emacs does use the global default value of `major-mode' to decide
which mode to use for new buffers, though.  As someone else already
mentioned, you can do that with "(setq-default major-mode
'text-mode)".



reply via email to

[Prev in Thread] Current Thread [Next in Thread]