From: Daniel Schoepe <daniel.schoepe@googlemail.com>
To: "R. Clayton" <rvclayton@verizon.net>, help-gnu-emacs@gnu.org
Subject: Re: Major mode weirdness.
Date: Wed, 13 Jul 2011 19:15:31 +0200 [thread overview]
Message-ID: <87pqle14r0.fsf@gilead.invalid> (raw)
In-Reply-To: <87d3hejj8p.fsf@UlanBator.myhome.westell.com>
[-- Attachment #1: Type: text/plain, Size: 3146 bytes --]
On Wed, 13 Jul 2011 11:25:10 -0400, rvclayton@verizon.net (R. Clayton) wrote:
> I am running GNU Emacs 23.3.1 (i486-pc-linux-gnu, GTK+ Version 2.24.3) of
> 2011-04-10 on raven, modified by Debian on a debian testing system updated
> weekly.
>
> I have noticed that the initial scratch buffer, the one you get when you just
> run emacs with no command-line arguments, is in fundamental mode, even though
> .emacs contains, in custom-set-variables, '(initial-major-mode (quote
> text-mode)) and help-variable in *scratch* reports initial-major-mode's value
> is text-mode.
For me, using a ~/.emacs containing only this, works as expected:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(initial-major-mode (quote text-mode)))
So, your problem might be caused by something else in your configuration.
> I have also noticed that doing (setq major-mode 'text-mode) in .emacs has no
> effect: new buffers are set to fundamental mode rather than text mode. The
> help-variable documentation for major-mode indicates that setting help-mode
> makes it buffer local, which seems like strange behavior for a variable that's
> supposed to provide a global value. [..]
major-mode is not supposed to provide a global value. The idea is that
every buffer has its own major-mode, otherwise you couldn't have buffers
open for both C and lisp files and have them highlighted differently for
example. So it makes perfect sense for major-mode to be buffer-local.
If you want to set a default for a buffer-local variable, you can use
setq-default, like so:
(setq-default major-mode 'text-mode)
But because some functions that create a new buffers directly set the
major-mode of the buffer (e.g. mail clients creating a buffer to display
a message), it is doubtful what that line would actually accomplish.
>
> 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?
Since major-mode is buffer-local, that only changes the major-mode for
the currently selected buffer when that code is executed (depending on
your configuration, that might be the Emacs welcome buffer).
> Also, top-level setqs on initial-major-mode and major-mode used to work as
> expected up until a few weeks ago. What has changed since then? Searching
> around in the /usr/share/doc/emacs23 change files doesn't produce anything I
> can recognize as an explanation.
What exactly do you mean by work as expected? If you mean that (setq
major-mode 'text-mode) used to set the major-mode for the
scratch-buffer, then this only could have worked if *scratch* was the
current buffer when .emacs was run. I think this is an implementation
detail that you should not rely on anyway.
About initial-major-mode not working: As I said, I can't reproduce
that. (I'm also using Emacs 23.3.1, but from debian unstable).
Cheers,
Daniel
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
next prev parent reply other threads:[~2011-07-13 17:15 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 [this message]
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
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=87pqle14r0.fsf@gilead.invalid \
--to=daniel.schoepe@googlemail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=rvclayton@verizon.net \
/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.