all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: PJ Weisberg <pj@irregularexpressions.net>
To: help-gnu-emacs <Help-gnu-emacs@gnu.org>
Subject: Re: Major mode weirdness.
Date: Wed, 13 Jul 2011 12:42:37 -0700	[thread overview]
Message-ID: <CAJsNXTmw482h1C0nB=iW1hDmF=fDFbgyWgTFPfNAC+ZWcFgBFg@mail.gmail.com> (raw)
In-Reply-To: <87d3hejj8p.fsf@UlanBator.myhome.westell.com>

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



      parent reply	other threads:[~2011-07-13 19:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 15:25 Major mode weirdness R. Clayton
2011-07-13 17:15 ` Daniel Schoepe
2011-07-13 18:37 ` Valentin Plechinger
2011-07-13 20:41   ` R. Clayton
2011-07-13 21:07     ` Valentin Plechinger
2011-07-13 21:20       ` Daniel Schoepe
2011-07-13 21:37         ` Peter Münster
2011-07-13 21:59         ` PJ Weisberg
2011-07-13 19:42 ` PJ Weisberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJsNXTmw482h1C0nB=iW1hDmF=fDFbgyWgTFPfNAC+ZWcFgBFg@mail.gmail.com' \
    --to=pj@irregularexpressions.net \
    --cc=Help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.