emacs-devel
[Top][All Lists]
Advanced

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

Re: fundamental-mode-hook


From: Lennart Borgman (gmail)
Subject: Re: fundamental-mode-hook
Date: Thu, 08 Feb 2007 02:13:57 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666

Karl Fogel wrote:
"Lennart Borgman (gmail)" <address@hidden> writes:
The elisp manual

  (info "(elisp) Major Mode Conventions")

says that

  Each major mode should have a normal "mode hook" named
  `MODENAME-mode-hook'.

fundamental-mode does not have such a hook.

Do you have a use in mind for such a hook, or is the inconsistency
just bugging you?  (Not a facetious question, I'm honestly trying to
figure out if the situation is a problem or not.)

In simple.el, fundamental-mode's definition is pretty tiny:

   (defun fundamental-mode ()
     "Major mode not specialized for anything in particular.
   Other major modes are defined by comparison with this one."
     (interactive)
     (kill-all-local-variables)
     (unless delay-mode-hooks
       (run-hooks 'after-change-major-mode-hook)))

Hmm, for one thing, I'm not sure why it doesn't just say

   (delay-mode-hooks 'after-change-major-mode-hook)

instead of checking the variable delay-mode-hooks manually.  Aside
from that, it would be pretty easy to stick a run-hooks call in there,
but would it really help anyone do anything they couldn't do before?


I am not sure what to answer at the moment. I just found this inconsistency when I tried to check if a function was a major mode function. I tested to see if the hook variable existed (probably not the best way, but that is what I did).

I then remembered that there are no hook for new buffers. Are they not set up in fundamental-mode?

BTW, there are more major modes missing this hook: Info-mode, xml-mode is what I have noticed so far.




reply via email to

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