help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Hook doesn't run as expected, if buffer mode is set from major-mode


From: Drew Adams
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)

> >> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]