all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Rolf Ade <rolf@pointsman.de>, help-gnu-emacs@gnu.org
Subject: RE: Hook doesn't run as expected, if buffer mode is set from major-mode
Date: Fri, 8 Jan 2016 18:07:14 -0800 (PST)	[thread overview]
Message-ID: <c04bf963-7360-4d89-914c-010540171c25@default> (raw)
In-Reply-To: <87d1tb4ngj.fsf@linux-qg7d.fritz.box>

> >> 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)?

Well, I was wrong, it seems; sorry.

I was going to say "Customize option `default-major-mode', but
`C-h v' tells me this:

   This variable is obsolete since 23.2;
   use `major-mode' instead.

 Documentation:
 Value of `major-mode' for new buffers.

So you can still customize it (I do), but you can also
just customize `major-mode', to provide the default value.

And `C-h v major mode' tells you how it works.  Summary:
it works just like `default-major-mode' works (and used to
work).  The current doc string for option `major-mode' is
identical to the pre-Emacs 23.2 doc string for
`default-major-mode' (except for the first line).

Seems to me that it was less confusing before this change,
but I suppose there were good reasons that offset the added
confusion.

Unfortunately, they did not put anything in the Emacs 23.2
NEWS about this change, so you would need to do a bit of
archaeology to find the rationale for the change.

> Take a look at C-h v major-mode RET. (And, maybe, C-h v
> default-major-mode RET).

Right.  Sorry for introducing confusion.



  reply	other threads:[~2016-01-09  2:07 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
2016-01-09  2:07     ` Drew Adams [this message]
     [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

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

  git send-email \
    --in-reply-to=c04bf963-7360-4d89-914c-010540171c25@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rolf@pointsman.de \
    /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.