From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: PJ Weisberg Newsgroups: gmane.emacs.help Subject: Re: Major mode weirdness. Date: Wed, 13 Jul 2011 12:42:37 -0700 Message-ID: References: <87d3hejj8p.fsf@UlanBator.myhome.westell.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1310586490 11993 80.91.229.12 (13 Jul 2011 19:48:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 13 Jul 2011 19:48:10 +0000 (UTC) To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 13 21:48:06 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qh5Ph-0005An-RJ for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jul 2011 21:48:05 +0200 Original-Received: from localhost ([::1]:56095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qh5Pg-0002YD-Dm for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jul 2011 15:48:04 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qh5KY-0001rN-6H for Help-gnu-emacs@gnu.org; Wed, 13 Jul 2011 15:42:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qh5KW-0000kh-Jr for Help-gnu-emacs@gnu.org; Wed, 13 Jul 2011 15:42:45 -0400 Original-Received: from p3plsmtpa07-05.prod.phx3.secureserver.net ([173.201.192.234]:54887) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Qh5KV-0000cq-S2 for Help-gnu-emacs@gnu.org; Wed, 13 Jul 2011 15:42:44 -0400 Original-Received: (qmail 17169 invoked from network); 13 Jul 2011 19:42:39 -0000 Original-Received: from unknown (209.85.161.52) by p3plsmtpa07-05.prod.phx3.secureserver.net (173.201.192.234) with ESMTP; 13 Jul 2011 19:42:39 -0000 Original-Received: by fxd18 with SMTP id 18so2389100fxd.39 for ; Wed, 13 Jul 2011 12:42:37 -0700 (PDT) Original-Received: by 10.223.75.138 with SMTP id y10mr2201079faj.36.1310586157398; Wed, 13 Jul 2011 12:42:37 -0700 (PDT) Original-Received: by 10.223.89.142 with HTTP; Wed, 13 Jul 2011 12:42:37 -0700 (PDT) In-Reply-To: <87d3hejj8p.fsf@UlanBator.myhome.westell.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 173.201.192.234 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81574 Archived-At: On Wed, Jul 13, 2011 at 8:25 AM, R. Clayton 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)".