From: Rolf Ade <rolf@pointsman.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Hook doesn't run as expected, if buffer mode is set from major-mode
Date: Sat, 09 Jan 2016 01:15:56 +0100 [thread overview]
Message-ID: <87d1tb4ngj.fsf@linux-qg7d.fritz.box> (raw)
In-Reply-To: mailman.1999.1452288065.843.help-gnu-emacs@gnu.org
Drew Adams <drew.adams@oracle.com> writes:
>> If the major mode of a new buffer is determined by the variable
>> major-mode (nothing from auto-mode-alist et. al matches), then the hooks
>> of that major mode doesn't run, as I expect.
>
> `major-mode' is a buffer-local variable.
> It is set by the newly current major mode.
> IOW, you cannot use it to set the mode, as the mode sets it.
So, what do you think determines the major-mode of a new buffer, if (as
I wrote) nothing from auto-mode-alist, interpreter-mode-alist and
magic-mode-alist matches? What should I use for that (if I don't want
the default fundamental-mode)?
It is right, that major-mode is a buffer-local variable. And it is also
true, that it is set by the newly current major-mode. But what value
does the local variable major-mode have, if there isn't a major-mode,
for a new buffer? Right, its default value. And this is a way to set the
major mode of a new buffer, if there isn't another known from other
sources.
Take a look at C-h v major-mode RET. (And, maybe, C-h v
default-major-mode RET).
next prev parent reply other threads:[~2016-01-09 0:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 19:58 Hook doesn't run as expected, if buffer mode is set from major-mode Rolf Ade
2016-01-08 21:20 ` Drew Adams
2016-01-08 23:32 ` Michael Heerdegen
[not found] ` <mailman.1999.1452288065.843.help-gnu-emacs@gnu.org>
2016-01-09 0:15 ` Rolf Ade [this message]
2016-01-09 2:07 ` Drew Adams
[not found] ` <mailman.2004.1452295936.843.help-gnu-emacs@gnu.org>
2016-01-09 0:36 ` Rolf Ade
2016-01-09 2:09 ` Drew Adams
2016-01-09 2:19 ` Michael Heerdegen
[not found] ` <mailman.2012.1452305981.843.help-gnu-emacs@gnu.org>
2016-01-09 22:14 ` Rolf Ade
2016-01-10 4:29 ` Michael Heerdegen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d1tb4ngj.fsf@linux-qg7d.fritz.box \
--to=rolf@pointsman.de \
--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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).